A shim to insulate apps from WebRTC spec changes and browser prefix differences
Overall
score
98%
Build a statistics monitoring utility for WebRTC that retrieves quality metrics for individual audio and video tracks.
Your implementation should provide functionality to retrieve statistics for individual RTP senders and receivers. The utility should:
The implementation should work across different browsers by utilizing webrtc-adapter's cross-browser compatibility features.
@generates
/**
* Retrieves statistics for a specific RTP sender.
*
* @param {RTCRtpSender} sender - The RTP sender to get stats for
* @returns {Promise<RTCStatsReport>} Stats report containing sender-specific metrics
*/
async function getSenderStats(sender) {
// IMPLEMENTATION HERE
}
/**
* Retrieves statistics for a specific RTP receiver.
*
* @param {RTCRtpReceiver} receiver - The RTP receiver to get stats for
* @returns {Promise<RTCStatsReport>} Stats report containing receiver-specific metrics
*/
async function getReceiverStats(receiver) {
// IMPLEMENTATION HERE
}
module.exports = {
getSenderStats,
getReceiverStats
};getSenderStats returns a stats report with outbound-rtp metrics @testgetReceiverStats returns a stats report with inbound-rtp metrics @testgetSenderStats returns an empty stats report @testProvides cross-browser WebRTC compatibility and normalizes API differences between browsers.
Install with Tessl CLI
npx tessl i tessl/npm-webrtc-adapterdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10