gpt4 book ai didi

google-chrome - 在 SimpleWebRTC 中获取约束对象

转载 作者:行者123 更新时间:2023-12-01 23:46:22 26 4
gpt4 key购买 nike

我正在做一个simpleWebRTC 演示来创建直播 session 。

我想要实现的是:

  1. 人是领导者。领导可以播放他的音频和视频。
  2. 其余加入的都是追随者。他们只能看到和听到领导的广播。

为了在常规webRTC中做到这一点,我们有约束对象,其中我们可以说:

{audio: false, video: false}

但是,在simpleWebRTC对象中,我没有看到暴露的约束对象

如何使用simpleWebRTC完成此任务?

最佳答案

所以我发现这个文档在这里说( https://simplewebrtc.com/notsosimple.html ):

var webrtc = new SimpleWebRTC({
localVideoEl: 'localVideo',
remoteVideosEl: 'remotesVideos',
autoRequestMedia: true,
url: 'https://example.com/'
//use the media options to pass constraints for getUserMedia requests
media: mediaOptions
});

或者你必须修改库:

SimpleWebRTC.prototype.startLocalVideo = ->
self = this
this.config.constraints ||= {video: true, audio: true}
this.webrtc.startLocalMedia this.config.constraints, (err, stream)->
if err
self.emit(err)
else
attachMediaStream(stream,
self.getLocalVideoContainer(),
{muted: true, mirror: true})

然后

webrtc = new SimpleWebRTC
localVideoEl: 'localVideo'
remoteVideosEl: 'remotes'
autoRequestMedia: true
debug: true
detectSpeakingEvents: true
autoAdjustMic: false
constraints:
audio: true
video:
mandatory:
maxWidth: 320
maxHeight: 180

这是破解方法 http://blog.dev.zyncro-china.com/2014/02/25/hacking-simplewebrtc-js-to-change-the-video-resolution/

关于google-chrome - 在 SimpleWebRTC 中获取约束对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24521593/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com