Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add getStats to PeerConnection #11

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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