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

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 video played, ie if the video player is inactive (stopped) emit alert() or if it is active (running) the function continues checking with method setInterval() .

What I have done so far since 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 got a breakthrough, but what I have right now is a code that previews the video for 10 seconds and that's it!

But the intention is to identify if the video has come to an end, if it has come then to issue a alert() , otherwise it keeps checking if the video in <embed/> is stopped or not.

  

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

In order to do this, it is necessary to check the method setInterval() from time to time, I have not yet been able to formulate a routine that captures this property > native Stop()

    
asked by anonymous 12.06.2016 / 22:02

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>  
    
13.06.2016 / 05:46
0

Maybe this can help somebody else, please visit - know -you-video-of-youtube-finished

    
16.06.2016 / 18:35