If you configure callbacks for the real-time stream status, you can receive callback notifications about successful or interrupted stream pushing.
ApsaraVideo Live sends an HTTP GET request to your server to notify you of the successful stream pushing or stream interruption in real time. The server then responds with the HTTP status code 200, which indicates that the callback is successful.
A callback URL requires no identifier but must be accessible. The URL response complies with the following requirements:
If no response is returned from the URL in a specific period, ApsaraVideo Live retries to access the URL. If no response is returned in 5 seconds, ApsaraVideo Live retries to access the URL for a maximum of five times at intervals of 1 second.
Callback logic for live stream pushing status
Note We recommend that you deliver the streaming URL only after you determine that stream pushing or pulling is successful based on callback notifications and the list of online streams.
- During stream pushing over Real-Time Messaging Protocol (RTMP), ApsaraVideo Live checks whether the stream pushing client closes the connection within 2 seconds after ApsaraVideo Live receives an OnPublish message. If the stream pushing client does not close the connection, ApsaraVideo Live sends a callback notification about successful stream pushing. You may require ApsaraVideo Live to send this callback notification only when ApsaraVideo Live receives live streaming data after the connection is established. In this case, submit a ticket.
- Assume that you have stream pushing domain A and streaming domain B, and you use the stream pulling feature for live streaming under streaming domain B. You can configure ApsaraVideo Live to pull a stream at the specified time, or enable ApsaraVideo Live to automatically pull a stream when the origin server starts live streaming. If you want to receive a callback notification about the stream pulling status, configure stream pushing callbacks for stream pushing domain A. After the configuration, ApsaraVideo Live uses the same callback logic as that for live stream pushing status to send callback notifications about the stream pulling status under streaming domain B. By default, ApsaraVideo Live sends a callback notification about successful stream pulling if the stream pulling client does not close the connection within 2 seconds after the connection is established. If you require ApsaraVideo Live to send this callback notification only when live streaming data is received, submit a ticket.
The following table describes the parameters in the URL
|time||String||The UNIX timestamp. Unit: seconds.|
|usrargs||String||The custom parameters used to push the stream.|
|action||String||The operation that you want to perform. A value of publish indicates stream pushing. A value of publish_done indicates stream interruption.|
|app||String||The domain name. The default value is a custom stream pushing domain. If no stream pushing domain is bound, a streaming domain is used.|
|appname||String||The name of the application.|
|id||String||The name of the live stream.|
|node||String||The name of the Alibaba Cloud CDN node or the host that receives the stream.|
|ip||String||The IP address of the client that pushes the stream.|