Hello, everyone!
Javascript method named getTime();
as well as the getDuration();
that gives us the duration of a video in question if aggregated to <object/>
and <embed/>
.
Well, it's my question:
How to capture from start to end of a video by method getTime();
?
And how to compare if it stopped, and display a message notifying you that the video has ended?
Code
var video = document.embeds[0];
var max = video.getDuration();
var seg = video.getTime();
var con = document.getElementById('txt');
function Tempo()
{
seg = video.getTime().toFixed();
con.textContent = seg;
}
if ( seg == con ) { clearInterval(id) || alert(video.getDuration().toFixed()) }
var id = setInterval("Tempo()", 1000);
<embed src="http://cache28.vuclip.com/53/65/5365756905f3dbd79909b3cce52649a3/ba63207/NiceGuys_5365_w_3.3gp"/>
<hr>
<span id='txt'></span>
Given what I've done so far. It is only necessary to compare if it arrived at the limit of the output <span id='txt'></span>
and then show the alert();
.