This topic describes the stream pushing, stream pulling, and streaming features and shows you how to implement these features.

Definition

ApsaraVideo Live provides basic features of collecting and distributing live streams. You can use a stream pushing tool to push streams to live centers of ApsaraVideo Live based on the specified pushing URLs. ApsaraVideo Live processes and distributes the pushed streams. Then, the audience can use media players to watch the streams based on the specified streaming URLs. You can specify the types of videos to be pushed to live centers in different scenarios based on your business requirements.

  • Stream pushing

    Stream ingest refers to the process of delivering the collected audio and video live streams to the live center of ApsaraVideo Live.

  • Stream pulling

    Stream pulling refers to the process of uploading third-party streaming URLs to the live center of ApsaraVideo Live for content delivery network (CDN) acceleration.

  • Streaming

    Streaming refers to the process of delivering live streams from the live center of ApsaraVideo Live to players for playback.

Process of live streaming

To use the basic features of ApsaraVideo Live, you can use a stream pushing tool to push streams to live centers of ApsaraVideo Live for content distribution based on the specified pushing URLs. Then, the audience can use media players to watch the streams based on 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 a pushing URL and a streaming URL
  4. Push 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

The demo of RTS SDK for OBS on PCs is used as an example.

Stream ingest on mobile devices

Alibaba Cloud Live is used as an example.

Scan the following QR code to install the demo application Alibaba Cloud Live. Installation package of the demo
Media player Download link

Streaming on PCs

The third-party player VLC is used as an example.

To download VLC player, visit VLC media player.

Streaming on mobile devices

Alibaba Cloud Live is used as an example.

Scan the preceding QR code to install the demo application Alibaba Cloud Live.If Alibaba Cloud Live is installed, skip this step.

Network environment

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 and the network signal is not often interrupted. We recommend that you use a wired network if the condition permits.
  • A Wi-Fi is more convenient than a wired network. We recommend that you use a Wi-Fi for a live streaming activity.

Upstream bandwidth detection

A live streaming activity has high requirements for network conditions. A stable network is required to ensure smooth stream playback. The upstream bandwidth is determined by the quality and resolution of videos in a live streaming activity. Videos with higher quality and higher resolutions require larger upstream bandwidth. We recommend that you use Speedtest, a network speed test tool, 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 to play the live streams.

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 for stream pulling.

Obtain a pushing 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, see Ingest and streaming URLs.

Push 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

The demo of RTS SDK for OBS on PCs is used as an example.

  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 whether this application contains malware.

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

  2. Click Settings.
  3. On the Settings page, click Stream to go to the streaming page. Then, configure Server. Enter the generated authenticated ingest URL in the Server field. For example, enter the following ingest URL: 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. Replace them with the actual values of your ingest URL.
    • Enter the full name of the ingest URL to the Server field and keep the Stream key field blank.
    • 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

Alibaba Cloud Live is used as an example.

  1. Open Alibaba Cloud Live on the mobile device and select Stream Ingest by Camera or Stream Ingest by Screen Recording to go to the Start Stream Ingest page.
    Note
    • Only the yuv formatted files are allowed for ingesting streams from mobile devices.
    • Stream Ingest by Camera uses the camera of the mobile phone to ingest streams. Stream Ingest by Screen Recording records the screen of the mobile phone to ingest streams.
  2. At the top of the Start Stream Ingest page, enter the generated ingest URL that contains the authentication information, such as rtmp://example.aliyundoc.com/liveApp****/liveStream****?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.
  3. Configure the stream ingest settings, such as resolution, and click Start Stream Ingest at the bottom.

After a stream is ingested, you can go to the ApsaraVideo Live console and click Stream Management to view the list of active ingest endpoints. If the video information is displayed in the list, the stream is ingested.

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

The third-party player VLC is used as an example.

  1. Open the VLC player and choose Media > Open Network Streaming.
  2. In the Enter Network URL dialog box, enter the streaming URL, such as rtmp://demo.aliyundoc.com/liveApp****/liveStream****?auth_key=1543300311-0-0-d47ce016332bf280cf275********), and click Play.
Note In this example, the streaming URL consists of a streaming domain, an application name, a stream name, and an access token. Replace them with the actual values of your streaming URL.

For information about cross-origin errors during streaming, 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

Alibaba Cloud Live is used as an example.

  1. Open Alibaba Cloud Live on the mobile device and tap Play by Live to go to the Pull Stream page.
  2. On the Pull Stream page, enter the generated streaming URL. For example, the streaming URL is rtmp://demo.aliyundoc.com/liveApp****/liveStream****?auth_key=1543300311-0-0-d47ce016332bf280cf275********.
  3. Click Pull Stream.

Web

The ApsaraVideo Player SDK for web is used as an example.

  1. Configure cross-origin resource sharing (CORS) for the streaming domain that you created. The configuration item is the Access-Control-Allow-Origin in the HTTP header. For more information, see Configure HTTP headers.
    Note Select the streaming domain that you created to go to the configuration page. You can enter * in the Access-Control-Allow-Origin field to specify all domain names. You can also enter the domain name of ApsaraVideo Player SDK for web. For example, http://demo.aliyundoc.com.
  2. Click Basic, and select Broadcast for Video Type, Enter or copy the generated streaming URL to the ApsaraVideo Player SDK for web.
  3. Click Preview.
Notice
  • Flash player is not supported by mainstream browsers, so you cannot preview streams whose streaming URLs adopt RTMP in ApsaraVideo Player SDK for web.