All Products
Search
Document Center

ApsaraVideo VOD:How do I handle errors in live streaming

Last Updated:Jun 05, 2025

This topic describes possible issues that may occur when you use ApsaraVideo Player for live streaming and provides solutions.

onM3u8Retry event

  • Description

    If an error occurs during live streaming, ApsaraVideo Player tries to restore data for five times and triggers the onM3u8Retry event. You can subscribe to the onM3u8Retry event to display a custom on-screen message, such as "Be right back."

  • Code implementation

player.on('onM3u8Retry',function(){
   console.log('Be right back.')
 });

liveStreamStop event

  • Description

    If the player fails to restore data, the liveStreamStop event is triggered. You can subscribe to the liveStreamStop event to switch to another stream for playback, or display a custom on-screen message, such as "Live stream ended."

  • Code implementation

    • Switch to another available stream

      player.on('liveStreamStop',function(){
         var newUrl = "New streaming URL";
         player.loadByUrl(newUrl);
       });
    • Create a custom on-screen message to announce the end of the live stream

      player.on('liveStreamStop',function(){
         console.log('Live stream ended.');
       });