Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to modify this code:

http://v4e.thewikies.com/[^]

the <video> html versions are fine, but for the flash player none of my event listeners work. I need to do the following:
- only play the video after it has buffered
- autoplay once buffered
- start a function (setup) on play of the video

This is what I have:


XML
<video id="vid" width="640" height="360" preload="auto" poster="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg">
        <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4"></source>
        <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm"></source>
        <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv" type="video/ogg"></source>
        <object width="640" height="360" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" type="application/x-shockwave-flash">
        <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
        <param name="allowFullScreen" value="true">
        <param name="wmode" value="transparent">
        <param name="flashVars" value="config={'playlist':['http%3A%2F%2Fsandbox.thewikies.com%2Fvfe-generator%2Fimages%2Fbig-buck-bunny_poster.jpg',{'url':'http%3A%2F%2Fclips.vorwaerts-gmbh.de%2Fbig_buck_bunny.mp4','autoPlay':false}]}">
        <img width="640" height="360" title="No video playback capabilities, please download the video below" alt="Big Buck Bunny" src="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg">
    </object>
    </video>



java:

C#
function addMyListeners(){
    var myVideo = document.getElementsByTagName('video')[0];
    myVideo.addEventListener('loadedmetadata', getPercentProg, false);
    myVideo.addEventListener('canplaythrough', setUp, false);
}


the above starts onload() of body

C#
function getPercentProg() {
     var myVideo = document.getElementsByTagName('video')[0];
// displays the buffered amount (removed for clarity)

 }
 function createTimer(i) {
     setTimeout( function() {

     // does some code (irrelevant)
     

         }, 1000+i*1000);

 }
function setUp() {
    var myVideo = document.getElementsByTagName('video')[0];
    document.getElementById("loadStatus").style.display = "none";
    myVideo.play();
    for(var i=0; i < myVideo.duration; i++)
     {
         createTimer(i);
     }
}


the code above works perfect for the html5, as I have said but I cant get any way of them to work with the flash fall-back.

Many thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900