Set up two MediaConnect flows to relay a live stream from one Alibaba Cloud region to another over the Alibaba Cloud backbone network.
How it works
Cross-region distribution requires two flows: one in the region closest to the source (Flow A) and one in the region closest to the receivers (Flow B). The stream ingest client pushes content to Flow A, which forwards it to Flow B through the Alibaba Cloud network. Receivers then pull the stream from Flow B for playback.
The following diagram uses Singapore-to-Germany as an example.
To distribute a single source stream to multiple regions, create additional destination flows and connect each one to Flow A using the same approach.
Prerequisites
Before you begin, make sure that you have:
Access to the Intelligent Media Services (IMS) console
An understanding of how to create flows, add sources, and add outputs in MediaConnect. For details, see Add a source to a flow and Add an output to a flow
Relay an RTMP stream from Singapore to Germany (Frankfurt)
This example walks through relaying an RTMP stream in four steps:
Create Flow A in the source region with a source and an output.
Create Flow B in the destination region and link it to Flow A.
Start both flows.
Push the stream to Flow A and pull it from Flow B.
Step 1: Create Flow A (source region)
Log on to the IMS console. In the left-side navigation pane, choose MediaConnect > Flows. Click Create Flow.
Example configuration: Click OK. On the flow details page, note the Flow ID. You need it when configuring Flow B. 
Flow Name: FlowA
Region: Singapore
Add a source. On the flow details page, click Add Source Stream.
In the Add Source panel, configure the following parameters:Parameter Example value Description Source Name FlowAInput A descriptive name for the source Protocol RTMP-PUSH The ingest client pushes the stream to this flow Max Bitrate 1000000 bps Maximum allowed bitrate IP Address Whitelist (Optional) IP addresses allowed to send content. If left blank, no access control is enforced Add an output. Click the Outputs tab, then click Add Output.
Example configuration: Click OK. Note the output name (FlowAOutput). You need it when configuring Flow B.Output Name: FlowAOutput
Protocol: RTMP-PULL
Step 2: Create Flow B (destination region)
In the IMS console, click Create Flow.
Example configuration: Click OK.Flow Name: FlowB
Region: Germany (Frankfurt)
Add a source and link it to Flow A. On the flow details page, click Add Source Stream.
In the Add Source panel, configure the following parameters:Parameter Example value Description Source Name FlowBInput A descriptive name for the source Protocol Flow The inter-flow protocol that connects Flow B to Flow A Flow ID (Flow A's ID) The Flow ID noted in Step 1 Output Name FlowAOutput The output name noted in Step 1 NoteIf adding the source fails, verify that the Flow ID and Output Name match the values from Flow A.
Add an output. Click the Outputs tab, then click Add Output.
Example configuration:Parameter Example value Description Output Name FlowBOutput A descriptive name for the output Protocol RTMP-PULL Receivers pull the stream from this output IP Address Whitelist (Optional) IP addresses allowed to pull content. If left blank, no access control is enforced
Step 3: Start both flows
On the flow details page of each flow, click Start on the Status panel. Both Flow A and Flow B must be running before the stream can be relayed.

For details about flow states, see Flow status.
Step 4: Ingest and play the stream
Push the stream to Flow A
After configuring the source for Flow A, the system generates a Source URL. Push the stream to this URL from the ingest client.

Pull the stream from Flow B
After configuring the output for Flow B, the system generates an output URL. Receivers pull the stream from this URL for playback.

Supported protocol combinations
MediaConnect supports RTMP and SRT protocols. The protocols of the source and destination flows must be compatible. The output protocol options available in the console depend on the source protocol: SRT output options are only available when the source also uses SRT.
Flow A input: This example uses RTMP-PUSH. Alternatively, use RTMP-PULL to have Flow A pull the stream from a specified source URL. For details, see Add a source to a flow.
Flow B output: This example uses RTMP-PULL. Alternatively, use RTMP-PUSH to have Flow B push the stream to a specified output URL. For details, see Add an output to a flow.
Flow A output: When the Flow B input protocol is set to Flow, the Flow A output protocol must be RTMP-PULL.
The following table lists all supported protocol combinations for cross-region transmission.
| Flow A input | Flow A output | Flow B input | Flow B output |
|---|---|---|---|
| RTMP-PUSH / RTMP-PULL | RTMP-PULL | Flow | RTMP-PUSH / RTMP-PULL |
| RTMP-PUSH / RTMP-PULL | Flow | RTMP-PUSH | RTMP-PUSH / RTMP-PULL |
| SRT-Listener / SRT-Caller | SRT-Listener | Flow | SRT-Listener / SRT-Caller |
| SRT-Listener / SRT-Caller | Flow | SRT-Listener | SRT-Listener / SRT-Caller |