-
-
Save raliste/2e9bfc89df7c5d4bf6461c52c0e9e068 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'twilio-video' { | |
// this actually returns a CancelablePromise | |
export function connect(token: string, options: ConnectOptions): Promise<Room>; | |
export function createLocalTracks(options?: CreateLocalTracksOptions): Promise<LocalTrack[]>; | |
export interface ConnectOptions { | |
name: string; | |
tracks: (LocalTrack | MediaStreamTrack)[]; | |
} | |
export interface CreateLocalTracksOptions { | |
audio: boolean | CreateLocalTrackOptions; | |
logLevel?: LogLevel | LogLevels; | |
video: boolean | CreateLocalTrackOptions; | |
} | |
export interface CreateLocalTrackOptions extends MediaTrackConstraints { | |
logLevel?: LogLevel | LogLevels; | |
name?: string; | |
} | |
export type LocalTrack = LocalAudioTrack | LocalVideoTrack; | |
export interface LogLevels { | |
default?: LogLevel; | |
media?: LogLevel; | |
signaling?: LogLevel; | |
webrtc?: LogLevel; | |
} | |
export type LogLevel = string; | |
export interface Room extends EventEmitter { | |
isRecording: boolean; | |
localParticipant: LocalParticipant; | |
name: string; | |
participants: Map<Participant.SID, RemoteParticipant>; | |
disconnect(): Room; | |
} | |
export interface RemoteParticipant extends Participant { | |
} | |
export interface LocalParticipant extends Participant { | |
tracks: Map<Track.ID, LocalVideoTrack>; | |
unpublishTrack: (track: LocalTrack | MediaStreamTrack) => LocalTrackPublication; | |
} | |
export interface LocalTrackPublication { | |
kind: Track.Kind; | |
track: LocalTrack; | |
trackName: string; | |
trackSid: Track.SID; | |
} | |
export interface Participant extends EventEmitter { | |
identity: Participant.Identity; | |
sid: Participant.SID; | |
tracks: Map<Track.ID, Track>; | |
} | |
export interface EventEmitter { | |
on: (eventName: string, callback: (params: any) => void) => void; | |
} | |
namespace Participant { | |
export type SID = string; | |
export type Identity = string; | |
} | |
export interface LocalAudioTrack extends Track { | |
stop(): void; | |
} | |
export interface LocalVideoTrack extends Track { | |
stop(): void; | |
} | |
export interface Track { | |
id: Track.ID; | |
kind: Track.Kind; | |
name: string; | |
} | |
namespace Track { | |
export type ID = string; | |
export type Kind = 'audio' | 'video' | 'data'; | |
export type SID = string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment