Can't play this video error in MacDonst videoplayer - android

I’m trying to play a simple .MP4 via the MACDONST plugin, but get an error reading “Can’t play this video” as soon as the video player is displayed. I can play the video file in the Android standalone video player, and I can call a Youtube video via the plugin. Many thanks for your help! Here's my page code:
<!DOCTYPE html>
<html>
<head>
<title>InAppBrowser.addEventListener Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
<script type="text/javascript" charset="utf-8" src="video.js"></script>
<script type="text/javascript">
//app.initialize();
function init()
{
document.addEventListener("deviceready", console.log('ready'), true);
}
function playVideo(vidUrl) {
//alert("Starting Vid Script");
window.plugins.videoPlayer.play(vidUrl);
}
</script>
</head>
<body onload="javascript:init()">
Play Stream<br>
Play File<br>
Play File from SD<br>
</div>
</body>
</html>

First you create directory in your www location directory I named videos.
then put your stigma.mp4 file into the videos directry then call your path like bellow mentioned
Play File
Note: your video file dose not contain any special character like (, & - & _ etc..) only file file extention .mp4

Related

How to play mp3 file using Jquery in android PhoneGap

i want to play mp3 file in background using jQuery in android phoneGap, i have included cordova-2.2.0.js with jquery-1.9.0.js file .. here is my html code. what i am doing wrong while i have given all permissions in Manifest File
here is my html page
<!DOCTYPE HTML>
<html>
<head>
<title>First App</title>
</head>
<body>
<h1>Welcome to PhoneGap</h1>
<h2>Edit assets/www/index.html</h2>
<script src="cordova-2.2.0.js"></script>
<script src="jquery-1.9.0.js"></script>
<script>
$(document).ready(function(){
alert("hey");
var audio = new Audio();
audio.src = "audio.mp3";
audio.play();
});
</script>
</body>
</html>
try this link, use media instead of audio
var myaudio = new Media('/android_asset/www/audio/file.mp3');
for Your Error Attempt to call getDuration without valid media player
try this links
https://groups.google.com/forum/#!topic/phonegap/aa_2dHjy9C0
http://www.anddev.org/multimedia-problems-f28/mediaplayer-attempt-to-call-getduration-without-t51386.html
Android: attempt to call getduration without a valid mediaplayer
http://maffelu.net/phonegap-attempt-call-getduration-without-valid-mediaplayer/
i am saying to check this link bacause you have not posted the android code so try it.
Hope this will help.

Epub Reader example Issue

I try to read epub file content to convert book formats using phonegap technology.i found examples using phonegap as shown below link:
http://bytedebugger.wordpress.com/2014/05/21/cordovaphonegap-ebook-reader-for-web-and-mobile-with-epub-js-plugin/
In this examples i am tries to implements basic epub example.I tries code as shown below :
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Basic ePubJS Example</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- EPUBJS Renderer -->
<script src="../build/epub.min.js"></script>
<!-- Zip JS -->
<script src="../build/libs/zip.min.js"></script>
<!-- Inflate JS -->
<script src="../build/libs/inflate.js"></script>
<script>
EPUBJS.filePath = "../build/libs/";
</script>
<script>
var Book = ePub("content.epub");//here epub file path given
</script>
</head>
<body>
<div id="main">
<div id="prev" onclick="Book.prevPage();" class="arrow">‹</div>
<div id="area"></div>
<div id="next" onclick="Book.nextPage();"class="arrow">›</div>
</div>
<script>
Book.renderTo("area");
</script>
</body>
</html>
Error : The operation is insecure. undefined
The above example not gets any output it shows empty.I didn't get any idea about this.So can you please suggest me what to do for this?
Thanks in Advance.
First, reading this documentation: https://github.com/futurepress/epub.js/blob/master/README.md you will see an important part:
If you plan on using compressed (zipped) epubs (any .epub file)
include the minified version of zip.js
Also make sure to set EPUBJS.filePath to the directory containing inflate.js
<script src="/build/libs/zip.min.js"></script>
<script>
EPUBJS.filePath = "../build/libs/";
</script>
So, the first thing you need to do is to add theses libs.
Some browsers can block the access of a file, so if you have problems, maybe you will need to use it with a web server.

Android JW Player issue

I had implement JW Player in android, but getting black screen when video load from live URL.
My HTML file
<!DOCTYPE html>
<html>
<head>
<script src="http://jwpsrv.com/library/WcmD+p3DEeKQvCIACpYGxA.js"></script>
</head>
<body>
<div id='my-video'></div>
<script type='text/javascript'>
jwplayer('my-video').setup({
file: 'http://content.bitsontherun.com/videos/lWMJeVvV-364767.mp4',
image: 'http://www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg',
width: '320',
height: '180'
});
</script>
</body>
</html>
and my Java Code is
myBrowser.getSettings().setJavaScriptEnabled(true);
myBrowser.loadUrl("http://. . . /hardik/jwplayerhtml.html");
what is wrong with me? Please help me.

Video not playing in android webview

I am loading html page in asset folder to android webview, the html pages has video. But video not playing, Here i share the code.
<!doctype html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" charset="utf-8" src="video.js"></script>
<script>
function en(){
video1.play();
}
</script>
</head>
<body>
<div id="t2" width ="1024" height="768" style="background- image:url(images/L6_P007.jpg); background-repeat:no-repeat;">
<video id="video1" width="1024" height="768" poster="images/L6_P007.jpg" controls autoplay onended="en();" >
<source src="videos/L6_P007.mp4" type="video/mp4">
<source src="videos/L6_P007.ogv" type="video/ogg">
<source src="videos/L6_P007.webm" type="video/webm">
</video>
</div>
</body>
</html>
This is my java code
WebView webview = (WebView) findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient());
webview.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
webview.loadUrl("file:///android_asset/videosamp/videosamp.html");
this issue is discussed many times on SO. check the answers to similar question here
get the VideoPlayer Plugin for android here.
The video player allows you to display videos from your PhoneGap application.
This command fires an Intent to have your devices video player show the video.
Adding the Plugin to your project
Using this plugin requires Android PhoneGap.
To install the plugin, move www/video to your project's www folder and include a reference to it in your html file after phonegap.js.
Create a directory within your project called "src/com/phonegap/plugins/video" and move VideoPlayer.java into it.
In your res/xml/plugins.xml file add the following line:
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
Using the plugin
The plugin creates the object window.plugins.videoPlayer. To use, call the play() method:
/**
* Display an intent to play the video.
*
* #param url The url to play
*/
play(url)
Sample use:
window.plugins.videoPlayer.play("http://path.to.my/video.mp4");
window.plugins.videoPlayer.play("file:///path/to/my/video.mp4");
window.plugins.videoPlayer.play("file:///android_asset/www/path/to/my/video.mp4");
window.plugins.videoPlayer.play("https://www.youtube.com/watch?v=en_sVVjWFKk");
Note: When playing video from the assets folder, the video is first copied to internal storage with MODE_WORLD_READABLE.

Android - Access remote URL from SWF (JW Player) embedded in assets folder

I am loading an HTML file from my assets folder into a WebView using loadUrl(). The HTML file references a JW Player swf embedded alongside it in the assets folder.
I want JW Player to play a remote URL. Sadly, it will not.
If I load the SWF remotely from another server (instead of using the SWF in my assets folder) I can access external URL's. In this case, the external URL is an RTMP stream. For example:
<!DOCTYPE html>
<html lang='en'>
<head><meta charset='utf-8'>
</head>
<body style='margin:0; pading:0;background-color: #000000;'>
<script type='text/javascript' src='http://developer.longtailvideo.com/svn/trunk/fl5/jwplayer.min.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'http://developer.longtailvideo.com/svn/trunk/fl5/player.swf',
'file': 'testvid.mp4',
'streamer': 'rtmp://b27i9s9t3.rtmphost.com/AndroidMedia',
'controlbar': 'bottom',
'width': '800',
'height': '450'
});
</script>
</body>
...works
<!DOCTYPE html>
<html lang='en'>
<head><meta charset='utf-8'>
</head>
<body style='margin:0; pading:0;background-color: #000000;'>
<script type='text/javascript' src='file:///android_asset/jwplayer.min.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'file:///android_asset/player.swf',
'file': 'testvid.mp4',
'streamer': 'rtmp://b27i9s9t3.rtmphost.com/AndroidMedia',
'controlbar': 'bottom',
'width': '800',
'height': '450'
});
</script>
</body>
...does not work. JW Player loads - but once the play button is hit it flashes a quick "connection unavailable: error #2028" and then spins the ajax spinner forever.
I'm assuming this is a general issue with all SWF's loaded from the assets folder into a web view and is not specific to JW Player.
Any ideas?

Categories

Resources