javascript - HTML5 currentTime not working in PhoneGap -
i'm using phonegap , making app samsung galaxy tab 2. i'm trying play mp4 video starting @ specific time. using code video starts beginning, , not 20 seconds in. wrong?
function ondeviceready() { var playerdiv = document.getelementbyid('player'); playerdiv.innerhtml="<video id='video' src='"+window.localstorage.getitem("selectedvideo")+"' loop='loop' width='1285' height='752'></video>"; document.getelementbyid("video").addeventlistener("loadedmetadata", function() { this.currenttime = 20; }, false); } function playvideo() { document.getelementbyid('video').play(); }
i have tried this, still starts beginning:
document.getelementbyid('video').addeventlistener('loadedmetadata', function() { this.currenttime = 20; this.play(); }, false);
and using canplay insted of loadedmetedata not work.
here similar question
trouble audio tag, jquery, , currenttime
var audio = $('audio'); audio.bind('canplay', function() { this.currenttime = 20; }); audio.get(0).play();