check if video is streaming

天涯浪子 提交于 2019-12-06 00:25:26

You'll want to use getState() which returns the player's current playback state:

jwplayer("livemedia").setup({

    // Setup parameters

}).onReady(function(){

    if(this.getState() == "playing"){
        // WOO HOO: (Don't cross the streams!)
    } else {
        //THE STREAM IS DOWN!
    }    
});

The available options are:

  • idle: either playback has not started or playback was stopped (due to a stop() call or an error). Either the play or the error icon is visible in the display.
  • buffering: user pressed play, but sufficient data to start playback has to be loaded first. The buffering icon is visible in the display.
  • playing: the video is currently playing. No icon is visible in the display.
  • paused: the video is currently paused. The play icon is visible in the display.

API reference:

Have a look at the jwplayer API Reference here:

https://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference#playback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!