|
@@ -20,6 +20,7 @@ export default class Rtcp extends EventEmitter {
|
|
|
E(this, "workers");
|
|
|
E(this, "actived", !0);
|
|
|
E(this, "heartbeat");
|
|
|
+ /*
|
|
|
E(this, "onIcecandidate", e=>{
|
|
|
if (e.candidate != null) {
|
|
|
const t = JSON.stringify(e.candidate);
|
|
@@ -45,6 +46,7 @@ export default class Rtcp extends EventEmitter {
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
E(this, "onIceConnectionStateChange", ()=>{
|
|
|
if (!!this.connection)
|
|
|
switch (logger.info(`iceConnectionState: ${this.connection.iceConnectionState}`),
|
|
@@ -117,6 +119,7 @@ export default class Rtcp extends EventEmitter {
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
E(this, "input", e=>{
|
|
|
// var t = this.inputChannel
|
|
|
// if(!this.actived || !this.inputChannel || this.inputChannel.readyState === "open"){
|
|
@@ -128,14 +131,15 @@ export default class Rtcp extends EventEmitter {
|
|
|
// }
|
|
|
//!this.actived || !this.inputChannel || this.inputChannel.readyState === "open" && (t == null || t.send(e))
|
|
|
}
|
|
|
- );
|
|
|
+ );*/
|
|
|
+
|
|
|
this.network = e,
|
|
|
this.workers = new Workers(this,logger),
|
|
|
this.workers.registerLogger(logger),
|
|
|
this.workers.registerFunction("data", t=>{
|
|
|
this.emit("data", t)
|
|
|
- }
|
|
|
- ),
|
|
|
+ });
|
|
|
+
|
|
|
this.heartbeat = new Heartbeat({
|
|
|
ping: t=>{
|
|
|
e.room.actionsHandler.echo(t)
|
|
@@ -154,6 +158,7 @@ export default class Rtcp extends EventEmitter {
|
|
|
|
|
|
|
|
|
start() {
|
|
|
+ /*
|
|
|
this.connection = new RTCPeerConnection;
|
|
|
const e = Date.now();
|
|
|
this.connection.ondatachannel = t=>{
|
|
@@ -201,31 +206,32 @@ export default class Rtcp extends EventEmitter {
|
|
|
// is_mobile: !0
|
|
|
// })
|
|
|
// })
|
|
|
+ */
|
|
|
}
|
|
|
- addCandidate(e) {
|
|
|
- e === "" ? this.network.rtcp.flushCandidate() : this.candidates.push(e)
|
|
|
- }
|
|
|
- disconnect() {
|
|
|
- var e, t, r;
|
|
|
- this.heartbeat.stop(),
|
|
|
- logger.info("ready to close datachannel, id", (e = this.inputChannel) == null ? void 0 : e.id),
|
|
|
- (t = this.inputChannel) == null || t.close(),
|
|
|
- (r = this.connection) == null || r.close(),
|
|
|
- this.connection = null,
|
|
|
- this.inputChannel = null
|
|
|
- }
|
|
|
- sendStringData(e) {
|
|
|
- console.log('e',e)
|
|
|
- this.input(e)
|
|
|
- }
|
|
|
- sendData(e) {
|
|
|
- let t = "";
|
|
|
- try {
|
|
|
- t = JSON.stringify(e)
|
|
|
- } catch (r) {
|
|
|
- logger.error(r);
|
|
|
- return
|
|
|
- }
|
|
|
- this.input(t)
|
|
|
- }
|
|
|
+ // addCandidate(e) {
|
|
|
+ // e === "" ? this.network.rtcp.flushCandidate() : this.candidates.push(e)
|
|
|
+ // }
|
|
|
+ // disconnect() {
|
|
|
+ // var e, t, r;
|
|
|
+ // this.heartbeat.stop(),
|
|
|
+ // logger.info("ready to close datachannel, id", (e = this.inputChannel) == null ? void 0 : e.id),
|
|
|
+ // (t = this.inputChannel) == null || t.close(),
|
|
|
+ // (r = this.connection) == null || r.close(),
|
|
|
+ // this.connection = null,
|
|
|
+ // this.inputChannel = null
|
|
|
+ // }
|
|
|
+ // sendStringData(e) {
|
|
|
+ // console.log('e',e)
|
|
|
+ // this.input(e)
|
|
|
+ // }
|
|
|
+ // sendData(e) {
|
|
|
+ // let t = "";
|
|
|
+ // try {
|
|
|
+ // t = JSON.stringify(e)
|
|
|
+ // } catch (r) {
|
|
|
+ // logger.error(r);
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // this.input(t)
|
|
|
+ // }
|
|
|
}
|