How detect in vanilia javascript end of video in tag <OBJECT> html?

317 views Asked by At

I must use tag object type="video/mp4" in my project for hbbtv, and I want detect end of movie in vanilia JS. How can i do it?

2

There are 2 answers

3
Atul Sharma On

document.getElementById('objectId').addEventListener('ended',endCallback,false);

function endCallback(e) {
       //Action
}

0
user9205184 On

When using the AVControl object, you have to register the PlayStateChange event and check playState 5 (Finished).

    document.getElementById('objectId').onPlayStateChange = function() {
    if (document.getElementById('objectId').playState == 5) {  // FINISHED }
    };

http://www.oipf.tv/docs/OIPF-T1-R2_Specification-Volume-5-Declarative-Application-Environment-v2_3-2014-01-24.pdf 7.14.1 The A/V Control object