Skip to content

Commit

Permalink
Update peer-stream.js
Browse files Browse the repository at this point in the history
  • Loading branch information
xosg committed Sep 20, 2023
1 parent e069750 commit 7dd6af9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions peer-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,10 @@ class PeerStream extends HTMLVideoElement {
};

this.ws.onclose = (e) => {
let timeout = 3000;
if (e.code === 3333) {
this.id = e.reason;
console.log("redirect =>", e.reason);
timeout = 500;
} else {
console.warn(e);
}
this.dispatchEvent(new CustomEvent("playerdisconnected",{}));
console.warn(e);
this.dispatchEvent(new CustomEvent("playerdisconnected",{}));
clearTimeout(this.reconnect);
this.reconnect = setTimeout(() => this.connectedCallback(), timeout);
this.reconnect = setTimeout(() => this.connectedCallback(), 3000);
};
}

Expand Down

0 comments on commit 7dd6af9

Please sign in to comment.