Detect stop() from Object Embed and return Alert()

Asked

Viewed 382 times

1

To all, once again, I ask for help.

I’m using a firefox with Mplayer Plugin

What I want is to send an Alert to the end of a played video, that is, if the video player is inactive (stopped) to broadcast alert() or if active(running) the function continues to check with method setInterval().

What I have done so far since the time of the question asked:

<script>
<!--
var obj = document.embeds[0];

function Stop(){
obj.Stop(); alert('Tempo de Preview, terminado.');
}

window.onload = function(){setTimeout('Stop()', 10*1000);}
-->
</script>

Let’s say I made a breakthrough, but what I have at the moment is a code that makes a preview of the video by 10 seconds and ready!

But the intention, is to identify if the video came to an end, if it came then to broadcast a alert(), otherwise continue to check whether the video on <embed/> is or is not Stopped(stop).

This dialog alert() is just to illustrate the example of what I want.

Only for that, as you can see, you need to check from time to time by the method setInterval(), I still haven’t been able to formulate a routine that captures this property native Stop()

  • I almost understood, but then:"What I want is to catch the end of a video played without knowing the time elapsed." This confused me, gives some more details... Think about the "cake recipe", step by step of what you want?

  • 1

    See if you can get some help man... http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_av_prop_ended and http://w3schools.com/tags/ref_av_dom.asp

  • Helped, flowed or stopped ?

2 answers

1


Take a look boss:

<script type="text/javascript">

    function vidplay() {
       var vid = document.getElementById("Videobox");
       var button = document.getElementById("btn_play");
       if (vid.paused) {
          vid.play();
          document.getElementById("pipoca").innerHTML = "Ae, pipoca quentinha !";
          button.textContent = "||";
          
       } else {
          vid.pause();
          document.getElementById("pipoca").innerHTML = " ";
          alert("Não para não, tava legal !");
          button.textContent = ">";
       }
    }

    function restart() {
        var vid = document.getElementById("Videobox");
        video.currentTime = 0;
    }

    function skip(value) {
        var vid = document.getElementById("Videobox");
        video.currentTime += value;
    } 
    

	function myFunction() { 
		var vid = document.getElementById("Videobox");
	    alert("Acabou, gostou do vídeo ? Acesse : http://www.bigbuckbunny.org/ e veja mais !");
}      
</script>

</head>
<body>        

<video id="Videobox" onended="myFunction()" autoplay>
    <source src="http://mirror.cessen.com/blender.org/peach/trailer/trailer_iphone.m4v" type="video/mp4" />
     
</video>

<div id="controles">
    <button id="btn_restart" onclick="restart();">[]</button> 
    <button id="btn_rew" onclick="skip(-10)">&lt;&lt;</button>
    <button id="btn_play" onclick="vidplay()">&gt;</button>
    <button id="btn_fastFwd" onclick="skip(10)">&gt;&gt;</button>
</div>
<p>Video <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
<p id="pipoca"></p>  

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.