Skip to content

Commit

Permalink
feat: add getStats to PeerConnection (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryce Tham <[email protected]>
  • Loading branch information
brycetham and Bryce Tham authored Nov 28, 2022
1 parent c041423 commit 3868f24
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/peer-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ class PeerConnection extends EventEmitter<PeerConnectionEventHandlers> {
return this.pc.getTransceivers();
}

/**
* Get statistics about either the overall connection or about the specified MediaStreamTrack.
*
* @param selector - An optional MediaStreamTrack for which to gather statistics. If not provided,
* statistics will be gathered for the entire underlying RTCPeerConnection.
* @returns - A Promise which resolves with an RTCStatsReport object providing connection
* statistics.
*/
getStats(selector?: MediaStreamTrack): Promise<RTCStatsReport> {
return this.pc.getStats(selector);
}

/**
* Returns a string that describes the connections' ICE gathering state.
*
Expand Down

0 comments on commit 3868f24

Please sign in to comment.