首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >来自Web Sdk的Agora CDN流多用户

来自Web Sdk的Agora CDN流多用户
EN

Stack Overflow用户
提问于 2020-09-18 16:11:50
回答 1查看 196关注 0票数 1

要将多用户的agora通道推送到CDN,是否需要为每个用户调用以下方法?或者为一个主机设置代码转换和启动直播流是否自动为频道中的每个人启动流。另外,有没有类似录制的默认转码布局?

代码语言:javascript
复制
client.setLiveTranscoding(LiveTranscoding);
client.startLiveStreaming("your RTMP URL", true)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-19 05:22:14

要推送通道中的所有用户,您只需从单个用户调用setLiveTranscodingstartLiveStreaming。在Live Transcoding Config对象中,您可以使用userCount属性设置用户数,并使用transcodingUsers对象为每个用户定制各种设置。

代码语言:javascript
复制
// 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)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63951770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档