This topic describes how to ingest, pull, and play streams.

Terms

ApsaraVideo Live provides basic features of collecting and distributing live streams. You can use a stream ingest tool to ingest streams to live centers of ApsaraVideo Live by using the specified stream ingest URLs. ApsaraVideo Live processes and distributes the ingested streams. Then, the viewers can play the streams in media players by using the specified streaming URLs. You can specify the types of videos to be ingested to live centers in different scenarios based on your business requirements.

  • Stream ingest
  • Stream pulling
  • Streaming

Process of live streaming

To use the basic features of ApsaraVideo Live, you can use a stream ingest tool to ingest streams to live centers of ApsaraVideo Live for content distribution by using the specified stream ingest URLs. Then, the viewers can play the streams in media players by using the specified streaming URLs.

The live streaming service of ApsaraVideo Live involves the following steps:

  1. Prepare tools and the network environment
  2. Pull a stream (Optional)
  3. Obtain an ingest URL and a streaming URL
  4. Ingest the stream
  5. Play and watch the stream

Prepare tools and the network environment

Download a suitable tool based on your business requirements.

Stream ingest tool Download link

Stream ingest on PCs

In the example in Step 2, the demo of RTS SDK for OBS on PCs is used.

Stream ingest on mobile devices

In the example in Step 2, the ApsaraVideo Live demo application is used.

Scan the following QR code to install the ApsaraVideo Live demo application. QR code for downloading the demo of ApsaraVideo Live
Media player Download link

Streaming on PCs

In the example in Step 2, the third-party player VLC is used.

To download VLC, visit VLC media player.

Streaming on mobile devices

In the example in Step 2, the ApsaraVideo Live demo application is used.

Scan the preceding QR code to install the demo of ApsaraVideo Live. If the ApsaraVideo Live demo application is installed, skip this step.
The following table compares two types of networks.
Network type Benefit Drawback
Wired network Stable Not convenient enough
Wi-Fi Convenient Not stable enough
  • A wired network is more stable than a Wi-Fi network, and the network signal is not often interrupted. We recommend that you use a wired network if possible.
  • A Wi-Fi network is more convenient than a wired network. We recommend that you use a Wi-Fi network for streaming of live events.

Upstream bandwidth detection

Live streaming has high requirements for network conditions. A stable network is required to ensure smooth stream playback. The upstream bandwidth determines the quality and resolution of videos that are streamed. Videos with higher quality and higher resolutions require larger upstream bandwidth. We recommend that you use the network speed test tool Speedtest to measure the speed of your upstream Internet connection.
Note We recommend that you keep your upstream bandwidth equal to or larger than 1 Mbit/s.

Pull a stream

If you use a third-party stream for live streaming, you can use the stream pulling feature of ApsaraVideo Live to pull the stream to a live center of ApsaraVideo Live for distribution. You need only to configure stream pulling. You can configure regular stream pulling or triggered stream pulling.
  • Regular stream pulling: specifies the start time and end time to pull live streams.
  • Triggered stream pulling: automatically triggers ApsaraVideo Live to pull live streams from the origin when the origin starts streaming.

To specify the source URL for stream pulling from the origin, perform the following steps in the ApsaraVideo Live console: Click Domain Management in the left-side navigation pane. On the Domain Management page, click Domain Settings in the Actions column of a domain name. On the page that appears, click Stream Pulling Settings on the left side. Then, click Add and set the parameters for stream pulling. For more information, see Configure stream pulling.

Note
  • The IP address of the Alibaba Cloud server that is used for stream pulling is dynamically assigned. If an IP address whitelist is configured for the origin, ApsaraVideo Live may fail to pull streams from the source URL.
  • IPv6 addresses are not supported by regular stream pulling or triggered stream pulling.

Obtain an ingest URL and a streaming URL

You can use the URL generator in the ApsaraVideo Live console or use the concatenating rules to construct an ingest URL and a streaming URL. For more information, see Construct an ingest URL and a streaming URL.

Ingest the stream

Follow the operation guide in the following table to ingest streams based on the stream ingest tool that you use.

Device Operation guide

PC

In this example, the demo of RTS SDK for OBS on PCs is used.

  1. Run the demo of RTS SDK for OBS.
    Note If you open the demo of RTS SDK for OBS on a macOS device for the first time, you may receive the following error message:

    macOS cannot verify that this app is free from malware.

    You can open this application by modifying the security and privacy settings on the macOS device.

  2. Click Settings.
  3. On the Settings page, click Stream to go to the streaming page. Then, set the Server parameter. The Stream Key parameter can be left empty.

    Enter the generated ingest URL that contains the authentication information in the Server field. Example: rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.

    obs
    Note
    • In this example, the ingest URL consists of an ingest domain, an application name, a stream name, and an access token. You can replace the sample values with the actual ones of your ingest URL.
    • Enter a complete ingest URL in the Server field and leave the Stream Key parameter empty.
    • For more information about how to configure and use the demo of RTS SDK for OBS, see OBS.
  4. In the Sources section, add a video source and click Start Streaming.

Mobile device

In this example, the ApsaraVideo Live demo application is used.

  1. Open the ApsaraVideo Live demo application on the mobile device and tap Camera Pushing or Screen Sharing to go to the page for stream ingest.
    Notice
    • Only YUV files are allowed for ingesting streams from mobile devices.
    • Camera Pushing uses the camera of the mobile device to ingest streams. Screen Sharing records the screen of the mobile device to ingest streams.
  2. In the upper part of the page that appears, enter the generated ingest URL that contains the authentication information. Example: rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.
  3. Configure the stream ingest settings, such as resolution, and click Start in the lower part to start stream ingest.
Note ApsaraVideo Live does not support multiple streams ingested to a URL at the same time. If you ingest multiple streams, the second stream is rejected.

After a stream is ingested, you can log on to the ApsaraVideo Live console and check whether the ingest endpoint for the stream exists in the list displayed on the Ingest Endpoint Management page. If yes, the stream ingest is successful.

Play and watch the stream

Follow the operation guide in the following table to play streams based on the media player that you use.

Device Operation guide

PC

In this example, the third-party player VLC is used.

  1. Open the VLC player and choose Media > Open Network Stream.
  2. In the Please enter a network URL field, enter the streaming URL. Example: rtmp://example.aliyundoc.com/app/stream?auth_key=1543300311-0-0-d47ce016332bf280cf275********. Then, click Play.
Note In this example, the streaming URL consists of a streaming domain, an application name, a stream name, and an access token. You can replace the sample values with the actual ones of your streaming URL.

For information about cross-domain errors for playing streams, see What can I do if a message indicating a cross-origin error appears when the player plays streams based on M3U8 playlists?

Mobile device

In this example, the ApsaraVideo Live demo application is used.

  1. Open the ApsaraVideo Live demo application on the mobile device and tap Live Streaming to go to the page for stream pulling.
  2. In the upper part of the page that appears, enter the generated streaming URL. Example: rtmp://example.aliyundoc.com/app/stream?auth_key=1543300311-0-0-d47ce016332bf280cf275********.
  3. Click Pull Stream.

Web

In this example, ApsaraVideo Player SDK for web is used.

  1. Configure cross-origin resource sharing (CORS) for the streaming domain that you added. The configuration item is the Access-Control-Allow-Origin HTTP header. For more information, see Configure HTTP headers.
    Note In the ApsaraVideo Live console, find the streaming domain that you added and go to the configuration page. You can enter * as the value of the Access-Control-Allow-Origin header to specify all the domain names. You can also enter the domain name of ApsaraVideo Player SDK for web. Example: http://example.aliyundoc.com.
  2. Click Aliplayer Web Player to go to the configuration page. Click the Basic tab and select Broadcast for the Video Type parameter. Then, enter or copy the generated streaming URL to the URL field.
  3. Click the Preview tab to preview the stream.
Notice
  • Flash players are not supported by mainstream browsers. Therefore, you cannot preview streams whose streaming URLs adopt RTMP in ApsaraVideo Player SDK for web.