/// import { Deferred } from './promise'; import { EventEmitter } from 'events'; import { Stream } from '../stream'; import { RemoteStreamDescription } from '../peer_connection'; /** * @module rtc.internal */ /** * Helper handling the mapping of streams for RemotePeer * @class rtc.internal.StreamCollection * * @constructor */ export declare class StreamCollection extends EventEmitter { streams: Record>; _defers: Record>; _pending: Record; _resolved: Record; wait_d: Deferred; wait_p: Promise; /** * A new stream was added to the collection * @event steam_added * @param {String} name The user defined name of the stream * @param {Promise -> rtc.Stream} stream Promise to the stream */ constructor(); /** * Set stream description and generate promises * @method update * @param streamNames {Object} An object mapping the stream ids to stream names */ setRemote(data: RemoteStreamDescription): void; /** * Add stream to the collection and resolve promises waiting for it * @method resolve * @param {rtc.Stream} mediaStream */ resolve(name: string, mediaStream: MediaStream): void; /** * Gets a promise for a stream with the given name. Might be rejected after `update()` * * @method get * @param {String} name * @return {Promise} The promise for the `rtc.Stream` */ get(name: string): Promise; }