I am trying to understand this problem:
I have a html5 video with two buttons:
<video id="test" height="500" width="800" >
<source src="mysrc.mp4">
</video>
<button id='playP'>PLAY Popcorn</button>
<button id='playV'>PLAY html5</button>
In javascript, I add action on buttons to play video at specific time
I test one button with Popcorn.js library (because i use it in a project),
popVideo.play(20);
and the other one with direct native html5
htmlVideo.currentTime = 20;
htmlVideo.play();
the full code :
function playVideo(){
Popcorn(function(){
var popVideo = Popcorn('#test'),
htmlVideo = document.getElementById('test'),
playBtn = document.getElementById('playP'),
layBtnV = document.getElementById('playV');
playBtn.addEventListener('click', function(){
popVideo.play(20);
})
playBtnV.addEventListener('click', function(){
htmlVideo.currentTime = 20;
htmlVideo.play();
})
})
}
playVideo();
When i read only these code through index.html, i have no problem. Seeking video is working, it is played from 20 seconds.
The problem is when I run the project with Cordova in the browser
For this I add this code to wait cordova to be ready :
function onDeviceReady (){
console.log('device ready');
playVideo();
}
document.addEventListener('deviceready', onDeviceReady, true);
then in the terminal I launch the app preview
cordova run browser
and then : play buttons work, except they play video from beginning and not from 20 seconds ! I tried many other solutions, even in more complex project, but it seems the fact to build app with cordova destroy currentTime action, on both Popcorn instance and HTML5 native...
Does someone had this problem, and a solution for it ?
EDIT : In fact, I tried this on ipad, and it works... So the problem is only on browser preview... It should be normal, with the deviceready event, because I guess that browser is not a device..But in this case, if I want my app be working for browser too, is it possible, and how ?...