-
Notifications
You must be signed in to change notification settings - Fork 0
/
CRtc.ts
49 lines (43 loc) · 1.41 KB
/
CRtc.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
class CRtc {
private _audioEnabled: boolean = true;
private _videoEnabled: boolean = true;
private _mediaData: { SDP: number; profile: { [key: string]: any }; candidateList: Array<any> };
private _options: { [key: string]: any };
private _constraints: { offerToReceiveAudio: boolean; offerToReceiveVideo: boolean };
/**
* Create RTC
*/
constructor(options: { [key: string]: any }) {
this._options = {
verto: NaN,
useVideo: NaN,
useStereo: false,
userData: NaN,
localVideo: NaN,
screenShare: false,
useCamera: 'any',
iceServers: false,
videoParams: {},
audioParams: {},
callbacks: {
onICEComplete: () => {},
onICE: () => {},
onOfferSDP: () => {}
},
...options
};
this._mediaData = {
SDP: NaN,
profile: {},
candidateList: []
};
this._constraints = {
offerToReceiveAudio: this._options.useSpeak === 'none',
offerToReceiveVideo: Boolean(this._options.useVideo)
};
if (this._options.useVideo && typeof this._options.useVideo.style === 'object') {
this._options.useVideo.style.display = 'none';
}
}
}
export { CRtc };