-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSDK.js
More file actions
84 lines (69 loc) · 1.99 KB
/
SDK.js
File metadata and controls
84 lines (69 loc) · 1.99 KB
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
import { NativeModules } from "react-native";
import { EventHandlingHelper } from "react-native-common-utils";
const sdk = NativeModules.SkylinkSDK;
export default class SDK {
static skylinkConfig = sdk.skylinkConfig;
static skylinkState = sdk.skylinkState;
static async init(appKey, config) {
[
["audioAutoGainControl", true],
["audioEchoCancellation", true],
["audioHighPassFilter", true],
["audioNoiseSuppression", true],
["audioStereo", true],
["enableLogs", __DEV__],
["hasDataTransfer", false],
["hasFileTransfer", false],
["hasPeerMessaging", false],
].forEach(data => !config.hasOwnProperty(
data[0]) && (config[data[0]] = data[1]));
await sdk.init(appKey, config);
}
static getCaptureFormats(videoDevice) {
return sdk.getCaptureFormats(videoDevice);
}
static getSkylinkState() {
return sdk.getSkylinkState();
}
static async isConnected() {
return (await SDK.getSkylinkState()) == SDK.skylinkState.CONNECTED;
}
/*
params = {
secret: String,
roomName: String,
connectionString: String,
userData: String | [] | {}
}
*/
static async connectToRoom(params) {
await sdk.connectToRoom(params);
}
static async prepareVideoView(peerId) {
await sdk.prepareVideoView(peerId);
}
static switchCamera() {
sdk.switchCamera();
}
static async startRecording() {
await sdk.startRecording();
}
static async stopRecording() {
await sdk.stopRecording();
}
/*
remotePeerId: String | null,
message: String | [] | {}
*/
static async sendP2PMessage(remotePeerId, message) {
await sdk.sendP2PMessage({remotePeerId, message});
}
static async disconnectFromRoom() {
await sdk.disconnectFromRoom();
}
}
new EventHandlingHelper({
object: SDK,
nativeModule: sdk,
exportRemove: true
});