-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
52 lines (48 loc) · 1.57 KB
/
index.js
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
import { NativeModules } from 'react-native';
const { Vivox } = NativeModules;
if (!Vivox) {
Vivox = {
connect: () => Promise.resolve(),
login: () => Promise.resolve(),
joinChannel: () => Promise.resolve(),
leaveChannel: () => Promise.resolve(),
disconnect: () => Promise.resolve(),
getStateName: () => Promise.resolve('Invalid state, ios simulator'),
getState: () => Promise.resolve(0),
muteMyself: () => Promise.resolve(),
isMuted: () => Promise.resolve(false),
getSpeakingParticipants: () => Promise.resolve({}),
setParticipantMutedForMe: () => Promise.resolve(),
setAudioOutputDeviceMuted: () => Promise.resolve(),
setParticipantAudioOutputDeviceVolumeForMe: () => Promise.resolve(),
};
} else {
// Support deprecated methods
Vivox.joinChannel = (channelId: string, token: string) => Vivox.joinMatch(channelId, token);
Vivox.leaveChannel = () => Vivox.leaveMatch();
Vivox.login = (userId: string, token: string) => Vivox.setLoginCredentials(userId, token);
}
Vivox.State = {
stateUninitialized: 0,
stateThreadStarted: 1,
stateSDKInitializing: 2,
stateSDKInitFailed: 3,
stateSDKInitialized: 4,
stateSDKUninitializing: 5,
stateConnecting: 6,
stateConnectRetry: 7,
stateConnected: 8,
stateDisconnecting: 9,
stateLoggingIn: 10,
stateLoginRetry: 11,
stateInvalidLoginCredentials: 12,
stateLoggedIn: 13,
stateLoggingOut: 14,
stateHaveChannelID: 15,
stateJoiningChannel: 16,
stateJoinChannelRetry: 17,
stateInvalidChannelCredentials: 18,
stateInMatch: 19,
stateLeavingChannel: 20
}
export default Vivox;