After you set a callback URL for receiving stream pushing information for a stream pushing domain, ApsaraVideo Live sends messages to notify you of the stream pushing status of the domain, such as successful or interrupted stream pushing. ApsaraVideo Live supports authenticating the callback URL to avoid unauthorized access to the stream. This topic describes how to set a callback URL for receiving stream pushing information for a stream pushing domain and how to enable authentication for the callback URL.
If you want to receive notification on stream pushing, follow this procedure to configure a callback URL and the callback authentication:
- Log on to the ApsaraVideo Live console.
- In the left-side navigation pane, click Domains to go to the Domain Management page.
- Find the stream pushing domain that you want to configure and click Domain Settings.
- Choose Stream Ingest Information tab. and click the
- Click the Edit icon next to Callback URL to open the Configure Callback URL window.
- Complete the callback URL configuration in the Configure Callback URL window.
- Enter the callback URL.
- Enable authentication for the callback URL if needed.
If you would like to enable authentication for the callback URL, turn the Authentication tab on, fill in the Cryptographic Key field, then click OK to complete the configuration.Note Observe the rules on the GUI for the Cryptographic Key.
Otherwise, click OK directly to complete the configuration.
- During stream ingest over Real-Time Messaging Protocol (RTMP), ApsaraVideo Live checks whether the stream ingest client closes the connection within 2 seconds after ApsaraVideo Live receives an OnPublish message. If the stream ingest client does not close the connection, ApsaraVideo Live sends a callback notification about the successful stream ingest. 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.
- For example, you have Ingest 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 point in 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 ingest callbacks for Ingest Domain A. After the configuration, ApsaraVideo Live uses the same callback logic as that for stream ingest 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.
Callback authentication logic
- ApsaraVideo Live includes the
ALI-LIVE-SIGNATUREfields in the HTTP(S) request header when sending callback information to the callback URL. The value of
ALI-LIVE-SIGNATUREis calculated using the following formula:
MD5CONTENT=Stream pushing domain name|Value of ALI-LIVE-TIMESTAMP|Cryptographic keyNote The Stream pushing domain name refers to the domain to which the callback URL is configured. The Cryptographic key refers to the authentication key for the callback URL.
- The server that hosts the callback URL generates an MD5 hash from a concatenated string
of the stream pushing domain name, the value of
ALI-LIVE-TIMESTAMP, and the cryptographic key. It then compares the MD5 hash with the value of
ALI-LIVE-SIGNATUREin the HTTP(S) request header. If the MD5 hash is not consistent with the value of
ALI-LIVE-SIGNATURE, the request is considered invalid.