logo
On this page

On the Web platform, how to handle connection disconnection during the process of relaying streams to CDN?

2022-11-15
Products / Plugins:Video Call / Audio Call / Live streaming
Platform / Framework:Web

Relaying to CDN refers to the process of pushing audio and video streams from ZEGOCLOUD real-time audio and video cloud to third-party or self-developed CDN. Based on this feature, developers can perform larger-scale content distribution, and users can directly watch from web pages or third-party players through URL play stream addresses.

When streaming, the SDK will connect to a ZEGOCLOUD server dedicated to streaming services. When the connection between the SDK and the streaming server is disconnected, it will attempt to automatically reconnect. If reconnection fails, the SDK will trigger the streaming status callback publisherStateUpdate, giving the "NO_PUBLISH" status.

on('publisherStateUpdate',(result: ZegoPublisherState)=>{
    if(result.state === 'NO_PUBLISH'){
       // todo  something
    }
})

When listening to the corresponding status of the above event, developers can first call stopPublishingStream to stop all streaming, and then call startPublishingStream in sequence to restart streaming.

For detailed feature introduction and implementation process of relaying streams to CDN, refer to Relay to CDN.

Previous

How often does ZIM send heartbeats by default? After how long without receiving a user heartbeat will the backend determine it as timeout?

Next

How to reduce the information printed by Express SDK in the Web console?