How do you detect when the Flowplayer has started playing the video?
- by Alex
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.