Agora CDN 从 Web Sdk 多用户流式传输

Agora CDN streaming from Web Sdk multiple users

将一个多用户的agora频道推送到CDN,是否需要为每个用户调用以下方法?或者是否为一个主播设置转码和开始直播自动为频道中的每个人开始直播。另外,有没有像录音一样的默认转码布局?

client.setLiveTranscoding(LiveTranscoding);
client.startLiveStreaming("your RTMP URL", true)

要推送频道中的所有用户,您只需从单个用户调用 setLiveTranscodingstartLiveStreaming。在实时转码配置对象中,您可以使用 userCount 属性 设置用户数量,并使用 transcodingUsers 对象自定义每个用户的各种设置。

// CDN transcoding settings.
var liveTranscodingConfig = {
  // Width of the video (px). The default value is 640.
  width: 640,
  // Height of the video (px). The default value is 360.
  height: 360,
  // Bitrate of the video (Kbps). The default value is 400.
  videoBitrate: 400,
  // Frame rate of the video (fps). The default value is 15. Agora adjusts all values over 30 to 30.
  videoFramerate: 15,
  audioSampleRate: AgoraRTC.AUDIO_SAMPLE_RATE_48000,
  audioBitrate: 48,
  audioChannels: 1,
  videoGop: 30,
  // Video codec profile. Choose to set as Baseline (66), Main (77), or High (100). If you set this parameter to other values, Agora adjusts it to the default value of 100.
  videoCodecProfile: AgoraRTC.VIDEO_CODEC_PROFILE_HIGH,
  userCount: 1,
  userConfigExtraInfo: {},
  backgroundColor: 0x000000,
  // Adds a PNG watermark image to the video. You can add more than one watermark image at the same time.
  images: [{
          url: "http://www.com/watermark.png",
          x: 0,
          y: 0,
          width: 160,
          height: 160,
      }],
  // Sets the output layout for each user.
  transcodingUsers: [{
          x: 0,
          y: 0,
          width: 640,
          height: 360,
          zOrder: 0,
          alpha: 1.0,
          // The uid must be identical to the uid used in Client.join.
          uid: 1232,
        }],
};

client.setLiveTranscoding(liveTranscodingConfig);
client.startLiveStreaming("your RTMP URL", true)