Videojs live offline plugin

In the video example, the initial HLS playlist does not exist. An offline image with a retry interval countdown is displayed. After the first or second retry attempt (10-second interval), live video is back online.

Live video offline plugin details

The offline plugin is initialized on initial stream playlist errors (e.g., 404 error), when the network is disconnected while playing, when the internet connection goes down, or when the stream is broken. The plugin attempts to reconnect the stream automatically at user-defined intervals (default: every 30 seconds). The offline plugin includes three 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
The 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>

<script>
var player = videojs('myplayer');
player.nuevo();
player.offline({offlineImage: "//domain.com/path-to-video-image.jpg"});
</script>
You have an option to set a custom offline retry interval value (the default is 30 seconds) and an option to hide the countdown. One more option is to change a countdown text string (the default is "Restart").
Code snippet
<script>
player.offline({
offlineImage:"//domain.com/path-to-video-image.jpg",
offlineTimeout:20,
offlineCountdown:false,
label:"Neustart"
});
</script>
The videojs VHS library is missing playlist parse error validation. In other words, if a playlist file is loaded but this is an empty file or playlist content is not valid, the player will not throw any error and the offline plugin will not 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.

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.