• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Foliovision

  • Weblog
    • FV Player
    • WordPress
    • Video of the Week
    • Case Studies
    • Business
  • About
    • Testimonials
    • Meet the Team
    • We Support
    • Careers
    • Contact
    • Pricing
  • Products
  • Support
    • FV Player Docs
    • Pro Support
  • Login
  • Basket is empty

How use the ‘finish’ event?

[Solved]

Foliovision › Forums › FV Player › How to … › How use the ‘finish’ event?

  • apasho 3 years, 11 months ago

    I’ve create a page the contains five panels and a FV Player shortcode is inserted into each panel. Only one panel is visible at a time. Once document ready is loaded, I am able to get the visible video to play using

    if(typeof(flowplayer) != "undefined") { 
        console.log('flowplayer defined');
        setTimeout(function () {
          flowplayer(0).load();
        }, 1000);
      }  
    });
    

    I have not yet found a way to do something with ‘bind’ or ‘on’ ‘finish’. Also, if I call ‘flowplayer(0)’ a second time, the first reference to ‘flowplayer(0)’ becomes undefined.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Martin 4 years ago

    Hello Apasho,

    wouldn’t it be better to just use the autoplay function of FV Player? If it somehow plays the video in one of your hidden panels, perhaps we can improve it to only work for a player which is visible.

    I would recommend you to use the callback to get access to the player API, like:

    flowplayer( function(api,root) {
      ...
    });
    

    More in our programming guide: https://foliovision.com/player/advanced/api-programming

    Thanks,
    Martin

    apasho 4 years ago

    It seems if the videos were set to autoplay then more than one are going to attempt to play on page load. But, using this code,

    flowplayer(0).bind('finish', function(e,api,time) {
    console.log('video has finished');
      if(jQuery(cdata).parent().next().length){
        jQuery(cdata).parent().next().find('a').click(); 	
      }  
    });
    

    I am able to switch to the next panel when a video finishes. The only issue is to get the currently displayed video to play. Often when I call api.load(), a video not currently visible begins to play. Is there a way to find the current video and give it the command to play?
    The currently visible panel uses the class ‘vc_active’.

    And yes, I am using

    flowplayer( function(api,root) {
      api.load();
      ...
    });
    

    Thank you for your response.

    Martin 4 years ago

    Hello Apasho,

    it seems to me something like this should really work:

    var api = jQuery('.vc_active .flowplayer').eq(0).data('flowplayer');
    if( api ) {
      api.load();
    }
    

    Thanks,
    Martin

    Martin 4 years ago

    Hello Apasho,

    or to keep it in the callback:

    flowplayer( function(api,root) {
      if( jQuery(root).closest('.vc_active').length ) {
        api.load();
      }
      ...
    });
    

    Thanks,
    Martin

Viewing 4 replies - 1 through 4 (of 4 total)
Reply To: How use the ‘finish’ event?



Please Sign in or Register to upload files.

Related Posts

  1. Video Finish JavaScript Event

    Video Finish JavaScript Event

  2. Custom script using load event

    Custom script using load event

  3. API for continue watching…

    API for continue watching…

Primary Sidebar

How to …

    Categories

    • Business
    • Camera Reviews
    • Case Studies
    • Design
    • FV Player
    • Internet Marketing
    • IT
    • Life
    • SEO
    • Slovak
    • Video of the Week
    • WordPress

    Footer

    Our Plugins

    • FV WordPress Flowplayer
    • FV Thoughtful Comments
    • FV Simpler SEO
    • FV Antispam
    • FV Gravatar Cache
    • FV Testimonials

    Free Tools

    • Pandoc Online
    • Article spinner
    • WordPress Password Finder
    • Delete LinkedIn Account
    • Responsive Design Calculator
    Foliovision logo
    All materials © 2026 Foliovision s.r.o. | Panská 12 - 81101 Bratislava - Slovakia | info@foliovision.com
    • This Site Uses Cookies
    • Privacy Policy
    • Terms of Service
    • Site Map
    • Contact
    • Tel. ‭+421 2/5292 0086‬