@phenixrts/sdk
Version:
JavaScript SDK
36 lines (35 loc) • 2.32 kB
TypeScript
import IDisposable from '../lang/IDisposable';
import { ILegacyRTCStatsReport } from './RtcConnectionMonitor';
interface IPeerConnection extends IDisposable {
readonly native: RTCPeerConnection | null;
readonly currentLocalDescription: RTCSessionDescription | null;
readonly currentRemoteDescription: RTCSessionDescription | null;
readonly connectionState: RTCPeerConnectionState | null;
readonly iceConnectionState: RTCIceConnectionState | null;
readonly supportsGetConfiguration: boolean;
readonly supportsSetConfiguration: boolean;
readonly supportsGetTransceivers: boolean;
readonly supportsAddTransceiver: boolean;
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
createAnswer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
setLocalDescription(description: RTCSessionDescriptionInit): Promise<void>;
setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void>;
getStats(selector?: MediaStreamTrack | null): Promise<RTCStatsReport>;
getSenders(): RTCRtpSender[];
getReceivers(): RTCRtpReceiver[];
getStatsLegacy(): Promise<ILegacyRTCStatsReport>;
addEventListener<T extends keyof RTCPeerConnectionEventMap>(type: T, listener: (this: RTCPeerConnection, event: RTCPeerConnectionEventMap[T]) => unknown, options?: boolean | AddEventListenerOptions): void;
getTransceivers(): RTCRtpTransceiver[];
removeEventListener<T extends keyof RTCPeerConnectionEventMap>(type: T, listener: (this: RTCPeerConnection, event: RTCPeerConnectionEventMap[T]) => unknown, options?: boolean | AddEventListenerOptions): void;
addTransceiver(name: string, options: RTCRtpTransceiverInit): RTCRtpTransceiver;
getConfiguration(): RTCConfiguration;
setConfiguration(description: RTCConfiguration): void;
addStream(mediaStream: MediaStream): void;
ontrack: ((this: RTCPeerConnection, event: RTCTrackEvent) => unknown) | null;
onicecandidate: ((this: RTCPeerConnection, event: RTCPeerConnectionIceEvent) => unknown) | null;
oniceconnectionstatechange: ((this: RTCPeerConnection, event: Event) => unknown) | null;
onconnectionstatechange: ((this: RTCPeerConnection, event: Event) => unknown) | null;
close(): void;
dispose(): void;
}
export default IPeerConnection;