addInjectStreamUrl method

  1. @override
Future<void> addInjectStreamUrl(
  1. String url,
  2. LiveInjectStreamConfig config
)

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.

Warning

Agora will soon stop the service for injecting online media streams on the client. If you have not implemented this service, Agora recommends that you do not use it.

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:

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(),
  });
}