addInjectStreamUrl method
Injects an online media stream to a live broadcast.
If this method call is successful, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all audience members in the channel can watch a live show and interact with each other.
Note
- This method applies to the LiveBroadcasting profile only.
- Ensure that you enable the RTMP Converter service before using this function. See Prerequisites in Push Streams to CDN.
- You can inject only one media stream into the channel at the same time.
This method call triggers the following callbacks:
- The local client:
- RtcEngineEventHandler.streamInjectedStatus, with the state of the injecting the online stream.
- RtcEngineEventHandler.userJoined(uid: 666), if the method call is successful and the online media stream is injected into the channel.
- The remote client:
- RtcEngineEventHandler.userJoined(uid: 666), if the method call is successful and the online media stream is injected into the channel.
Parameter url
The URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and HTTP-FLV.
- Supported audio codec type: AAC.
- Supported video codec type: H264(AVC).
Parameter config
The LiveInjectStreamConfig object which contains the configuration information for the added voice or video stream.
Implementation
@override
Future<void> addInjectStreamUrl(String url, LiveInjectStreamConfig config) {
return _invokeMethod(
'addInjectStreamUrl', {'url': url, 'config': config.toJson()});
}