我正在做一个simpleWebRTC demo来创建livestream会话。
我想要做到的是:
要在常规的webRTC中这样做,我们有一个约束对象,其中我们可以说:
{audio: false, video: false}但是,在simpleWebRTC object中,我没有看到object暴露的约束。
如何使用simpleWebRTC完成这一任务
发布于 2015-05-31 05:52:36
因此,我在这里发现了这样一个文档:(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/
https://stackoverflow.com/questions/24521593
复制相似问题