/
HMSLocalVideoTrack.ts
65 lines (60 loc) · 1.52 KB
/
HMSLocalVideoTrack.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
import { NativeModules } from 'react-native';
import { HMSVideoTrack } from './HMSVideoTrack';
import { getLogger } from './HMSLogger';
import type { HMSVideoTrackSettings } from './HMSVideoTrackSettings';
import type { HMSTrackType } from './HMSTrackType';
import type { HMSTrackSource } from './HMSTrackSource';
const {
/**
* @ignore
*/
HMSManager,
} = NativeModules;
export class HMSLocalVideoTrack extends HMSVideoTrack {
settings?: HMSVideoTrackSettings;
id: string;
/**
* switches camera between front/back
*
* @memberof HMSSDK
*/
switchCamera = () => {
const logger = getLogger();
logger?.verbose('#Function switchCamera', {
trackId: this.trackId,
source: this.source,
type: this.type,
id: this.id,
});
HMSManager.switchCamera({ id: this.id });
};
/**
* Switches local video feed on/off depending upon the value of isMute
*
* @param {boolean} isMute
* @memberof HMSLocalVideoTrack
*/
setMute(isMute: boolean) {
const logger = getLogger();
logger?.verbose('#Function setMute', {
trackId: this.trackId,
source: this.source,
type: this.type,
id: this.id,
});
HMSManager.setLocalVideoMute({ isMute, id: this.id });
}
constructor(params: {
id: string;
trackId: string;
source?: HMSTrackSource;
trackDescription?: string;
isMute?: boolean;
settings?: HMSVideoTrackSettings;
type?: HMSTrackType;
}) {
super(params);
this.settings = params.settings;
this.id = params.id;
}
}