HTML5当前时间不能在PhoneGap
问题描述:
我正在使用PhoneGap并为三星Galaxy Tab 2制作应用程序。我试图在特定时间开始播放mp4视频。使用此代码,视频仅从一开始就开始播放,而不是20秒。有什么可能是错误的?HTML5当前时间不能在PhoneGap
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();
}
我也试过,但它仍然从头开始:
document.getElementById('video').addEventListener('loadedmetadata', function() {
this.currentTime = 20;
this.play();
}, false);
而且使用canplay insted的loadedmetedata不起作用。
答
这里是
Trouble with audio tag, jQuery, and currentTime
var audio = $('audio');
audio.bind('canplay', function() {
this.currentTime = 20;
});
audio.get(0).play();
+0
我试过了。它根本不播放视频。 – user2319698 2013-04-25 12:59:02
你能指定的Android版本类似的问题? – poiuytrez 2013-04-25 12:59:19
我正在使用Android 4.0.4 – user2319698 2013-04-25 14:11:48