Search code examples
javascriptjqueryflowplayerbufferinghttp-live-streaming

Flowplayer event when buffering ends


I'm using flowplayer to play an MP4 video on a website from a NGinx server with H264 streaming plugin, and the pseudostreaming plugin for Flowplayer. Everything works fine.

I implemented several javascript functions for deep linking into the video, with the $f().Seek() method, which also works fine.

Here is my problem : when the user seeks to a particular place in the video, I need to disable some elements on the page, to prevent him or her from clicking more times, jamming all the sync. Then, I want to re-enable the same elements when the video starts playing again.

This code disables the elements and is placed in the click event of some buttons. Straightforward : $('.cur-left, .cur-right, .book-temps').hide('fast');

This code enables them : $('.cur-left, .cur-right, .book-temps').show('fast');

I can't find where to place my "re-enabling" code, as no event seems to happen when the video restarts playing after buffering after a seek.

Any advice on an unknown event matching or a trick to fit it some other way would be unvaluable.

Thanks for reading.


Solution

  • You need handle onBufferFull event:

    <!-- player container  -->
    <a href="http://pseudo01.hddn.com/vod/demo.flowplayervod/flowplayer-700.flv" id="player"
        style="display:block;width:425px;height:300px"> 
    
        <!-- .. with a splash image -->
        <img src="http://static.flowplayer.org/img/home/flow_eye.jpg" alt="Search engine friendly content" /> 
    </a>
    <div id="info">
    </div>
    

    and script:

    $(function(){
        var info = document.getElementById("info");
    
        flowplayer("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", {
    
            // this will enable pseudostreaming support 
            plugins: { 
                pseudo: { url: 'flowplayer.pseudostreaming-3.2.7.swf' } 
            },
    
            // listen to following clip events 
            clip: {        
                // make this clip use pseudostreaming plugin with "provider" property
                provider: 'pseudo',                
    
                // all videos under this baseUrl support pseudostreaming on the server side        
                url: 'http://pseudo01.hddn.com/vod/demo.flowplayervod/Extremists.flv'            
            },
    
            onBufferFull: function() {
               info.innerHTML += "buffer full<br/>";
            }                        
    
        });    
    });
    

    See example here