How do you detect when the Flowplayer has started playing the video?

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-05-11T22:07:03Z Indexed on 2010/05/11 22:14 UTC
Read the original article Hit count: 292

Filed under:
|
|
|

Hi. I'm using the Flowplayer Flash video player to play MP4 videos inside an AnythingSlider. I need to detect when the user has clicked the start button on the video so to stop the slideshow and allow the user to view the video. I've tried using this code just to get an alert box but it doesn't do anything (the code is at the end of the page, before the closing </body> tag):

<script type="text/javascript">
    $f("player","global/js/flowplayer/flowplayer-3.1.5.swf",{
        onStart: function(clip) {
            alert('player started');                
        }
    });
</script>

The Flowplayer is implemented as part of the html5media library, which automatically detects whether the browser can handle the <video> tag; if not, it replaces the anchor tag below with the Flowplayer:

<video id="vid" width="372" height="209" 
     poster="global/vid/bbq-poster.jpg" controls preload>
    <source id="videoSource" src="global/vid/BBQ_Festival.mp4" 
        type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' 
        onerror="fallback(this.parentNode)" ></source>
    <a  
         href="global/vid/BBQ_Festival.mp4"  
         style="display:block;width:372px;height:209px; padding-left:5px; "  
         id="player"> 
    </a> 
</video>

So the $f() function call is in a JavaScript block at the end of the page, to give the player a chance to load correctly. What am I doing wrong? Thanks.

© Stack Overflow or respective owner

Related posts about flowplayer

Related posts about jQuery