forked from blackuy/react-native-twilio-video-webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
114 lines (95 loc) · 3.24 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
declare module "react-native-twilio-video-webrtc"{
import { ViewProps } from "react-native";
import React from "react";
interface TwilioVideoLocalViewProps extends ViewProps {
enabled: boolean;
ref?: React.Ref<any>;
}
interface TwilioVideoParticipantViewProps extends ViewProps {
trackIdentifier: {
participantSid: string;
videoTrackSid: string;
};
ref?: React.Ref<any>;
}
interface Participant {
sid: string;
identity: string;
}
interface Track {
enabled: boolean;
trackName: string;
trackSid: string;
}
export interface TrackEventCbArgs {
participant: Participant;
track: Track;
}
export type TrackEventCb = (t: TrackEventCbArgs) => void;
interface RoomEventCommonArgs {
roomName: string;
roomSid: string;
}
type RoomErrorEventArgs = RoomEventCommonArgs & {
error: any;
};
type RoomEventArgs = RoomEventCommonArgs & {
participants: Participant[];
};
type ParticipantEventArgs = RoomEventCommonArgs & {
participant: Participant;
};
export type RoomEventCb = (p: RoomEventArgs) => void;
export type RoomErrorEventCb = (t: RoomErrorEventArgs) => void;
export type ParticipantEventCb = (p: ParticipantEventArgs) => void;
type TwilioVideoProps = ViewProps & {
onCameraDidStart?: () => void;
onCameraDidStopRunning?: (err: any) => void;
onCameraWasInterrupted?: () => void;
onParticipantAddedAudioTrack?: TrackEventCb;
onParticipantAddedVideoTrack?: TrackEventCb;
onParticipantDisabledVideoTrack?: TrackEventCb;
onParticipantDisabledAudioTrack?: TrackEventCb;
onParticipantEnabledVideoTrack?: TrackEventCb;
onParticipantEnabledAudioTrack?: TrackEventCb;
onParticipantRemovedAudioTrack?: TrackEventCb;
onParticipantRemovedVideoTrack?: TrackEventCb;
onRoomDidConnect?: RoomEventCb;
onRoomDidDisconnect?: RoomErrorEventCb;
onRoomDidFailToConnect?: RoomErrorEventCb;
onRoomParticipantDidConnect?: ParticipantEventCb;
onRoomParticipantDidDisconnect?: ParticipantEventCb;
ref?: React.Ref<any>;
};
type iOSConnectParams = {
accessToken: string;
roomName?: string;
enableAudio?: boolean;
enableVideo?: boolean;
encodingParameters?: {
enableH264Codec?: boolean;
// if audioBitrate OR videoBitrate is provided, you must provide both
audioBitrate?: number;
videoBitrate?: number;
}
}
type androidConnectParams = {
roomName?: string;
accessToken: string;
enableAudio?: boolean;
enableVideo?: boolean;
enableRemoteAudio?: boolean;
}
class TwilioVideo extends React.Component<TwilioVideoProps> {
setLocalVideoEnabled: (enabled: boolean) => Promise<boolean>;
setLocalAudioEnabled: (enabled: boolean) => Promise<boolean>;
setBluetoothHeadsetConnected: (enabled: boolean) => Promise<boolean>;
connect: (options: iOSConnectParams | androidConnectParams) => void;
disconnect: () => void;
flipCamera: () => void;
toggleSoundSetup: (speaker: boolean) => void;
}
class TwilioVideoLocalView extends React.Component<TwilioVideoLocalViewProps> {}
class TwilioVideoParticipantView extends React.Component<TwilioVideoParticipantViewProps> {}
export { TwilioVideoLocalView, TwilioVideoParticipantView, TwilioVideo };
}