简体   繁体   中英

Cordova currentTime in HTML5 video

I'm developing a Cordova app for Android and I need to put a video with some cue points controlled by buttons.

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.

The code I have is:

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.


EDIT:

Still no results, now I'm with this:

document.getElementById("video").currentTime = seconds;
document.getElementById("video").play();

But does the same as the others.

Anyone can help?


Thanks.

It was because of the frame rate.

The video I was trying initially had 30 and I tried with one of 24 and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM