This commit is contained in:
yumoqing 2024-08-21 17:34:18 +08:00
parent 554e5218e7
commit 4a48b85fc1

View File

@ -280,9 +280,7 @@ bricks.RTCClient = class extends bricks.VBox {
this.peer_w.set_text(to_info.name);
await this.getLocalStream();
const configuration = {
iceServers: [
{ urls: this.ice_url }
]
iceServers: this.ice_servers,
};
console.log('configuration=', configuration);
this.pc = new RTCPeerConnection(configuration);
@ -297,10 +295,6 @@ bricks.RTCClient = class extends bricks.VBox {
console.log('pc is null');
return;
}
if (this.role == 'requester'){
await this.send_offer();
}
// 处理 ICE 候选
this.pc.onicecandidate = this.send_candidate.bind(this, to_info);
@ -308,6 +302,11 @@ bricks.RTCClient = class extends bricks.VBox {
this.pc.ontrack = event => {
this.remoteVideo.set_stream(event.streams[0]);
};
if (this.role == 'requester'){
await this.send_offer();
}
console.log('createPeerConnection() finished');
}
}