This commit is contained in:
yumoqing 2024-08-24 19:34:59 +08:00
parent e7f63b40c3
commit a490821cdd

View File

@ -20,6 +20,10 @@ bricks.RTCClient = class extends bricks.VBox {
{ {
"signaling_url": "signaling_url":
"ice_url": "ice_url":
"mediaOptions":{
"audio":true,
"video":true
}
"auto_call_accept":false "auto_call_accept":false
"info":{ "info":{
"id": "id":
@ -147,7 +151,11 @@ bricks.RTCClient = class extends bricks.VBox {
// 获取本地媒体流 // 获取本地媒体流
async getLocalStream() { async getLocalStream() {
try { try {
const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true }); var videoOptions = this.mediaOptions || {
video: true,
audio: true
};
const stream = await navigator.mediaDevices.getUserMedia(mediaOptions);
this.localVideo.set_stream(stream); this.localVideo.set_stream(stream);
return stream; return stream;
} catch (error) { } catch (error) {