bugfix
This commit is contained in:
parent
ccefdc130a
commit
6fa7be2466
@ -153,14 +153,14 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
type:'login',
|
||||
info:this.info
|
||||
}
|
||||
this.socket.send(JSON.stringify(d));
|
||||
this.socket_send(JSON.stringify(d));
|
||||
}
|
||||
signaling_logout(){
|
||||
var d= {
|
||||
type:'logout',
|
||||
info:this.info
|
||||
}
|
||||
this.socket.send(JSON.stringify(d));
|
||||
this.socket_send(JSON.stringify(d));
|
||||
}
|
||||
// 获取本地媒体流
|
||||
async getLocalStream() {
|
||||
@ -183,13 +183,13 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
}
|
||||
this.peer_info = peer_info;
|
||||
this.role = 'requester';
|
||||
this.socket.send(JSON.stringify(d));
|
||||
this.socket_send(JSON.stringify(d));
|
||||
}
|
||||
async send_offer(){
|
||||
var offer = await this.pc.createOffer();
|
||||
await this.pc.setLocalDescription(offer);
|
||||
console.log('########send_offer =', offer, this.pc.localDescription);
|
||||
this.socket.send(JSON.stringify({
|
||||
this.socket_send(JSON.stringify({
|
||||
type:'offer',
|
||||
offer:this.pc.localDescription,
|
||||
to:this.peer_info
|
||||
@ -199,7 +199,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
if (event.candidate) {
|
||||
var candidate = event.candidate;
|
||||
console.log('send_candidate(), candidate=', candidate);
|
||||
this.socket.send(JSON.stringify({
|
||||
this.socket_send(JSON.stringify({
|
||||
type: 'iceCandidate',
|
||||
to:peer_info,
|
||||
candidate: candidate
|
||||
@ -220,7 +220,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
this.peer_info = peer_info
|
||||
this.role = 'responser'
|
||||
await this.createPeerConnection(this.peer_info);
|
||||
this.socket.send(JSON.stringify({
|
||||
this.socket_send(JSON.stringify({
|
||||
type: 'callAccepted',
|
||||
to: peer_info
|
||||
}));
|
||||
@ -231,7 +231,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
this.pc.ontrack = null;
|
||||
this.pc.close();
|
||||
if (! active){
|
||||
this.socket.send(JSON.stringify({
|
||||
this.socket_send(JSON.stringify({
|
||||
type:'disconnect',
|
||||
to:this.peer_info
|
||||
}));
|
||||
@ -251,11 +251,19 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
this.peer_w.set_text('');
|
||||
}
|
||||
call_rejected(peer_info){
|
||||
this.socket.send(JSON.stringify({
|
||||
this.socket_send(JSON.stringify({
|
||||
type: 'callRejected',
|
||||
to: peer_info
|
||||
}));
|
||||
}
|
||||
socket_send(s){
|
||||
try {
|
||||
this.socket.send(s);
|
||||
} catch (e){
|
||||
this.init_websocket();
|
||||
this.socket.send(s);
|
||||
}
|
||||
}
|
||||
async signaling_message_handle(event){
|
||||
var datapkg = JSON.parse(event.data);
|
||||
var d = datapkg.data;
|
||||
@ -279,7 +287,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
||||
var answer = await this.pc.createAnswer();
|
||||
await this.pc.setLocalDescription(answer);
|
||||
console.log('###### send_answer=', answer, 'desc=', this.pc.localDescription);
|
||||
this.socket.send(JSON.stringify({
|
||||
this.socket_send(JSON.stringify({
|
||||
type:'answer',
|
||||
answer:this.pc.localDescription,
|
||||
to:this.peer_info
|
||||
|
Loading…
Reference in New Issue
Block a user