startPublishing method

Future<void> startPublishing(
  1. String streamId,
  2. int streamType
)

Start pushing to Tencent Cloud CSS CDN

This API specifies the StreamId corresponding to the current user's audio/video stream in Tencent Cloud CDN and thus specify the current user's CDN playback address.

For example, if you use the following code to set the StreamId of the current user's primary image to user_stream_001, then the CDN playback address corresponding to the user's primary image is: http://yourdomain/live/user_stream_001.flv, where yourdomain is your playback domain name with an ICP filing. You can configure your playback domain name in the CSS console. Tencent Cloud doesn't provide a default playback domain name.

You can also specify the streamId when setting the TRTCParams parameter of enterRoom , which is the recommended approach.

Parameters:

streamId Custom stream ID.

streamType Only TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG and TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_SUB are supported.

Note:

You need to enable the "Enable Relayed Push" option on the "Function Configuration" page in the TRTC console first.

*If you select "Specified stream for relayed push", you can use this API to push the corresponding audio/video stream to Tencent Cloud CDN and specify the entered stream ID.

*If you select "Global auto-relayed push", you can use this API to adjust the default stream ID.

Not supported on:

  • web

Implementation

Future<void> startPublishing(String streamId, int streamType) {
  return _channel.invokeMethod('startPublishing', {
    "streamId": streamId,
    "streamType": streamType,
  });
}