CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-webrtc-adapter

A shim to insulate apps from WebRTC spec changes and browser prefix differences

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-4/

Legacy Stream Monitor

A WebRTC connection monitor that tracks media streams using the legacy Stream API.

Capabilities

Stream Tracking

Build a connection monitor that tracks both local and remote media streams on a WebRTC peer connection. The monitor should provide methods to retrieve currently active streams and handle stream lifecycle events.

  • Given a peer connection with local streams added, retrieve all local streams @test
  • Given a peer connection with remote streams, retrieve all remote streams @test
  • When a remote stream is added to the connection, detect and log the stream event @test
  • Track the total count of streams (both local and remote) currently active @test

Implementation

@generates

API

/**
 * Creates a stream monitor for a WebRTC peer connection
 * @param {RTCPeerConnection} peerConnection - The peer connection to monitor
 * @returns {Object} Monitor object with methods to track streams
 */
export function createStreamMonitor(peerConnection);

/**
 * Monitor object interface:
 * {
 *   getLocalStreams(): MediaStream[] - Returns array of local streams
 *   getRemoteStreams(): MediaStream[] - Returns array of remote streams
 *   getTotalStreamCount(): number - Returns total count of all streams
 *   onStreamAdded(callback): void - Register callback for when remote streams are added
 * }
 */

Dependencies { .dependencies }

webrtc-adapter { .dependency }

Provides WebRTC compatibility and legacy Stream API support.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-webrtc-adapter

tile.json