Stream pulling is the process of pulling live streams from third-party sources to the Alibaba Cloud live center for stream processing and accelerated delivery. You can configure stream pulling using two methods: Regular Stream Pulling and Triggered Stream Pulling. This topic describes how to configure stream pulling in ApsaraVideo Live.
Concepts
ApsaraVideo Live supports Regular Stream Pulling and Triggered Stream Pulling:
Regular stream pulling: The stream is pulled during a specified time period, regardless of user playback activity.
Triggered stream pulling: The stream is pulled only when a user starts playback. When a playback URL for the domain is requested, ApsaraVideo Live automatically starts pulling the stream. If no one is watching, the service does not pull the stream from the origin.
To pull third-party live streams that are encoded in the H.265 format, contact us.
Limits
Regular stream pulling
Supports pulling third-party streams from URLs in Real-Time Messaging Protocol (RTMP), Flash Video (FLV), HTTP Live Streaming (HLS), or Secure Reliable Transport (SRT) format. You can add up to 20 origin URLs.
You can configure up to 300 templates for regular stream pulling. To increase this limit, you must increase the quota for source streams. For more information, see Quota management. After the quota is increased, the maximum number of templates for regular stream pulling is equal to the quota for source streams.
The duration of a stream pulling task cannot exceed seven days.
A feature switch is not required for regular stream pulling that uses the SRT protocol. You must ensure that the origin server provides an SRT stream.
Triggered stream pulling
Supports back-to-origin stream pulling over RTMP, FLV, and HLS.
You can add up to 200 configurations for triggered stream pulling.
Stream pulling from IPv6 addresses is not supported.
Go to the stream pulling configuration page
- Log on to the ApsaraVideo Live console.
In the left-side navigation pane, click Domain Names. The Domain Management page appears.
Find the streaming domain that you want to configure and click Domain Settings.
In the navigation pane on the left, click . The Triggered Stream Pulling page appears by default.
Configure triggered stream pulling
On the Triggered Stream Pulling tab, click Add.
Configure triggered stream pulling.
NoteYou can add up to 200 configurations for triggered stream pulling.

The following table describes the parameters for triggered stream pulling.
Parameter
Description
AppName in Streaming URL
The name of the application for the stream. This AppName is used to generate the playback URL and does not need to match the AppName used for stream ingest at the origin. However, if you do not specify an AppName in Source URL, this AppName must match the AppName used for stream ingest at the origin.
To configure stream pulling at the domain level, set this parameter to ali_all_app.
AppName in Source URL
The AppName for back-to-origin stream pulling. This must match the AppName used for stream ingest at the origin.
If you do not specify a value, the AppName in Streaming URL is used as the Origin Fetch AppName. In this case, the Playback AppName must be the same as the AppName for stream ingest at the origin.
Source URL
The URL of the third-party live stream. You can add up to four URLs.
Protocol for Back-to-origin Stream Pulling
Supports RTMP, FLV, and HLS protocols. The SRT protocol is not supported.
Triggered for Transcoding
Enabled: When a user plays either the transcoded stream or the source stream, ApsaraVideo Live is automatically triggered to pull the stream from the origin.
Disabled: ApsaraVideo Live is triggered to pull the stream from the origin only when a user plays the source stream. Playing a transcoded stream does not trigger stream pulling.
Click OK.
To start playback, generate a playback URL using the StreamName from the origin ingest stream and the AppName from the streaming URL configuration. If you set the AppName in the streaming URL to ali_all_app and do not specify an AppName in the source URL, you must use the AppName from the origin ingest stream. If you set the AppName in the streaming URL to ali_all_app and also specify an AppName in the source URL, you can use a custom AppName. For more information, see Generate playback URLs.
Configure regular stream pulling
On the Regular Stream Pulling tab, click Add.
Configure regular stream pulling.
ImportantYou can add up to four origin URLs.
You can configure up to 300 templates for regular stream pulling. To increase this limit, you must increase the quota for source streams. For more information, see Quota management. After the quota is increased, the maximum number of templates for regular stream pulling is equal to the quota for source streams.
The duration of a stream pulling task cannot exceed seven days.

The following table describes the parameters for regular stream pulling.
Parameter
Description
Application Name
The name of the application. This AppName is used to generate the playback URL and does not need to match the AppName used for stream ingest at the origin.
StreamName
The name of the live stream. The stream name must be unique among all stream pulling templates.
Source URL
The URL of the third-party live stream.
URLs in RTMP, FLV, HLS, and SRT formats are supported. You can add up to four URLs.
Start and End Time
The start and end time for stream pulling. The task stops after the end time.
Click OK.
To start playback, generate a playback URL using the configured AppName and StreamName. For more information, see Generate playback URLs.
Modify a stream pulling configuration
This feature can be used to handle emergencies, such as when the origin server is unavailable.
On the Back-to-origin Stream Pulling page, click the Triggered Stream Pulling or Regular Stream Pulling tab to view the existing stream pulling configurations.
Find the template that you want to modify and click Modify in the Actions column.

In the Stream Pulling Settings window, modify the stream pulling configuration.
For more information about the parameters, see Configure regular stream pulling and Configure triggered stream pulling.
Click OK.
Regular stream pulling
After you modify the configuration, the stream is pulled based on the new settings. Ensure that this change does not affect your online services.
Triggered stream pulling
After you modify the configuration, existing playback sessions continue to use the previous configuration, while new playback sessions use the new configuration.
If you specified an AppName in the source URL when you added the configuration, you cannot leave this parameter empty when you modify the configuration.
Callback logic
Callback logic for the publish status in ingest and disconnection callbacks
For RTMP stream ingest, if the ingest client does not disconnect within 2 seconds after the ApsaraVideo Live service receives an On Publish message, ApsaraVideo Live sends a callback to indicate a successful ingest.
If you have an ingest domain A and a streaming domain B, and you want to receive callbacks for stream pulling on domain B (scheduled or triggered back-to-origin pulling), you must configure an Ingest Callback for domain A. After the configuration, the callback logic for stream pulling on domain B is the same as described in the preceding item. A successful connection is assumed if the stream is not actively disconnected within 2 seconds after the connection is established.
In addition to using callback notifications to determine whether stream ingest and stream pulling are successful, we recommend that you also use the Query the list of active streams for a domain API to verify that stream ingest is successful before you distribute the live stream playback URL.
If no streaming data is pushed to the live center for 10 seconds, the ApsaraVideo Live service automatically disconnects the stream ingest.