updatePublishMediaStream abstract method

void updatePublishMediaStream(
  1. String taskId,
  2. TRTCPublishTarget target,
  3. TRTCStreamEncoderParam param,
  4. TRTCStreamMixingConfig config
)

Modify publishing parameters

You can use this API to change the parameters of a publishing task initiated by startPublishMediaStream.

Parameters:

  • config(TRTCStreamMixingConfig):

    • The On-Cloud MixTranscoding settings. This parameter is invalid in the relay-to-CDN mode. It is required if you transcode and publish the stream to a CDN or to a TRTC room.
  • params(TRTCStreamEncoderParam):

    • The encoding settings. This parameter is required if you transcode and publish the stream to a CDN or to a TRTC room. If you relay to a CDN without transcoding, to improve the relaying stability and playback compatibility, we recommend you set this parameter.
  • target(TRTCPublishTarget):

    • The publishing destination. You can relay the stream to a CDN (after transcoding or without transcoding) or transcode and publish the stream to a TRTC room.
  • taskId(String):

Note

  1. You can use this API to add or remove CDN URLs to publish to (you can publish to up to 10 CDNs at a time). To avoid causing errors, do not specify the same URLs for different tasks executed at the same time.

  2. You can use this API to switch a relaying task to transcoding or vice versa. For example, in cross-room communication, you can first call startPublishMediaStream to relay to a CDN. When the anchor requests cross-room communication, call this API, passing in the task ID to switch the relaying task to a transcoding task. This can ensure that the live stream and CDN playback are not interrupted (you need to keep the encoding parameters consistent).

  3. You can not switch output between "only audio" 、 "only video" and "audio and video" for the same task.

Implementation

void updatePublishMediaStream(String taskId, TRTCPublishTarget target, TRTCStreamEncoderParam param, TRTCStreamMixingConfig config);