Skip to content

Commit

Permalink
feat(restartIce)
Browse files Browse the repository at this point in the history
  • Loading branch information
adwpc committed Feb 12, 2021
1 parent 49653a5 commit d4a7a02
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions decs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ interface RTCPeerConnection extends EventTarget {
readonly signalingState: RTCSignalingState;
readonly connectionState: RTCPeerConnectionState;

restartIce(): void;
getConfiguration(): RTCConfiguration;
setConfiguration(configuration: RTCConfiguration): void;
close(): void;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"ion",
"js"
]
}
}
11 changes: 10 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ export class Transport {
this.signal.trickle({ target: role, candidate });
}
};
}

this.pc.oniceconnectionstatechange = async (e) => {
if (this.pc.iceConnectionState === "disconnected") {
if (this.pc.restartIce) {
// this will trigger onNegotiationNeeded
this.pc.restartIce();
}
}
}
};
}

export default class Client {
Expand Down

0 comments on commit d4a7a02

Please sign in to comment.