This commit is contained in:
yumoqing 2024-08-21 15:50:30 +08:00
parent 321e25e309
commit 20f92e3bea

View File

@ -74,7 +74,6 @@ bricks.RTCClient = class extends bricks.VBox {
this.choose_peer();
} else {
this.call_close();
this.phone.set_state('free');
}
}
choose_peer(){
@ -218,7 +217,7 @@ bricks.RTCClient = class extends bricks.VBox {
async signaling_message_handle(event){
var datapkg = JSON.parse(event.data);
var d = datapkg.data;
console.log('data received from server', 'd=', d, d.type);
console.log('data received from server', 'd=', d);
switch (d.type){
case 'onlineList':
this.onlineList = d.onlineList;
@ -250,10 +249,9 @@ bricks.RTCClient = class extends bricks.VBox {
}
break;
case 'iceCandidate':
console.log('iceCandidate: d.from=', d.from, 'peer_info=', this.peer_info);
if (d.from.id == this.peer_info.id){
var candidate = new RTCIceCandidate(d.candidate);
await this.pc.addIceCandidate(candidate);
# var candidate = new RTCIceCandidate(d.candidate);
await this.pc.addIceCandidate(d.candidate);
console.log('iceCandidate branch exe');
}
break;
@ -282,8 +280,7 @@ bricks.RTCClient = class extends bricks.VBox {
await this.getLocalStream();
const configuration = {
iceServers: [
{ urls: this.ice_url },
{ urls: 'stun:stunserver2024.stunprotocol.org:3478' }
{ urls: this.ice_url }
]
};
this.pc = new RTCPeerConnection(configuration);