bugfix
This commit is contained in:
parent
a6374eb954
commit
bc0dbe0340
@ -139,8 +139,9 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
this.socket.send(JSON.stringify(d));
|
this.socket.send(JSON.stringify(d));
|
||||||
}
|
}
|
||||||
async send_offer(){
|
async send_offer(){
|
||||||
var offer = await this.peerConnection.createOffer();
|
var offer = this.peerConnection.createOffer();
|
||||||
this.peerConnection.setLocalDescription(offer);
|
this.peerConnection.setLocalDescription(offer);
|
||||||
|
console.log('offer =', offer, this.peerConnection.localDescription);
|
||||||
this.socket.send(JSON.stringify({
|
this.socket.send(JSON.stringify({
|
||||||
type:'offer',
|
type:'offer',
|
||||||
offer:this.peerConnection.localDescription,
|
offer:this.peerConnection.localDescription,
|
||||||
@ -197,7 +198,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
async signaling_message_handle(event){
|
async signaling_message_handle(event){
|
||||||
var datapkg = JSON.parse(event.data);
|
var datapkg = JSON.parse(event.data);
|
||||||
var d = datapkg.data;
|
var d = datapkg.data;
|
||||||
console.log('data received from server', datapkg, 'd=', d, event);
|
console.log('data received from server', 'd=', d, d.type);
|
||||||
switch (d.type){
|
switch (d.type){
|
||||||
case 'onlineList':
|
case 'onlineList':
|
||||||
this.onlineList = d.onlineList;
|
this.onlineList = d.onlineList;
|
||||||
@ -209,7 +210,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
break;
|
break;
|
||||||
case 'offer':
|
case 'offer':
|
||||||
var offer = new RTCSessionDescription(d.offer);
|
var offer = new RTCSessionDescription(d.offer);
|
||||||
var answer = await this.peerConnection.setRemoteDescription(offer);
|
var answer = this.peerConnection.setRemoteDescription(offer);
|
||||||
this.peerConnection.setLocalDescription(answer);
|
this.peerConnection.setLocalDescription(answer);
|
||||||
this.socket.send(JSON.stringify({
|
this.socket.send(JSON.stringify({
|
||||||
type:'answer',
|
type:'answer',
|
||||||
|
Loading…
Reference in New Issue
Block a user