Reputation: 433
I'm developing an application (a kind of social network for my university) and I have a problem with the Android video Player Phonegap plugin
I have already do the 3 steps defined in the README to install the plugin but it doesn't work on my phone (Galaxy Ace Android 2.3.6) and on the emulator (4.0). I just load the Javascript (video.js) after (cordova.js) I have this error:
Uncaught Function required the first argument! At cordova 2.2.0.js
It seems that video.js has a problem to use cordova.js. And when I tap the play button I have another error:
Uncaught Type Error: Cannot read property 'videoPlayer'
And in this case it seems that video.js has not created a video Player object...
The code of my page is the same as the example on github:
<html>
<head>
<meta name="viewport" content="width=320; user-scalable=yes" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="script/video.js"></script>
<script type="text/javascript">
function init(){
document.addEventListener("deviceready", console.log('ready'), true);
}
function playVideo(vidUrl) {
window.plugins.videoPlayer.play(vidUrl);
}
</script>
</head>
<body onload="init();">
<a href="#" onclick="playVideo('http_link')">Play HTTP</a>
</body>
Thanks to all.
Upvotes: 1
Views: 10549
Reputation: 71
THe best way to reproduce Video with html is with Tag of HTML5.
Not all browser spport this, you have to try to Know!
http://www.w3schools.com/html/html5_video.asp
Upvotes: 0
Reputation: 410
if you add this
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
to plugins.xml in res/xml folder.
then check code
window.plugins.videoPlayer.play("https://www.youtube.com/watch?v=en_sVVjWFKk");
define two line in index.html
<script type="text/javascript" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="video.js"></script>
Upvotes: 0
Reputation: 23273
I just made a code change to the VideoPlayer which should make it backward compatible with the old window.plugins.videoPlayer way of doing things. If you are using the 2.2.0 version of the plugin go get the new JS file.
https://github.com/macdonst/VideoPlayer/blob/master/2.2.0/www/video.js
Upvotes: 1