VAS_Re-stream

最終更新日:2023-07-13 14:59:42

1 VAS Intro

1.1 Brief Introduction

For interactive live streaming, streams are pushed by streamers to the origin or CDN platform for acceleration, from which the end users will pull streams for playback. As live stream develops and scales, live streams need to be distributed simultaneously to multiple CDN platforms involved in streaming acceleration, meaning a stream may be restreamed from one CDN platform to another CDN platform or origin.

1.2 Applicable Product Line

• Media Acceleration Live Broadcast

1.3 Application Scenarios

  1. Streamers push streams to CDNetworks, and CDNetworks restreams received streams to a 3rd party CDN.
  2. Streamers push streams to CDNetworks, and CDNetworks restreams received streams to a customer origin.
  3. Streamers push streams to an origin or a 3rd party CDN, which will then restream received streams to CDNetworks for stream delivery.

2 Feature Details

MALB Re-Stream allows CDNetworks to forward streams pushed by streamers to 3rd party CDNs or origins as backup while distributing the streams to end users.

  1. Supports re-stream to multiple destinations simultaneously, for example, streaming the same content to both CDN vendor A and origin B.
  2. Supports re-stream scheduling, where the target server information is obtained through DNS resolution or scheduling API before restreamimg.
  3. Supports passing parameters carried in the streaming URL during restreaming.

2.1 CDNetworks restreams to 3rd party CDN or origin

The following info should be provided to CDNetworks for setup.

  1. The domain name, application name, and stream name of the streaming content that needs to be restreamed.
  2. The re-stream domain provided by the 3rd party CDN or origin.
  3. If a re-stream scheduling API is used, the 3rd party CDN vendor or our customer should provide us with the API info, and the response data should follow the pattern defined by CDNetworks.
    API Request Info:
    a. API URL: This can be defined by the 3rd party CDN vendor or our customer.
    b. Request Method: GET
    c. Request Headers:
    Forward_Stream: URL of the stream that needs to be restreamed to the 3rd party CDN vendor or customer origin. Mandatory field.
    Ret_Num: Number of IP addresses returned to CDNetworks by the API, optional.
    API Returned Info Pattern:
    a. Response status code: 200
    b. Response format: json
    c. Response content:
    {“message”:“SUCCESS”,“content”:{“list”:[{“port”:“1935”,“ip”:“1.1.1.1”},{“port”:“1935”,“ip”:" 1.1.1.2 "}]},“state”:0}
    Notes: The returned data must follow the json pattern mentioned above, the parameter format of message and state is fixed. The content in the list is subject to the actual returned IP addresses.

2.2 3rd party CDN or customer origin restreams to CDNetworks

CDNetworks can not only restream live streams to, but also receives live streams restreamed by 3rd party CDNs or customer origins. The 3rd party CDN or our customers can also obtain the info of CDN servers that the stream will be streamed to via DNS resolution or calling the CDNetworks re-stream scheduling API.
CDNetworks re-stream scheduling API intro:

  1. The 3rd party CDN or customer origin sends a GET request to CDNetworks carrying the following required header info.
    a. API URL: http://turnpush.wscdns.com/query
    b. Request Method: GET
    c. Request Headers:
    Forward_Stream: URL of the original stream that needs to be restreamed to CDNetworks. Mandatory field. The name of the header is fixed.
    Ret_Num: Number of IP addresses returned by the scheduling API, optional. The value is recommended to be less than 3, and the header name is fixed.
    Sample request:
    curl “http://turnpush.wscdns.com/query” -H “Forward_Stream: rtmp:// www.push.com/live/channel” -H “Ret_Num: 2”
  2. Based on the stream info and requesting PoP IP addresses, CDNetworks returns the optimal PoP IP addresses to the 3rd party CDN or customer origin.
    a. Response Code: 200
    b. Response format: json
    c. Response content:
    {“message”:“SUCCESS”,“content”:{“list”:[{“port”:“1935”,“ip”:“1.1.1.1”},{“port”:“1935”,“ip”:" 1.1.1.2 "}]},“state”:0}
    Notes: The returned data must follow the json pattern mentioned above, the parameter format of message and state is fixed. The content in the list is subject to the actual returned IP addresses.
  3. 3rd party CDN or origin generates a live stream URL according to the IP addresses returned by the re-stream scheduling API and the original stream info, and then pushes the stream to CDNetworks.
    Two kinds of live stream URL formats are supported by CDNetworks:
    a. By domain
    Sample URL: rtmp://www.cdnetworkstest.com/live/channel
    b. By IP address
    Sample URL: rtmp://1.1.1.1:1935/live/channel?wsiphost=ipdbm&wsHost=www.cdnetworkstest.com

3 Notices

  • Restreaming via API calling is recommended to reduce errors induced by DNS resolution failure.
  • When restreaming to a 3rd party CDN, CDNetworks supports passing the query string parameter to the 3rd party CDN for validation if its domain has been enabled with the feature of token-based access control or anti-hotlinking.
  • By default, the API calling limit is 1000 times per second.