import { EnhancedEventEmitter } from '../enhancedEvents'; import type { IceParameters, IceCandidate, DtlsParameters, IceGatheringState, ConnectionState } from '../Transport'; import type { ProducerCodecOptions, ProducerHeaderExtensionOptions, OnRtpSenderCallback } from '../Producer'; import type { OnRtpReceiverCallback } from '../Consumer'; import type { RtpCapabilities, RtpCodecCapability, RtpParameters, RtpEncodingParameters, ExtendedRtpCapabilities } from '../RtpParameters'; import type { SctpCapabilities, SctpParameters, SctpStreamParameters } from '../SctpParameters'; export type HandlerFactory = { name: string; factory: (options: HandlerOptions) => HandlerInterface; getNativeRtpCapabilities(options: HandlerGetNativeRtpCapabilitiesOptions): Promise; getNativeSctpCapabilities(): Promise; }; export type HandlerOptions = { direction: 'send' | 'recv'; iceParameters: IceParameters; iceCandidates: IceCandidate[]; dtlsParameters: DtlsParameters; sctpParameters?: SctpParameters; iceServers?: RTCIceServer[]; iceTransportPolicy?: RTCIceTransportPolicy; additionalSettings?: Partial; getSendExtendedRtpCapabilities: (nativeSendRtpCapabilities: RtpCapabilities) => ExtendedRtpCapabilities; }; export type HandlerGetNativeRtpCapabilitiesOptions = { direction: Extract; }; export type HandlerSendOptions = { track: MediaStreamTrack; /** * Stream id (it affects the `id` field of the `a=msid` attribute in the * local SDP. If not given, all `Producers` will have the same `streamId` * in their `rtpParameters.msid`. Such a value tells consuming endpoints * which tracks to syncronize on reception. */ streamId?: string; encodings?: RtpEncodingParameters[]; codecOptions?: ProducerCodecOptions; headerExtensionOptions?: ProducerHeaderExtensionOptions; codec?: RtpCodecCapability; onRtpSender?: OnRtpSenderCallback; }; export type HandlerSendResult = { localId: string; rtpParameters: RtpParameters; rtpSender?: RTCRtpSender; }; export type HandlerReceiveOptions = { trackId: string; kind: 'audio' | 'video'; rtpParameters: RtpParameters; /** * Stream id (it affects the `id` field of the `a=msid` attribute in the * remote SDP. WebRTC based devices try to synchronize inbound streams with * same `streamId`. If not given, the consuming device will be told to * synchronize all streams produced by the same endpoint. However libwebrtc * can just synchronize up to one audio stream with one video stream. */ streamId?: string; onRtpReceiver?: OnRtpReceiverCallback; }; export type HandlerReceiveResult = { localId: string; track: MediaStreamTrack; rtpReceiver?: RTCRtpReceiver; }; export type HandlerSendDataChannelOptions = SctpStreamParameters; export type HandlerSendDataChannelResult = { dataChannel: RTCDataChannel; sctpStreamParameters: SctpStreamParameters; }; export type HandlerReceiveDataChannelOptions = { sctpStreamParameters: SctpStreamParameters; label?: string; protocol?: string; }; export type HandlerReceiveDataChannelResult = { dataChannel: RTCDataChannel; }; export type HandlerEvents = { '@close': []; '@connect': [ { dtlsParameters: DtlsParameters; }, () => void, (error: Error) => void ]; '@icegatheringstatechange': [IceGatheringState]; '@icecandidateerror': [RTCPeerConnectionIceErrorEvent]; '@connectionstatechange': [ConnectionState]; }; export declare abstract class HandlerInterface extends EnhancedEventEmitter { constructor(); abstract get name(): string; abstract close(): void; abstract updateIceServers(iceServers: RTCIceServer[]): Promise; abstract restartIce(iceParameters: IceParameters): Promise; abstract getTransportStats(): Promise; abstract send(options: HandlerSendOptions): Promise; abstract stopSending(localId: string): Promise; abstract pauseSending(localId: string): Promise; abstract resumeSending(localId: string): Promise; abstract replaceTrack(localId: string, track: MediaStreamTrack | null): Promise; abstract setMaxSpatialLayer(localId: string, spatialLayer: number): Promise; abstract setRtpEncodingParameters(localId: string, params: Partial): Promise; abstract getSenderStats(localId: string): Promise; abstract sendDataChannel(options: HandlerSendDataChannelOptions): Promise; abstract receive(optionsList: HandlerReceiveOptions[]): Promise; abstract stopReceiving(localIds: string[]): Promise; abstract pauseReceiving(localIds: string[]): Promise; abstract resumeReceiving(localIds: string[]): Promise; abstract getReceiverStats(localId: string): Promise; abstract receiveDataChannel(options: HandlerReceiveDataChannelOptions): Promise; } //# sourceMappingURL=HandlerInterface.d.ts.map