I am using JWPlayer on my WordPress website and I would like to have it so the player is "hidden" form the page if it's offline, but automatically shows when the stream goes online.
How can I do this? I want to have dozens of streams, even hundreds, put only "live" ones show up in a page....
Does your streaming provider have a way to detect if the stream is live or not using Javascript? If yes, I would do this check and only call jwplayer().setup() when they respond with the correct status.
Another potential option would be to start the player with the height and width set to 0 (so the viewer does not see it) and if the player fires the ‘firstFrame’ event, resize the player to the desired size. You could also listen for any ‘setupError’ or ‘error’ events, which would indicate that the stream is not live and then call remove() on that player.
Read more about our Javascript API and event handlers at https://developer.jwplayer.com/jw-player/docs/developer-guide/api/javascript_api_reference/
And do you have access to an HLS stream? RTMP requires Flash and therefore will not work on mobile devices. We’re also starting to see more aggressive Flash blocking on desktop browsers, so switching to HLS means your streams will be viewable on more devices.
This question has received the maximum number of answers.