-1

I have integrated flowplayer in my website.

As a next step, I want to trigger its video play function, so that when a user plays a video, she/he will simply press a play button, that will call a function.

Can anybody please help me achiving that?

I am trying to do this:

<script language="javascript">
$(document).ready(function(){   
$( ".fp-play" ).change(function() {
  alert( "Handler for .click() called." );
});
    });
</script>

This is my HTML code:

<div class="artist_vidoe_player fl clear">
    <div class="flowplayer" data-swf="<?php echo WEB_URL; ?>assets/styles/frontend/js/flowplayer.swf" data-ratio="0.4167">
        <video>
            <source type="video/flv" src="<?php echo WEB_URL; ?>assets/styles/uploads/videos/<?php echo $rowvid->v_uploadname; ?>">
        </video>
    </div>
    <div style="float:left; margin-top:15px;">   
        <div class="clear"></div>
        <h1><?php echo $rowvid->v_filename; ?></h1>
        <p>258 Views</p>
        <p><img src="<?php echo WEB_URL; ?>assets/styles/frontend/images/stars_img.png" width="90" height="16" alt="" /></p>
    </div>
</div>

The above code dynamically generates my videos, but this is all not working for me anyway.

Philipp Maurer
  • 2,480
  • 6
  • 18
  • 25

1 Answers1

0

You can use .click() instead of .change() as well as using .trigger() to trigger click event:

$(document).ready(function(){   
    $( ".fp-play" ).click(function() {
        alert( "Handler for .click() called." );
    }).trigger('click');
});
Felix
  • 37,892
  • 8
  • 43
  • 55
  • Flowplayer features a javascript API and triggers the onStart event at the moment you start playing the video. You'll find more information here: http://flowplayer.org/documentation/events/clip.html – Felix Mar 22 '14 at 07:25