Videojs live offline plugin

In the video example above, initial HLS playlist throws 404 (not existing) error. Offline image with retry interval countdown is displayed. After first or second retry attempt (20 second interval), live video is back online.

Live video offline plugin details

Latest offline plugin version is a completely new attempt to care about the player display when the live stream goes offline.
Offline plugin is initialized on initial stream playlist errors (e.g. 404 error). It also starts when the network is diconnected while playing, when the internet connection goes down, when the stream is broken completely. The plugin attempts to reconnect the stream automatically in user-defined intervals (default each 30 seconds).
The offline plugin includes 3 easy to understand options.
  • offlineImage - URL of the offline Image
  • offlineTimeout (default 30) - timeout value (seconds) for offlineImage to retry live stream
  • offlineCountdown (default true) - set false to disable visible countdown
Important: You need to set preload="none" video attribute to have the offline plugin working correctly.
Minimum setup is:
Code snippet
<script src="//domain.com/videojs/videojs.min.js"></script>
<script src="//domain.com/videojs/nuevo.min.js"></script>
<script src="//domain.com/videojs/plugins/videojs.offline.js"></script>

var player = videojs('myplayer'); 
player.nuevo();
player.offline({offlineImage: "//domain.com/path-to-video-image.jpg"});
</script>
As it was mentioned you have an option to set offline retry interval value and an option to hide countdown. One more option is to change a countdown text string, which by default is "Restart".
Code snippet
player.offline({
   offlineImage:"//domain.com/path-to-video-image.jpg",
   offlineTimeout:20,
   offlineCountdown:false,
   label:"Neustart"
});
</script>
Videojs VHS library used to stream HLS and DASH video is missing playlist parse errors validation. In other words, if playlist file is loaded, but this is an empty file, or playlist content is not valid m3u8 or dash playlist, the player will not throw any error and offline plugin cannot work. We already reported this important missing VHS functionality to video.js devs. This issue doesn't concern alternative Hlsjs plugin and hls.js library. Hls.js does validate playlist for parse errors and throws an error to videojs, so the Offline plugin will work.

For the moment we added new functionality to the latest version of the Offline plugin, in case when using VHS and a playlist is not in a valid format. The user can define a timeout value for the media load event. If media not loaded, offline plugin is activated.
The default value for loadTimeout option is 0 and this means that timeout function will not be used. Set any other value in milliseconds to use load timeout function.
Code snippet
player.offline({
   offlineImage:"//domain.com/path-to-video-image.jpg",
   offlineTimeout:20,
   offlineCountdown:false,
   loadTimeout: 5000
});
</script>
The offline plugin is free to use by Nuevo software Gold and Premium plan license holders. Other video.js users can purchase the plugin separately here.