HTML5视频中的Cordova currentTime [英] Cordova currentTime in HTML5 video
问题描述
我正在为Android开发一个Cordova应用程序,我需要放置一个带有一些由按钮控制的提示点的视频。
I'm developing a Cordova app for Android and I need to put a video with some cue points controlled by buttons.
在HTML中,我有代码加载mp4文件和按钮。使用JS,我试图在点击事件上添加提示点,但是我在currentTime属性中输入的任何数字始终从视频的开头开始。
In the HTML, I have the code to load the mp4 file and the buttons. With JS I'm trying to add the cue points on a click event, but any number I put in the currentTime property, always starts from the beginning of the video. Instead of start from the point I have put.
我拥有的代码是:
document.getElementById("video").load();
document.getElementById("video").addEventListener('loadedmetadata', function() {
document.getElementById("video").play();
document.getElementById("video").currentTime = seconds;
}, false);
我试图更改行的顺序,因为我在那儿看了些东西但没有结果。
I tried to change the order of the lines, because I read something over there but no results.
编辑:
仍然没有结果,现在我有了:
Still no results, now I'm with this:
document.getElementById("video").currentTime = seconds;
document.getElementById("video").play();
但与其他方法相同。
有人可以提供帮助吗?
谢谢。
推荐答案
这是因为帧频。
我最初尝试的视频有30个,而我尝试使用的是24个,那么它就可以了。
The video I was trying initially had 30 and I tried with one of 24 and it worked.
这篇关于HTML5视频中的Cordova currentTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!