declare namespace OT { type MediaProcessorConnector = { setTrack: (track: MediaStreamTrack) => Promise; destroy: () => Promise; }; export type OTError = { name: string; message: string; }; export type Dimensions = { width: number; height: number; } export type ScreenSharingCapabilityResponse = { extensionInstalled?: boolean; supported: boolean; supportedSources: { application?: boolean; screen?: boolean; window?: boolean; }; extensionRequired?: string; extensionRegistered?: boolean; }; export function checkScreenSharingCapability( callback?: (response: ScreenSharingCapabilityResponse) => void ): Promise; export function checkSystemRequirements(): number; export type Device = { kind: 'audioInput' | 'videoInput'; deviceId: string; label: string; }; export type AudioOutputDevice = { deviceId: string | null | undefined; label: string | null; }; export type AudioInputDevice = { deviceId: string | null | undefined; label: string | null; } export type IceConfig = { includeServers: 'all' | 'custom'; transportPolicy: 'all' | 'relay'; customServers: Array<{ urls: string | string[]; username?: string; credential?: string; }>; }; export type VideoCodec = 'vp8' | 'vp9' | 'h264'; export type PreferredVideoCodecs = 'automatic' | [VideoCodec, ...VideoCodec[]]; export type VideoBitratePresetInput = 'default' | 'bw_saver' | 'extra_bw_saver'; export type VideoBitratePreset = VideoBitratePresetInput | 'custom'; export function getDevices( callback?: (error: OTError | undefined, devices?: Device[]) => void ): Promise; export function getAudioOutputDevices(): Promise; export function setProxyUrl(proxyUrl: string): void; export function getSupportedCodecs(): Promise<{ videoEncoders: ('H264' | 'VP8' | 'VP9')[], videoDecoders: ('H264' | 'VP8' | 'VP9')[] }>; export function hasMediaProcessorSupport(mediaType?: 'audio' | 'video' | 'both'): boolean; export namespace hasMediaProcessorSupport { var promise: (mediaType?: 'audio' | 'video' | 'both') => Promise; } export function hasEndToEndEncryptionSupport(): boolean; export type WidgetStyle = { audioLevelDisplayMode: 'auto' | 'on' | 'off'; backgroundImageURI: string; buttonDisplayMode: 'auto' | 'on' | 'off'; nameDisplayMode: 'auto' | 'on' | 'off'; videoDisabledDisplayMode: 'auto' | 'on' | 'off'; }; export type WidgetProperties = { fitMode?: 'cover' | 'contain'; insertDefaultUI?: boolean; insertMode?: 'replace' | 'after' | 'before' | 'append'; showControls?: boolean; width?: string | number; height?: string | number; }; export type PublisherStyle = WidgetStyle & { archiveStatusDisplayMode: 'auto' | 'off'; }; export type GetUserMediaProperties = { audioSource?: string | null | boolean | MediaStreamTrack; disableAudioProcessing?: boolean; echoCancellation?: boolean; noiseSuppression?: boolean; autoGainControl?: boolean; facingMode?: 'user' | 'environment' | 'left' | 'right'; frameRate?: 30 | 15 | 7 | 1; maxResolution?: Dimensions; resolution?: ( '1920x1080' | '1280x960' | '1280x720' | '640x480' | '640x360' | '320x240' | '320x180' ); videoSource?: string | null | boolean | MediaStreamTrack; }; export type VideoContentHint = "text" | "detail" | "motion" | ""; export type ScalabilityMode = | 'L1T1' | 'L1T2' | 'L1T3' | 'L2T1' | 'L2T2' | 'L2T3' | 'L3T1' | 'L3T2' | 'L3T3'; export type BackgroundBlurFilter = { type: 'backgroundBlur'; blurStrength?: 'low' | 'high'; }; export type BackgroundReplacementFilter = { type: 'backgroundReplacement'; backgroundImgUrl: string; }; export type AdvancedNoiseSuppressionFilter = { type: 'advancedNoiseSuppression'; }; export type VideoFilter = BackgroundBlurFilter | BackgroundReplacementFilter; export type AudioFilter = AdvancedNoiseSuppressionFilter; export interface LegacyMediaTrackConstraints { mandatory?: Record; optional?: Array>; } export interface LegacyMediaStreamConstraints { audio?: boolean | MediaTrackConstraints | LegacyMediaTrackConstraints; video?: boolean | MediaTrackConstraints | LegacyMediaTrackConstraints; } export type PublisherProperties = WidgetProperties & GetUserMediaProperties & { audioBitrate?: number; audioFallback?: { publisher?: boolean; subscriber?: boolean; }; initials?: string; mirror?: boolean; name?: string; publishAudio?: boolean; publishVideo?: boolean; publishCaptions?: boolean; publishSenderStats?: boolean; scalableScreenshare?: boolean; scalableVideo?: boolean; style?: Partial; videoContentHint?: VideoContentHint; enableDtx?: boolean; enableStereo?: boolean; videoFilter?: VideoFilter; audioFilter?: AudioFilter; disableAudioInputDeviceManagement?: boolean; preferredVideoCodecs?: PreferredVideoCodecs; constraints?: MediaStreamConstraints | LegacyMediaStreamConstraints; }; export type SubscriberStyle = WidgetStyle & { audioBlockedDisplayMode: 'auto' | 'on' | 'off'; }; export type CaptionsLanguageCode = | 'af-ZA' | 'ar-AE' | 'ar-SA' | 'eu-ES' | 'ca-ES' | 'zh-HK' | 'zh-CN' | 'zh-TW' | 'hr-HR' | 'cs-CZ' | 'da-DK' | 'nl-NL' | 'en-AU' | 'en-GB' | 'en-IN' | 'en-IE' | 'en-NZ' | 'en-AB' | 'en-ZA' | 'en-US' | 'en-WL' | 'fa-IR' | 'fi-FI' | 'fr-FR' | 'fr-CA' | 'gl-ES' | 'de-DE' | 'de-CH' | 'el-GR' | 'he-IL' | 'hi-IN' | 'id-ID' | 'it-IT' | 'ja-JP' | 'ko-KR' | 'lv-LV' | 'ms-MY' | 'no-NO' | 'pl-PL' | 'pt-PT' | 'pt-BR' | 'ro-RO' | 'ru-RU' | 'sr-RS' | 'sk-SK' | 'so-SO' | 'es-ES' | 'es-US' | 'sv-SE' | 'tl-PH' | 'th-TH' | 'uk-UA' | 'vi-VN' | 'zu-ZA'; export type SubscriberProperties = WidgetProperties & { audioVolume?: number; preferredFrameRate?: number; preferredResolution?: 'auto' | Dimensions; style?: Partial; subscribeToAudio?: boolean; subscribeToCaptions?: boolean; subscribeToVideo?: boolean; testNetwork?: boolean; captionsTranslationLanguage?: CaptionsLanguageCode; }; export class Connection { connectionId: string; creationTime: number; data: string; } export class Stream { connection: Connection; creationTime: number; frameRate: number; hasAudio: boolean; hasCaptions: boolean; hasVideo: boolean; initials: string; name: string; streamId: string; videoDimensions: { width: number; height: number; }; videoType: 'camera' | 'screen' | 'custom' | undefined; } export type Event = { type: Type; cancelable: boolean; target: Target; isDefaultPrevented(): boolean; preventDefault(): void; }; export type ExceptionEvent = Event<'exception', {}> & { code: number; message: string; title: string; }; export type VideoDimensionsChangedEvent = Event<'videoDimensionsChanged', Target> & { oldValue: Dimensions; newValue: Dimensions; }; export type CpuPerformanceState = 'nominal' | 'fair' | 'serious' | 'critical'; export type QualityScore = { audioQualityScore?: number; videoQualityScore?: number; } class OTEventEmitter { on( eventName: EventName, callback: (event: EventMap[EventName]) => void, context?: object ): void; on( eventName: string, callback: (event: Event) => void, context?: object ): void; on( eventMap: object, context?: object ): void; once( eventName: EventName, callback: (event: EventMap[EventName]) => void, context?: object ): void; once( eventName: string, callback: (event: Event) => void, context?: object ): void; once( eventMap: object, context?: object ): void; off( eventName?: EventName, callback?: (event: EventMap[EventName]) => void, context?: object ): void; off( eventName?: string, callback?: (event: Event) => void, context?: object ): void; off( eventMap: object, context?: object ): void; } // This class is a modified copy of OTEventEmitter that was needed in order to support the template string used for the signal:type event class SessionOTEventEmitter { on( eventName: EventName, callback: (event: EventMap[EventName]) => void, context?: object ): void; on( eventName: `signal:${string}`, callback: (event: Event<`signal:${string}`, Session> & { type?: string; data?: string; from: Connection | null; }) => void, context?: object ): void; on( eventName: string, callback: (event: Event) => void, context?: object ): void; on( eventMap: object, context?: object ): void; once( eventName: EventName, callback: (event: EventMap[EventName]) => void, context?: object ): void; once( eventName: `signal:${string}`, callback: (event: Event<`signal:${string}`, Session> & { type?: string; data?: string; from: Connection | null; }) => void, context?: object ): void; once( eventName: string, callback: (event: Event) => void, context?: object ): void; once( eventMap: object, context?: object ): void; off( eventName?: EventName, callback?: (event: EventMap[EventName]) => void, context?: object ): void; off( eventName: `signal:${string}`, context?: object ): void; off( eventName?: string, callback?: (event: Event) => void, context?: object ): void; off( eventMap: object, context?: object ): void; } export class Publisher extends OTEventEmitter<{ accessAllowed: Event<'accessAllowed', Publisher>; accessDenied: Event<'accessDenied', Publisher>; accessDialogClosed: Event<'accessDialogClosed', Publisher>; accessDialogOpened: Event<'accessDialogOpened', Publisher>; audioInputDeviceChanged: Event<'audioInputDeviceChanged', Publisher> & { device: AudioInputDevice; }; audioLevelUpdated: Event<'audioLevelUpdated', Publisher> & { audioLevel: number }; destroyed: Event<'destroyed', Publisher>; mediaStopped: Event<'mediaStopped', Publisher> & { track: MediaStreamTrack | undefined }; mediaStreamAvailable: Event<'mediaStreamAvailable', Publisher> & { mediaStream: MediaStream; }; streamCreated: Event<'streamCreated', Publisher> & { stream: Stream; }; streamDestroyed: Event<'streamDestroyed', Publisher> & { stream: Stream; reason: string; }; videoDimensionsChanged: VideoDimensionsChangedEvent; videoElementCreated: Event<'videoElementCreated', Publisher> & { element: HTMLVideoElement | HTMLObjectElement; }; videoEnabled: Event<'videoEnabled', Publisher> & { reason: 'quality'; }; videoDisabled: Event<'videoDisabled', Publisher> & { reason: 'quality'; }; videoDisableWarning: Event<'videoDisableWarning', Publisher>; videoDisableWarningLifted: Event<'videoDisableWarningLifted', Publisher>; videoQualityChanged: Event<'videoQualityChanged', Publisher> & { reason: VideoQualityReason; statsContainer: PublisherStatContainer; }; networkConditionChanged: Event<'networkConditionChanged', Publisher> & { reason: 'networkConditionChanged'; statsContainer: PublisherStatContainer; }; muteForced: Event<'muteForced', Publisher>; }> { accessAllowed: boolean; element?: HTMLElement | undefined; id?: string; stream?: Stream; session?: Session; destroy: { (): Publisher; promise: () => Promise; } getImgData(): string | null; getStats(callback?: (error?: OTError, stats?: PublisherStatsArr) => void): Promise; getRtcStatsReport(): Promise; getStyle(): PublisherStyle; applyVideoFilter(videoFilter: VideoFilter): Promise; getVideoFilter(): VideoFilter | null; clearVideoFilter(): Promise; applyAudioFilter(audioFilter: AudioFilter): Promise; clearAudioFilter(): Promise; getAudioFilter(): AudioFilter | null; publishAudio: { (value: boolean): Publisher; promise: (value: boolean) => Promise; } publishVideo: { (value: boolean, callback?: (error?: OTError) => void): Publisher; promise: (value: boolean) => Promise; } publishCaptions(value: boolean): Promise; cycleVideo(): Promise<{ deviceId: string }>; setAudioSource(audioSource:string | MediaStreamTrack): Promise; getAudioSource(): MediaStreamTrack; setVideoSource(videoSourceId: string): Promise; getVideoContentHint(): VideoContentHint; setVideoContentHint(hint: VideoContentHint): Promise; setTargetScalabilityMode(scalabilityMode: ScalabilityMode): void; getTargetScalabilityMode(): ScalabilityMode | undefined; getVideoSource(): {deviceId: string | null, type: string | null, track: MediaStreamTrack | null}; setStyle