Im using videojs and running a server with nginx and hls streaming. I was woundering how you can make a image appear when the stream is offline and then when the stream comes on the stream starts playing. Thank you for the help
When a HTML5 video player plays a stream it generally does this by requesting the server to send it the video file, usually actually with a request for each new chunk of the stream.
In your case it sounds like you want the player only to start requesting when the stream is ready, or at least for it to look like this to the user.
To achieve this you can either simply poll the server regularly, say every second, to see if the stream is ready, or you can use some form of notification from the server to the page.
On the face of it notification seems more efficient, but you will probably find whatever notification mechanism you use has to poll a server anyway.
To allow you display a picture when the stream ends, you can also catch this case in the player when there is no more stream available, and fall back to display an image then instead.
$myVid = $("#video_id");
$myVid.addEventListener('play', function(){
// do something
})
$myVid.addEventListener('pause', function(){
// do something
})