Skip to content

Commit

Permalink
feat: expose icecandidateerror event (#82)
Browse files Browse the repository at this point in the history
* feat: expose icecandidateerror event

* fix: update to latest version for new typescript version

---------

Co-authored-by: kwasniow <[email protected]>
  • Loading branch information
k-wasniowski and kwasniow authored Jul 11, 2024
1 parent 6acf5d7 commit 29669bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/peer-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type IceGatheringStateChangeEvent = {
enum PeerConnectionEvents {
IceGatheringStateChange = 'icegatheringstatechange',
IceCandidate = 'icecandidate',
IceCandidateError = 'icecandidateerror',
PeerConnectionStateChange = 'peerconnectionstatechange',
IceConnectionStateChange = 'iceconnectionstatechange',
CreateOfferOnSuccess = 'createofferonsuccess',
Expand All @@ -39,6 +40,7 @@ enum PeerConnectionEvents {
interface PeerConnectionEventHandlers extends EventMap {
[PeerConnectionEvents.IceGatheringStateChange]: (ev: IceGatheringStateChangeEvent) => void;
[PeerConnectionEvents.IceCandidate]: (ev: RTCPeerConnectionIceEvent) => void;
[PeerConnectionEvents.IceCandidateError]: (ev: RTCPeerConnectionIceErrorEvent) => void;
[PeerConnectionEvents.PeerConnectionStateChange]: (state: RTCPeerConnectionState) => void;
[PeerConnectionEvents.IceConnectionStateChange]: (state: RTCIceConnectionState) => void;
[PeerConnectionEvents.CreateOfferOnSuccess]: (offer: RTCSessionDescriptionInit) => void;
Expand Down Expand Up @@ -113,6 +115,10 @@ class PeerConnection extends EventEmitter<PeerConnectionEventHandlers> {
this.pc.onicecandidate = (ev: RTCPeerConnectionIceEvent) => {
this.emit(PeerConnection.Events.IceCandidate, ev);
};

this.pc.onicecandidateerror = (ev: RTCPeerConnectionIceErrorEvent) => {
this.emit(PeerConnection.Events.IceCandidateError, ev);
};
}

/**
Expand Down

0 comments on commit 29669bd

Please sign in to comment.