@100mslive/react-native-hms 1.10.8 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +27 -3
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +34 -3
- package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +3 -1
- package/ios/HMSRNSDK.swift +13 -8
- package/lib/commonjs/classes/HMSAudioDevice.js +9 -0
- package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixingMode.js +11 -0
- package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrack.js +9 -0
- package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSCameraFacing.js +9 -0
- package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
- package/lib/commonjs/classes/HMSConfig.js +27 -0
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSException.js +18 -0
- package/lib/commonjs/classes/HMSException.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSTimedMetadata.js.map +1 -1
- package/lib/commonjs/classes/HMSIOSAudioMode.js +15 -0
- package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -1
- package/lib/commonjs/classes/HMSLogAlarmManager.js +12 -0
- package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/commonjs/classes/HMSLogLevel.js +12 -0
- package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
- package/lib/commonjs/classes/HMSLogSettings.js +14 -0
- package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSNetworkQuality.js +11 -0
- package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/commonjs/classes/HMSNoiseCancellationPlugin.js +40 -10
- package/lib/commonjs/classes/HMSNoiseCancellationPlugin.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPListenerActions.js +9 -0
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +148 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerType.js +12 -1
- package/lib/commonjs/classes/HMSPeerType.js.map +1 -1
- package/lib/commonjs/classes/HMSRTMPConfig.js +14 -0
- package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSRole.js +17 -0
- package/lib/commonjs/classes/HMSRole.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpVideoResolution.js +13 -0
- package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +1126 -248
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSSessionStore.js +14 -15
- package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
- package/lib/commonjs/classes/HMSTrack.js +13 -0
- package/lib/commonjs/classes/HMSTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettings.js +10 -0
- package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js +9 -0
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSource.js +10 -0
- package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackType.js +7 -0
- package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +42 -3
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrack.js +17 -0
- package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js +12 -2
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +42 -0
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/module/classes/HMSAudioDevice.js +9 -0
- package/lib/module/classes/HMSAudioDevice.js.map +1 -1
- package/lib/module/classes/HMSAudioMixingMode.js +11 -0
- package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/module/classes/HMSAudioTrack.js +9 -0
- package/lib/module/classes/HMSAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSCameraFacing.js +9 -0
- package/lib/module/classes/HMSCameraFacing.js.map +1 -1
- package/lib/module/classes/HMSConfig.js +27 -0
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSException.js +18 -0
- package/lib/module/classes/HMSException.js.map +1 -1
- package/lib/module/classes/HMSHLSTimedMetadata.js.map +1 -1
- package/lib/module/classes/HMSIOSAudioMode.js +15 -0
- package/lib/module/classes/HMSIOSAudioMode.js.map +1 -1
- package/lib/module/classes/HMSLogAlarmManager.js +12 -0
- package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/module/classes/HMSLogLevel.js +12 -0
- package/lib/module/classes/HMSLogLevel.js.map +1 -1
- package/lib/module/classes/HMSLogSettings.js +14 -0
- package/lib/module/classes/HMSLogSettings.js.map +1 -1
- package/lib/module/classes/HMSNetworkQuality.js +11 -0
- package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/module/classes/HMSNoiseCancellationPlugin.js +40 -10
- package/lib/module/classes/HMSNoiseCancellationPlugin.js.map +1 -1
- package/lib/module/classes/HMSPIPConfig.js.map +1 -1
- package/lib/module/classes/HMSPIPListenerActions.js +9 -0
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +149 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerType.js +12 -1
- package/lib/module/classes/HMSPeerType.js.map +1 -1
- package/lib/module/classes/HMSRTMPConfig.js +14 -0
- package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/module/classes/HMSRole.js +17 -0
- package/lib/module/classes/HMSRole.js.map +1 -1
- package/lib/module/classes/HMSRtmpVideoResolution.js +13 -0
- package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +1126 -248
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSSessionStore.js +14 -15
- package/lib/module/classes/HMSSessionStore.js.map +1 -1
- package/lib/module/classes/HMSTrack.js +13 -0
- package/lib/module/classes/HMSTrack.js.map +1 -1
- package/lib/module/classes/HMSTrackSettings.js +10 -0
- package/lib/module/classes/HMSTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSTrackSettingsInitState.js +9 -0
- package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/module/classes/HMSTrackSource.js +10 -0
- package/lib/module/classes/HMSTrackSource.js.map +1 -1
- package/lib/module/classes/HMSTrackType.js +7 -0
- package/lib/module/classes/HMSTrackType.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +42 -3
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HMSVideoTrack.js +17 -0
- package/lib/module/classes/HMSVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js +12 -2
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HmsView.js +43 -0
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/typescript/classes/HMSAudioDevice.d.ts +14 -0
- package/lib/typescript/classes/HMSAudioMixingMode.d.ts +11 -0
- package/lib/typescript/classes/HMSAudioTrack.d.ts +9 -0
- package/lib/typescript/classes/HMSCameraFacing.d.ts +11 -0
- package/lib/typescript/classes/HMSConfig.d.ts +27 -0
- package/lib/typescript/classes/HMSException.d.ts +18 -0
- package/lib/typescript/classes/HMSHLSTimedMetadata.d.ts +12 -0
- package/lib/typescript/classes/HMSIOSAudioMode.d.ts +15 -0
- package/lib/typescript/classes/HMSLogAlarmManager.d.ts +12 -0
- package/lib/typescript/classes/HMSLogLevel.d.ts +12 -0
- package/lib/typescript/classes/HMSLogSettings.d.ts +14 -0
- package/lib/typescript/classes/HMSNetworkQuality.d.ts +11 -0
- package/lib/typescript/classes/HMSNoiseCancellationPlugin.d.ts +36 -6
- package/lib/typescript/classes/HMSPIPConfig.d.ts +37 -0
- package/lib/typescript/classes/HMSPIPListenerActions.d.ts +17 -0
- package/lib/typescript/classes/HMSPeer.d.ts +137 -0
- package/lib/typescript/classes/HMSPeerType.d.ts +11 -0
- package/lib/typescript/classes/HMSRTMPConfig.d.ts +14 -0
- package/lib/typescript/classes/HMSRole.d.ts +17 -0
- package/lib/typescript/classes/HMSRtmpVideoResolution.d.ts +13 -0
- package/lib/typescript/classes/HMSSDK.d.ts +1080 -235
- package/lib/typescript/classes/HMSSessionStore.d.ts +14 -15
- package/lib/typescript/classes/HMSTrack.d.ts +13 -0
- package/lib/typescript/classes/HMSTrackSettings.d.ts +10 -0
- package/lib/typescript/classes/HMSTrackSettingsInitState.d.ts +11 -0
- package/lib/typescript/classes/HMSTrackSource.d.ts +10 -0
- package/lib/typescript/classes/HMSTrackType.d.ts +7 -0
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +290 -4
- package/lib/typescript/classes/HMSVideoTrack.d.ts +17 -0
- package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +12 -2
- package/lib/typescript/classes/HmsView.d.ts +16 -0
- package/package.json +1 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSAudioDevice.ts +18 -0
- package/src/classes/HMSAudioMixingMode.ts +11 -0
- package/src/classes/HMSAudioTrack.ts +9 -0
- package/src/classes/HMSCameraFacing.ts +11 -0
- package/src/classes/HMSConfig.ts +27 -0
- package/src/classes/HMSException.ts +18 -0
- package/src/classes/HMSHLSTimedMetadata.ts +12 -0
- package/src/classes/HMSIOSAudioMode.ts +15 -0
- package/src/classes/HMSLogAlarmManager.ts +12 -0
- package/src/classes/HMSLogLevel.ts +12 -0
- package/src/classes/HMSLogSettings.ts +14 -0
- package/src/classes/HMSNetworkQuality.ts +11 -0
- package/src/classes/HMSNoiseCancellationPlugin.ts +41 -10
- package/src/classes/HMSPIPConfig.ts +25 -8
- package/src/classes/HMSPIPListenerActions.ts +18 -0
- package/src/classes/HMSPeer.ts +137 -0
- package/src/classes/HMSPeerType.ts +13 -2
- package/src/classes/HMSRTMPConfig.ts +14 -0
- package/src/classes/HMSRole.ts +17 -0
- package/src/classes/HMSRtmpVideoResolution.ts +13 -0
- package/src/classes/HMSSDK.tsx +1182 -277
- package/src/classes/HMSSessionStore.ts +14 -15
- package/src/classes/HMSTrack.ts +13 -0
- package/src/classes/HMSTrackSettings.ts +10 -0
- package/src/classes/HMSTrackSettingsInitState.ts +11 -0
- package/src/classes/HMSTrackSource.ts +10 -0
- package/src/classes/HMSTrackType.ts +7 -0
- package/src/classes/HMSUpdateListenerActions.ts +312 -3
- package/src/classes/HMSVideoTrack.ts +17 -0
- package/src/classes/HMSVideoTrackSettings.ts +12 -2
- package/src/classes/HmsView.tsx +39 -0
|
@@ -26,6 +26,19 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
26
26
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
27
|
const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
|
|
28
28
|
let HmsSdk;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents the main SDK class for the 100ms (HMS) video conferencing service in a React Native application.
|
|
32
|
+
* This class provides methods to manage the video conferencing lifecycle including joining a room, leaving a room,
|
|
33
|
+
* managing streams, and handling events.
|
|
34
|
+
*
|
|
35
|
+
* @export
|
|
36
|
+
* @class HMSSDK
|
|
37
|
+
* @example
|
|
38
|
+
* const hmsInstance = await HMSSDK.build();
|
|
39
|
+
* await hmsInstance.join({ authToken: 'your_auth_token', username: 'John Appleseed' });
|
|
40
|
+
* @see https://www.100ms.live/docs/react-native/v2/quickstart/quickstart
|
|
41
|
+
*/
|
|
29
42
|
class HMSSDK {
|
|
30
43
|
constructor(id) {
|
|
31
44
|
_defineProperty(this, "id", void 0);
|
|
@@ -33,6 +46,7 @@ class HMSSDK {
|
|
|
33
46
|
_defineProperty(this, "appStateSubscription", void 0);
|
|
34
47
|
_defineProperty(this, "onPreviewDelegate", void 0);
|
|
35
48
|
_defineProperty(this, "onJoinDelegate", void 0);
|
|
49
|
+
_defineProperty(this, "onPermissionsRequestedDelegate", void 0);
|
|
36
50
|
_defineProperty(this, "onRoomDelegate", void 0);
|
|
37
51
|
_defineProperty(this, "onTranscriptsDelegate", void 0);
|
|
38
52
|
_defineProperty(this, "onPeerDelegate", void 0);
|
|
@@ -57,7 +71,20 @@ class HMSSDK {
|
|
|
57
71
|
_defineProperty(this, "onPIPModeChangedDelegate", void 0);
|
|
58
72
|
_defineProperty(this, "emitterSubscriptions", {});
|
|
59
73
|
/**
|
|
60
|
-
*
|
|
74
|
+
* Asynchronously destroys the HMSSDK instance.
|
|
75
|
+
*
|
|
76
|
+
* - This method performs a series of cleanup actions before destroying the HMSSDK instance.
|
|
77
|
+
* - It logs the destruction process, clears both the HMS peers and room caches, removes all event listeners to prevent memory leaks, and finally calls the native
|
|
78
|
+
* `destroy` method on the `HMSManager` with the instance's ID.
|
|
79
|
+
* - This is typically used to ensure that all resources are properly released when the HMSSDK instance is no longer needed, such as when a user leaves a room or the application is shutting down.
|
|
80
|
+
*
|
|
81
|
+
* @returns {Promise<void>} A promise that resolves when the destruction process has completed.
|
|
82
|
+
* @throws {Error} If the HMSSDK instance cannot be destroyed.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* await hmsInstance.destroy();
|
|
86
|
+
*
|
|
87
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/install-the-sdk/hmssdk
|
|
61
88
|
*
|
|
62
89
|
* @memberof HMSSDK
|
|
63
90
|
*/
|
|
@@ -73,10 +100,23 @@ class HMSSDK {
|
|
|
73
100
|
});
|
|
74
101
|
});
|
|
75
102
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
103
|
+
* Asynchronously retrieves an authentication token using the room code, user ID, and endpoint.
|
|
104
|
+
*
|
|
105
|
+
* This method is responsible for fetching an authentication token that is required to join a room in the HMS ecosystem.
|
|
106
|
+
* It makes a call to the HMSManager's `getAuthTokenByRoomCode` method, passing in the necessary parameters.
|
|
107
|
+
* The function logs the attempt and returns the token as a string.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} roomCode - The unique code of the room for which the token is being requested.
|
|
110
|
+
* @param {string} [userId] - Optional. The user ID of the participant requesting the token. This can be used for identifying the user in the backend.
|
|
111
|
+
* @param {string} [endpoint] - Optional. The endpoint URL to which the token request is sent. This can be used to specify a different authentication server if needed.
|
|
112
|
+
* @returns {Promise<string>} A promise that resolves to the authentication token as a string.
|
|
113
|
+
* @throws {Error} If the authentication token cannot be retrieved.
|
|
114
|
+
* @example
|
|
115
|
+
* const authToken = await hmsInstance.getAuthTokenByRoomCode('room-code');
|
|
116
|
+
*
|
|
117
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/get-methods#getauthtokenbyroomcode
|
|
118
|
+
* @async
|
|
119
|
+
* @function getAuthTokenByRoomCode
|
|
80
120
|
* @memberof HMSSDK
|
|
81
121
|
*/
|
|
82
122
|
_defineProperty(this, "getAuthTokenByRoomCode", async (roomCode, userId, endpoint) => {
|
|
@@ -94,12 +134,23 @@ class HMSSDK {
|
|
|
94
134
|
});
|
|
95
135
|
});
|
|
96
136
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
137
|
+
* Asynchronously joins a room with the provided configuration
|
|
138
|
+
*
|
|
139
|
+
* This method is responsible for initiating the process of joining a room in the HMS ecosystem. It performs several key actions:
|
|
140
|
+
* - Logs the attempt to join with the provided configuration and instance ID.
|
|
141
|
+
* - Initializes the peers and room caches for the current session.
|
|
142
|
+
* - Calls the `join` method on the `HMSManager` with the provided configuration and the instance ID.
|
|
99
143
|
*
|
|
100
|
-
*
|
|
144
|
+
* @param {HMSConfig} config - The configuration object required to join a room. This includes credentials, room details, and user information.
|
|
145
|
+
* @returns {Promise<void>} A promise that resolves when the join operation has been successfully initiated.
|
|
146
|
+
* @throws {Error} If the join operation cannot be completed.
|
|
101
147
|
*
|
|
102
|
-
* @
|
|
148
|
+
* @example
|
|
149
|
+
* await hmsInstance.join(hmsConfig);
|
|
150
|
+
*
|
|
151
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/join
|
|
152
|
+
* @async
|
|
153
|
+
* @function join
|
|
103
154
|
* @memberof HMSSDK
|
|
104
155
|
*/
|
|
105
156
|
_defineProperty(this, "join", async config => {
|
|
@@ -115,32 +166,61 @@ class HMSSDK {
|
|
|
115
166
|
});
|
|
116
167
|
});
|
|
117
168
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
169
|
+
* Initiates a preview for the local peer.
|
|
170
|
+
*
|
|
171
|
+
* This function triggers the preview process for the local peer, allowing the application to display
|
|
172
|
+
* preview tracks (e.g., video or audio tracks) before joining a room. The response from the previewListener
|
|
173
|
+
* will contain the preview tracks for the local peer, which can be used to render a preview UI.
|
|
174
|
+
*
|
|
175
|
+
* @param {HMSConfig} config - The configuration object required for previewing, including credentials and user details.
|
|
176
|
+
* @example
|
|
177
|
+
* // Example usage of the preview function
|
|
178
|
+
* const previewConfig = {
|
|
179
|
+
* authToken: "your_auth_token",
|
|
180
|
+
* userName: "John Doe",
|
|
181
|
+
* roomCode: "your_room_code"
|
|
182
|
+
* };
|
|
183
|
+
* hmsInstance.preview(previewConfig);
|
|
184
|
+
*
|
|
185
|
+
* @see https://www.100ms.live/docs/react-native/v2/features/preview
|
|
186
|
+
*
|
|
187
|
+
* @async
|
|
188
|
+
* @function preview
|
|
124
189
|
* @memberof HMSSDK
|
|
125
190
|
*/
|
|
126
|
-
_defineProperty(this, "preview", config => {
|
|
191
|
+
_defineProperty(this, "preview", async config => {
|
|
127
192
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function preview', {
|
|
128
193
|
config,
|
|
129
194
|
id: this.id
|
|
130
195
|
});
|
|
131
|
-
_HMSManagerModule.default.preview({
|
|
196
|
+
await _HMSManagerModule.default.preview({
|
|
132
197
|
...config,
|
|
133
198
|
id: this.id
|
|
134
199
|
});
|
|
135
200
|
});
|
|
136
201
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
202
|
+
* `HmsView` is a React component that renders a video track within a view.
|
|
203
|
+
*
|
|
204
|
+
* It utilizes the `HmsViewComponent` to display the media track specified by the `trackId`.
|
|
205
|
+
* This component is designed to be used with React's `forwardRef` to allow for ref forwarding,
|
|
206
|
+
* enabling direct interaction with the DOM element.
|
|
207
|
+
*
|
|
208
|
+
* Props:
|
|
209
|
+
* - `trackId`: The unique identifier for the track to be displayed.
|
|
210
|
+
* - `style`: Custom styles to apply to the view.
|
|
211
|
+
* - `mirror`: If true, the video will be mirrored; commonly used for local video tracks.
|
|
212
|
+
* - `scaleType`: Determines how the video fits within the bounds of the view (e.g., aspect fill, aspect fit).
|
|
213
|
+
* - `setZOrderMediaOverlay`: When true, the video view will be rendered above the regular view hierarchy.
|
|
214
|
+
* - `autoSimulcast`: Enables automatic simulcast layer switching based on network conditions (if supported).
|
|
215
|
+
*
|
|
216
|
+
* @param {Object} props - The properties passed to the HmsView component.
|
|
217
|
+
* @param {React.Ref} ref - A ref provided by `forwardRef` for accessing the underlying DOM element.
|
|
218
|
+
* @returns {React.Element} A `HmsViewComponent` element configured with the provided props and ref.
|
|
219
|
+
* @memberof HMSSDK
|
|
220
|
+
* @example
|
|
221
|
+
* <HmsView trackId="track-id" style={{ width: 100, height: 100 }} mirror={true} scaleType="aspectFill" />
|
|
142
222
|
*
|
|
143
|
-
*
|
|
223
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/overview
|
|
144
224
|
*
|
|
145
225
|
* @param {HmsViewProps}
|
|
146
226
|
* @memberof HMSSDK
|
|
@@ -173,10 +253,23 @@ class HMSSDK {
|
|
|
173
253
|
_HMSEncoder.HMSEncoder.clearData(); // Clearing cached data in encoder
|
|
174
254
|
});
|
|
175
255
|
/**
|
|
176
|
-
*
|
|
256
|
+
* Asynchronously leaves the current room and performs cleanup.
|
|
257
|
+
*
|
|
258
|
+
* This method triggers the leave process for the current user, effectively disconnecting them from the room they are in.
|
|
259
|
+
* It logs the leave action with the user's ID, calls the native `leave` method in `HMSManager` with the user's ID,
|
|
260
|
+
* and then performs additional cleanup through `roomLeaveCleanup`. This cleanup includes removing app state subscriptions
|
|
261
|
+
* and clearing cached data related to peers and the room.
|
|
262
|
+
*
|
|
263
|
+
* @returns {Promise<boolean>} A promise that resolves to `true` if the user has successfully left the room, or `false` otherwise.
|
|
264
|
+
* @throws {Error} If the user cannot leave the room.
|
|
265
|
+
* @memberof HMSSDK
|
|
266
|
+
* @example
|
|
267
|
+
* await hmsInstance.leave();
|
|
177
268
|
*
|
|
178
|
-
*
|
|
269
|
+
* @see https://www.100ms.live/docs/react-native/v2/features/leave
|
|
179
270
|
*
|
|
271
|
+
* @async
|
|
272
|
+
* @function leave
|
|
180
273
|
* @memberof HMSSDK
|
|
181
274
|
*/
|
|
182
275
|
_defineProperty(this, "leave", async () => {
|
|
@@ -191,13 +284,28 @@ class HMSSDK {
|
|
|
191
284
|
return op;
|
|
192
285
|
});
|
|
193
286
|
/**
|
|
194
|
-
*
|
|
287
|
+
* Sends a broadcast message to all peers in the room.
|
|
195
288
|
*
|
|
196
|
-
*
|
|
289
|
+
* This asynchronous function sends a message to all peers in the room, which they can receive through the `onMessage` listener.
|
|
290
|
+
* It can be used to send chat messages or custom types of messages like emoji reactions or notifications.
|
|
197
291
|
*
|
|
292
|
+
* @param {string} message - The message to be sent to all peers.
|
|
293
|
+
* @param {string} [type='chat'] - The type of the message. Default is 'chat'. Custom types can be used for specific purposes.
|
|
294
|
+
* @returns {Promise<{messageId: string | undefined}>} A promise that resolves with the message ID of the sent message, or undefined if the message could not be sent.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* // Sending a chat message to all peers
|
|
298
|
+
* await hmsInstance.sendBroadcastMessage("Hello everyone!", "chat");
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* // Sending a custom notification to all peers
|
|
302
|
+
* await hmsInstance.sendBroadcastMessage("Meeting starts in 5 minutes", "notification");
|
|
303
|
+
*
|
|
304
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/chat
|
|
305
|
+
*
|
|
306
|
+
* @async
|
|
307
|
+
* @function sendBroadcastMessage
|
|
198
308
|
* @memberof HMSSDK
|
|
199
|
-
* @param message the message that is to be sent
|
|
200
|
-
* @param type the default type is set to CHAT. You can pass a custom type here for sending events like Emoji Reactions, Notifications, etc
|
|
201
309
|
*/
|
|
202
310
|
_defineProperty(this, "sendBroadcastMessage", async (message, type = 'chat') => {
|
|
203
311
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function sendBroadcastMessage', {
|
|
@@ -213,11 +321,25 @@ class HMSSDK {
|
|
|
213
321
|
return data;
|
|
214
322
|
});
|
|
215
323
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
324
|
+
* Sends a message to a specific set of roles within the room.
|
|
325
|
+
*
|
|
326
|
+
* This method allows for targeted communication by sending a message to peers who have any of the specified roles.
|
|
327
|
+
* The message is received by the peers through the `onMessage` listener. This can be useful for sending announcements,
|
|
328
|
+
* instructions, or other types of messages to a subset of the room based on their roles.
|
|
329
|
+
*
|
|
330
|
+
* @param {string} message - The message to be sent.
|
|
331
|
+
* @param {HMSRole[]} roles - An array of roles to which the message will be sent. Peers with these roles will receive the message.
|
|
332
|
+
* @param {string} [type='chat'] - The type of the message. Defaults to 'chat'. Custom types can be used for specific messaging scenarios.
|
|
333
|
+
* @returns {Promise<{messageId: string | undefined}>} A promise that resolves with an object containing the `messageId` of the sent message. If the message could not be sent, `messageId` will be `undefined`.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* // Sending a message to all peers with the role of 'moderator'
|
|
337
|
+
* await hmsInstance.sendGroupMessage("Please start the meeting.", [moderator]);
|
|
218
338
|
*
|
|
219
|
-
*
|
|
339
|
+
* @see https://www.100ms.live/docs/react-native/v2/features/chat
|
|
220
340
|
*
|
|
341
|
+
* @async
|
|
342
|
+
* @function sendGroupMessage
|
|
221
343
|
* @memberof HMSSDK
|
|
222
344
|
*/
|
|
223
345
|
_defineProperty(this, "sendGroupMessage", async (message, roles, type = 'chat') => {
|
|
@@ -236,11 +358,27 @@ class HMSSDK {
|
|
|
236
358
|
return data;
|
|
237
359
|
});
|
|
238
360
|
/**
|
|
239
|
-
*
|
|
240
|
-
* in onMessage Listener.
|
|
361
|
+
* Sends a direct message to a specific peer in the room.
|
|
241
362
|
*
|
|
242
|
-
*
|
|
363
|
+
* This method allows sending a private message to a single peer, ensuring that only the specified recipient can receive and view the message.
|
|
364
|
+
* The message is delivered to the recipient through the `onMessage` listener. This functionality is useful for implementing private chat features
|
|
365
|
+
* within a larger group chat context.
|
|
243
366
|
*
|
|
367
|
+
* @param {string} message - The message text to be sent.
|
|
368
|
+
* @param {HMSPeer} peer - The peer object representing the recipient of the message.
|
|
369
|
+
* @param {string} [type='chat'] - The type of the message being sent. Defaults to 'chat'. This can be customized to differentiate between various message types (e.g., 'private', 'system').
|
|
370
|
+
* @returns {Promise<{messageId: string | undefined}>} A promise that resolves with an object containing the `messageId` of the sent message. If the message could not be sent, `messageId` will be `undefined`.
|
|
371
|
+
* @throws {Error} Throws an error if the message could not be sent.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* // Sending a private chat message to a specific peer
|
|
375
|
+
* const peer = { peerID: 'peer123', ... };
|
|
376
|
+
* await hmsInstance.sendDirectMessage("Hello, this is a private message.", peer, "chat");
|
|
377
|
+
*
|
|
378
|
+
* @see https://www.100ms.live/docs/react-native/v2/features/chat
|
|
379
|
+
*
|
|
380
|
+
* @async
|
|
381
|
+
* @function sendDirectMessage
|
|
244
382
|
* @memberof HMSSDK
|
|
245
383
|
*/
|
|
246
384
|
_defineProperty(this, "sendDirectMessage", async (message, peer, type = 'chat') => {
|
|
@@ -259,15 +397,24 @@ class HMSSDK {
|
|
|
259
397
|
return data;
|
|
260
398
|
});
|
|
261
399
|
/**
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @
|
|
400
|
+
* Asynchronously changes the metadata for the local peer.
|
|
401
|
+
*
|
|
402
|
+
* This method updates the metadata field of the local peer in the room. The metadata is a versatile field that can be used
|
|
403
|
+
* to store various information such as the peer's current status (e.g., raising hand, be right back, etc.). It is recommended
|
|
404
|
+
* to use a JSON object in string format to store multiple data points within the metadata. This allows for a structured and
|
|
405
|
+
* easily parseable format for metadata management.
|
|
406
|
+
*
|
|
407
|
+
* @param {string} metadata - The new metadata in string format. It is advised to use a JSON string for structured data.
|
|
408
|
+
* @returns {Promise<void>} A promise that resolves when the metadata has been successfully changed.
|
|
409
|
+
* @throws {Error} Throws an error if the metadata change operation fails.
|
|
410
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-metadata
|
|
411
|
+
* @example
|
|
412
|
+
* // Changing metadata to indicate the peer is raising their hand
|
|
413
|
+
* const newMetadata = JSON.stringify({ status: 'raiseHand' });
|
|
414
|
+
* await hmsInstance.changeMetadata(newMetadata);
|
|
415
|
+
*
|
|
416
|
+
* @async
|
|
417
|
+
* @function changeMetadata
|
|
271
418
|
* @memberof HMSSDK
|
|
272
419
|
*/
|
|
273
420
|
_defineProperty(this, "changeMetadata", async metadata => {
|
|
@@ -281,12 +428,28 @@ class HMSSDK {
|
|
|
281
428
|
});
|
|
282
429
|
});
|
|
283
430
|
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
431
|
+
* Initiates RTMP streaming or recording based on the provided configuration.
|
|
432
|
+
*
|
|
433
|
+
* This method starts RTMP streaming or recording by taking a configuration object of type HMSRTMPConfig.
|
|
434
|
+
* The configuration specifies the URLs for streaming and whether recording should be enabled. The response to this
|
|
435
|
+
* operation can be observed in the `onRoomUpdate` event, specifically when the `RTMP_STREAMING_STATE_UPDATED` action is triggered.
|
|
436
|
+
*
|
|
437
|
+
* @param {HMSRTMPConfig} data - The configuration object for RTMP streaming or recording. It includes streaming URLs and recording settings.
|
|
438
|
+
* @returns {Promise<any>} A promise that resolves with the operation result when the streaming or recording starts successfully.
|
|
439
|
+
* @throws {Error} Throws an error if the operation fails or the configuration is invalid.
|
|
440
|
+
*
|
|
441
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/recording
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* const rtmpConfig = {
|
|
445
|
+
* meetingURL: "https://meet.example.com/myMeeting",
|
|
446
|
+
* rtmpURLs: ["rtmp://live.twitch.tv/app", "rtmp://a.rtmp.youtube.com/live2"],
|
|
447
|
+
* record: true,
|
|
448
|
+
* resolution: { width: 1280, height: 720 }
|
|
449
|
+
* };
|
|
450
|
+
* await hmsInstance.startRTMPOrRecording(rtmpConfig);
|
|
451
|
+
* @async
|
|
452
|
+
* @function startRTMPOrRecording
|
|
290
453
|
* @memberof HMSSDK
|
|
291
454
|
*/
|
|
292
455
|
_defineProperty(this, "startRTMPOrRecording", async data => {
|
|
@@ -301,12 +464,19 @@ class HMSSDK {
|
|
|
301
464
|
return op;
|
|
302
465
|
});
|
|
303
466
|
/**
|
|
304
|
-
*
|
|
305
|
-
* - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
|
|
467
|
+
* Stops all ongoing RTMP streaming and recording.
|
|
306
468
|
*
|
|
307
|
-
*
|
|
469
|
+
* This function is responsible for halting any active RTMP streaming or recording sessions.
|
|
470
|
+
* It communicates with the native `HMSManager` module to execute the stop operation.
|
|
471
|
+
* The completion or status of this operation can be monitored through the `onRoomUpdate` event, specifically when the `RTMP_STREAMING_STATE_UPDATED` action is triggered, indicating that the streaming or recording has been successfully stopped.
|
|
308
472
|
*
|
|
473
|
+
* @async
|
|
474
|
+
* @function stopRtmpAndRecording
|
|
475
|
+
* @returns {Promise<any>} A promise that resolves when the RTMP streaming and recording have been successfully stopped.
|
|
476
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/recording
|
|
309
477
|
* @memberof HMSSDK
|
|
478
|
+
* @example
|
|
479
|
+
* await hmsInstance.stopRtmpAndRecording();
|
|
310
480
|
*/
|
|
311
481
|
_defineProperty(this, "stopRtmpAndRecording", async () => {
|
|
312
482
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function stopRtmpAndRecording', {});
|
|
@@ -316,13 +486,21 @@ class HMSSDK {
|
|
|
316
486
|
return op;
|
|
317
487
|
});
|
|
318
488
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
489
|
+
* Initiates HLS (HTTP Live Streaming) based on the provided configuration.
|
|
490
|
+
*
|
|
491
|
+
* This asynchronous function starts HLS streaming, allowing for live video content to be delivered over the internet in a scalable manner.
|
|
492
|
+
* The function takes an optional `HMSHLSConfig` object as a parameter, which includes settings such as the meeting URL, HLS variant parameters, and recording settings.
|
|
493
|
+
* The operation's response can be observed through the `onRoomUpdate` event, specifically when the `HLS_STREAMING_STATE_UPDATED` action is triggered, indicating the streaming state has been updated.
|
|
494
|
+
*
|
|
495
|
+
* @param {HMSHLSConfig} [data] - Optional configuration object for HLS streaming. Defines parameters such as meeting URL, HLS variants, and recording options.
|
|
496
|
+
* @returns {Promise<any>} A promise that resolves when the HLS streaming starts successfully. The promise resolves with the operation result.
|
|
497
|
+
* @throws {Error} Throws an error if the operation fails or if the provided configuration is invalid.
|
|
498
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/hls
|
|
499
|
+
* @async
|
|
500
|
+
* @function startHLSStreaming
|
|
325
501
|
* @memberof HMSSDK
|
|
502
|
+
* @example
|
|
503
|
+
* await hmsInstance.startHLSStreaming();
|
|
326
504
|
*/
|
|
327
505
|
_defineProperty(this, "startHLSStreaming", async data => {
|
|
328
506
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function startHLSStreaming', {
|
|
@@ -335,12 +513,19 @@ class HMSSDK {
|
|
|
335
513
|
});
|
|
336
514
|
});
|
|
337
515
|
/**
|
|
338
|
-
*
|
|
339
|
-
* - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
|
|
516
|
+
* Stops the ongoing HLS (HTTP Live Streaming) streams.
|
|
340
517
|
*
|
|
341
|
-
*
|
|
518
|
+
* This asynchronous function is responsible for stopping any active HLS streaming sessions.
|
|
519
|
+
* It communicates with the native `HMSManager` module to execute the stop operation.
|
|
520
|
+
* The completion or status of this operation can be observed through the `onRoomUpdate` event, specifically when the `HLS_STREAMING_STATE_UPDATED` action is triggered, indicating that the HLS streaming has been successfully stopped.
|
|
342
521
|
*
|
|
522
|
+
* @async
|
|
523
|
+
* @function stopHLSStreaming
|
|
524
|
+
* @returns {Promise<void>} A promise that resolves when the HLS streaming has been successfully stopped.
|
|
525
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/hls for more details on HLS streaming.
|
|
343
526
|
* @memberof HMSSDK
|
|
527
|
+
* @example
|
|
528
|
+
* await hmsInstance.stopHLSStreaming();
|
|
344
529
|
*/
|
|
345
530
|
_defineProperty(this, "stopHLSStreaming", async () => {
|
|
346
531
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function stopHLSStreaming', {});
|
|
@@ -349,9 +534,25 @@ class HMSSDK {
|
|
|
349
534
|
});
|
|
350
535
|
});
|
|
351
536
|
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
537
|
+
* Sends timed metadata for HLS (HTTP Live Streaming) playback.
|
|
538
|
+
*
|
|
539
|
+
* This asynchronous function is designed to send metadata that can be synchronized with the HLS video playback.
|
|
540
|
+
* The metadata is sent to all viewers of the HLS stream, allowing for a variety of use cases such as displaying
|
|
541
|
+
* song titles, ads, or other information at specific times during the stream.
|
|
542
|
+
* The metadata should be an array of HMSHLSTimedMetadata objects, each specifying the content and timing for the metadata display.
|
|
543
|
+
*
|
|
544
|
+
* @async
|
|
545
|
+
* @function sendHLSTimedMetadata
|
|
546
|
+
* @param {HMSHLSTimedMetadata[]} metadata - An array of metadata objects to be sent.
|
|
547
|
+
* @returns {Promise<boolean>} A promise that resolves to `true` if the metadata was successfully sent, or `false` otherwise.
|
|
548
|
+
* @example
|
|
549
|
+
* const metadata = [
|
|
550
|
+
* { time: 10, data: "Song: Example Song Title" },
|
|
551
|
+
* { time: 20, data: "Advertisement: Buy Now!" }
|
|
552
|
+
* ];
|
|
553
|
+
* await hmsInstance.sendHLSTimedMetadata(metadata);
|
|
554
|
+
*
|
|
555
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/hls-player#how-to-use-hls-timed-metadata-with-100ms-hls-player
|
|
355
556
|
*/
|
|
356
557
|
_defineProperty(this, "sendHLSTimedMetadata", async metadata => {
|
|
357
558
|
const data = {
|
|
@@ -362,19 +563,26 @@ class HMSSDK {
|
|
|
362
563
|
return await _HMSManagerModule.default.sendHLSTimedMetadata(data);
|
|
363
564
|
});
|
|
364
565
|
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
* role
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
566
|
+
* Deprecated. Changes the role of a specified peer within the room.
|
|
567
|
+
*
|
|
568
|
+
* This function is marked as deprecated and should not be used in new implementations. Use `changeRoleOfPeer` instead.
|
|
569
|
+
* It allows for the dynamic adjustment of a peer's permissions and capabilities within the room by changing their role.
|
|
570
|
+
* The role change can be enforced immediately or offered to the peer as a request, depending on the `force` parameter.
|
|
571
|
+
*
|
|
572
|
+
* @deprecated Since version 1.1.0. Use `changeRoleOfPeer` instead.
|
|
573
|
+
* @param {HMSPeer} peer - The peer whose role is to be changed.
|
|
574
|
+
* @param {HMSRole} role - The new role to be assigned to the peer.
|
|
575
|
+
* @param {boolean} [force=false] - If `true`, the role change is applied immediately without the peer's consent. If `false`, the peer receives a role change request.
|
|
576
|
+
* @returns {Promise<void>} A promise that resolves when the role change operation is complete.
|
|
577
|
+
* @throws {Error} Throws an error if the operation fails.
|
|
578
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role
|
|
579
|
+
* @example
|
|
580
|
+
* // Change the role of a peer to 'viewer' forcefully
|
|
581
|
+
* const peer = { peerID: 'peer123', ... };
|
|
582
|
+
* const newRole = { name: 'viewer', ... };
|
|
583
|
+
* await hmsInstance.changeRole(peer, newRole, true);
|
|
584
|
+
* @async
|
|
585
|
+
* @function changeRole
|
|
378
586
|
* @memberof HMSSDK
|
|
379
587
|
*/
|
|
380
588
|
_defineProperty(this, "changeRole", async (peer, role, force = false) => {
|
|
@@ -388,17 +596,29 @@ class HMSSDK {
|
|
|
388
596
|
return await _HMSManagerModule.default.changeRole(data);
|
|
389
597
|
});
|
|
390
598
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* the role or
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
599
|
+
* Asynchronously changes the role of a specified peer within the room.
|
|
600
|
+
*
|
|
601
|
+
* This function is designed to dynamically adjust a peer's permissions and capabilities within the room by changing their role.
|
|
602
|
+
* It can enforce the role change immediately or offer it to the peer as a request, depending on the `force` parameter.
|
|
603
|
+
* If the role change is forced, it is applied immediately without the peer's consent. Otherwise, the peer receives a role change request,
|
|
604
|
+
* which can be accepted or declined. This functionality supports flexible room management and control over participant permissions.
|
|
605
|
+
*
|
|
606
|
+
* @async
|
|
607
|
+
* @function changeRoleOfPeer
|
|
608
|
+
* @param {HMSPeer} peer - The peer whose role is to be changed.
|
|
609
|
+
* @param {HMSRole} role - The new role to be assigned to the peer.
|
|
610
|
+
* @param {boolean} [force=false] - Determines whether the role change should be applied immediately (`true`) or sent as a request (`false`).
|
|
611
|
+
* @returns {Promise<void>} A promise that resolves to `true` if the role change operation is successful, or `false` otherwise.
|
|
612
|
+
* @throws {Error} Throws an error if the operation fails.
|
|
613
|
+
* @see https://www.100ms.live/docs/react-native/v2/features/change-role
|
|
614
|
+
* @example
|
|
615
|
+
* // Change the role of a peer to 'viewer' forcefully
|
|
616
|
+
* const peer = { peerID: 'peer123', ... };
|
|
617
|
+
* const newRole = { name: 'viewer', ... };
|
|
618
|
+
* await hmsInstance.changeRoleOfPeer(peer, newRole, true);
|
|
619
|
+
*
|
|
620
|
+
* @async
|
|
621
|
+
* @function changeRoleOfPeer
|
|
402
622
|
* @memberof HMSSDK
|
|
403
623
|
*/
|
|
404
624
|
_defineProperty(this, "changeRoleOfPeer", async (peer, role, force = false) => {
|
|
@@ -412,15 +632,25 @@ class HMSSDK {
|
|
|
412
632
|
return _HMSManagerModule.default.changeRoleOfPeer(data);
|
|
413
633
|
});
|
|
414
634
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
635
|
+
* Asynchronously changes the roles of multiple peers within the room.
|
|
636
|
+
*
|
|
637
|
+
* This function is designed to batch update the roles of peers based on their current roles. It is particularly useful
|
|
638
|
+
* in scenarios where a group of users need to be granted or restricted permissions en masse, such as promoting all viewers
|
|
639
|
+
* to participants or demoting all speakers to viewers. The function updates the roles of all peers that have any of the specified
|
|
640
|
+
* `ofRoles` to the new `toRole` without requiring individual consent, bypassing the `roleChangeRequest` listener on the peer's end.
|
|
641
|
+
*
|
|
642
|
+
* @async
|
|
643
|
+
* @function changeRoleOfPeersWithRoles
|
|
644
|
+
* @param {HMSRole[]} ofRoles - An array of roles to identify the peers whose roles are to be changed.
|
|
645
|
+
* @param {HMSRole} toRole - The new role to be assigned to the identified peers.
|
|
646
|
+
* @returns {Promise<void>} A promise that resolves when the role change operation is complete.
|
|
647
|
+
* @throws {Error} Throws an error if the operation fails.
|
|
648
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role
|
|
649
|
+
* @example
|
|
650
|
+
* // Change the role of all peers with 'viewer' role to 'participant'
|
|
651
|
+
* const viewerRole = { name: 'viewer', ... };
|
|
652
|
+
* const participantRole = { name: 'participant', ... };
|
|
653
|
+
* await hmsInstance.changeRoleOfPeersWithRoles([viewerRole], participantRole);
|
|
424
654
|
*
|
|
425
655
|
* @memberof HMSSDK
|
|
426
656
|
*/
|
|
@@ -434,13 +664,33 @@ class HMSSDK {
|
|
|
434
664
|
return _HMSManagerModule.default.changeRoleOfPeersWithRoles(data);
|
|
435
665
|
});
|
|
436
666
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
667
|
+
* Asynchronously changes the mute state of a specified track.
|
|
668
|
+
*
|
|
669
|
+
* This function is designed to control the mute state of any track (audio or video) within the room.
|
|
670
|
+
* When invoked, it sends a request to the HMSManager to change the mute state of the specified track.
|
|
671
|
+
* The targeted peer, whose track is being manipulated, will receive a callback on the `onChangeTrackStateRequestListener`,
|
|
672
|
+
* allowing for custom handling or UI updates based on the mute state change.
|
|
673
|
+
*
|
|
674
|
+
* @async
|
|
675
|
+
* @function changeTrackState
|
|
676
|
+
* @param {HMSTrack} track - The track object whose mute state is to be changed.
|
|
677
|
+
* @param {boolean} mute - The desired mute state of the track. `true` to mute the track, `false` to unmute.
|
|
678
|
+
* @returns {Promise<void>} A promise that resolves when the operation to change the track's mute state is complete.
|
|
679
|
+
* @throws {Error} Throws an error if the operation fails or the track cannot be found.
|
|
680
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/remote-mute
|
|
681
|
+
* @async
|
|
682
|
+
* @function changeTrackState
|
|
683
|
+
* @memberof HMSSDK
|
|
439
684
|
*
|
|
440
|
-
*
|
|
685
|
+
* @example
|
|
686
|
+
* // Mute a specific track
|
|
687
|
+
* const trackToMute = { trackId: 'track123', ... };
|
|
688
|
+
* await hmsInstance.changeTrackState(trackToMute, true);
|
|
441
689
|
*
|
|
442
|
-
* @
|
|
443
|
-
*
|
|
690
|
+
* @example
|
|
691
|
+
* // Unmute a specific track
|
|
692
|
+
* const trackToUnmute = { trackId: 'track456', ... };
|
|
693
|
+
* await hmsInstance.changeTrackState(trackToUnmute, false);
|
|
444
694
|
*/
|
|
445
695
|
_defineProperty(this, "changeTrackState", async (track, mute) => {
|
|
446
696
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function changeTrackState', {
|
|
@@ -456,12 +706,30 @@ class HMSSDK {
|
|
|
456
706
|
return await _HMSManagerModule.default.changeTrackState(data);
|
|
457
707
|
});
|
|
458
708
|
/**
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
709
|
+
* Asynchronously changes the mute state of tracks for peers with specified roles.
|
|
710
|
+
*
|
|
711
|
+
* This method extends the functionality of `changeTrackState` by allowing the mute state of all tracks (audio, video, etc.)
|
|
712
|
+
* belonging to peers with certain roles to be changed in a single operation. It is particularly useful for managing the audio
|
|
713
|
+
* and video state of groups of users, such as muting all participants except the speaker in a conference call.
|
|
714
|
+
*
|
|
715
|
+
* The peers whose track states are being changed will receive a callback on `onChangeTrackStateRequestListener`, allowing for
|
|
716
|
+
* custom handling or UI updates based on the mute state change.
|
|
717
|
+
*
|
|
718
|
+
* @async
|
|
719
|
+
* @function changeTrackStateForRoles
|
|
720
|
+
* @param {boolean} mute - The desired mute state of the tracks. `true` to mute, `false` to unmute.
|
|
721
|
+
* @param {HMSTrackType} [type] - Optional. The type of the tracks to be muted/unmuted (e.g., audio, video).
|
|
722
|
+
* @param {string} [source] - Optional. The source of the track (e.g., camera, screen).
|
|
723
|
+
* @param {Array<HMSRole>} [roles] - The roles of the peers whose tracks are to be muted/unmuted. If not specified, affects all roles.
|
|
724
|
+
* @returns {Promise<void>} A promise that resolves when the operation to change the track's mute state is complete.
|
|
725
|
+
* @throws {Error} Throws an error if the operation fails.
|
|
726
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/change-track-state-roles
|
|
464
727
|
* @memberof HMSSDK
|
|
728
|
+
*
|
|
729
|
+
* @example
|
|
730
|
+
* // Mute all audio tracks for peers with the role of 'viewer'
|
|
731
|
+
* const viewerRole = { name: 'viewer', ... };
|
|
732
|
+
* await hmsInstance.changeTrackStateForRoles(true, 'audio', undefined, [viewerRole]);
|
|
465
733
|
*/
|
|
466
734
|
_defineProperty(this, "changeTrackStateForRoles", async (mute, type, source, roles) => {
|
|
467
735
|
let roleNames = null;
|
|
@@ -485,11 +753,27 @@ class HMSSDK {
|
|
|
485
753
|
return await _HMSManagerModule.default.changeTrackStateForRoles(data);
|
|
486
754
|
});
|
|
487
755
|
/**
|
|
488
|
-
*
|
|
489
|
-
*
|
|
756
|
+
* Asynchronously removes a peer from the room.
|
|
757
|
+
*
|
|
758
|
+
* This method forcefully disconnects a specified peer from the room.
|
|
759
|
+
* Upon successful removal, the removed peer will receive a callback through the `onRemovedFromRoomListener`, indicating
|
|
760
|
+
* they have been removed from the room.
|
|
761
|
+
* This can be used for managing room participants, such as removing disruptive users or managing room capacity.
|
|
762
|
+
*
|
|
763
|
+
* @param {HMSPeer} peer - The peer object representing the participant to be removed.
|
|
764
|
+
* @param {string} reason - A string detailing the reason for the removal. This reason is communicated
|
|
765
|
+
* to the removed peer, providing context for the action.
|
|
766
|
+
* @returns {Promise<void>} A promise that resolves when the peer has been successfully removed.
|
|
767
|
+
* If the operation fails, the promise will reject with an error.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* // Assuming `peer` is an instance of HMSPeer representing the participant to remove
|
|
771
|
+
* await hmsInstance.removePeer(peer, "Violation of room rules");
|
|
490
772
|
*
|
|
491
|
-
*
|
|
773
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/remove-peer
|
|
492
774
|
*
|
|
775
|
+
* @async
|
|
776
|
+
* @function removePeer
|
|
493
777
|
* @memberof HMSSDK
|
|
494
778
|
*/
|
|
495
779
|
_defineProperty(this, "removePeer", async (peer, reason) => {
|
|
@@ -506,12 +790,25 @@ class HMSSDK {
|
|
|
506
790
|
return await _HMSManagerModule.default.removePeer(data);
|
|
507
791
|
});
|
|
508
792
|
/**
|
|
509
|
-
*
|
|
510
|
-
* and end the call.
|
|
511
|
-
* - everyone in the room will get an update of this action in {@link onRemovedFromRoomListener}.
|
|
793
|
+
* Asynchronously ends the current room session for all participants.
|
|
512
794
|
*
|
|
513
|
-
*
|
|
795
|
+
* This method is used to programmatically end the current room session, effectively disconnecting all participants.
|
|
796
|
+
* It can also optionally lock the room to prevent new participants from joining. This is particularly useful for
|
|
797
|
+
* managing the end of scheduled events or meetings, ensuring that all participants are removed at the same time.
|
|
798
|
+
* Upon successful execution, all participants will receive a notification through the `onRemovedFromRoomListener`
|
|
799
|
+
* indicating that they have been removed from the room.
|
|
514
800
|
*
|
|
801
|
+
* @param {string} reason - A descriptive reason for ending the room session. This reason is communicated to all participants.
|
|
802
|
+
* @param {boolean} [lock=false] - Optional. Specifies whether the room should be locked after ending the session. Default is `false`.
|
|
803
|
+
* @returns {Promise<void>} A promise that resolves when the room has been successfully ended and, optionally, locked.
|
|
804
|
+
*
|
|
805
|
+
* @example
|
|
806
|
+
* // End the room and lock it to prevent rejoining
|
|
807
|
+
* await hmsInstance.endRoom("Meeting concluded", true);
|
|
808
|
+
*
|
|
809
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/room/end-room
|
|
810
|
+
* @async
|
|
811
|
+
* @function endRoom
|
|
515
812
|
* @memberof HMSSDK
|
|
516
813
|
*/
|
|
517
814
|
_defineProperty(this, "endRoom", async (reason, lock = false) => {
|
|
@@ -528,11 +825,23 @@ class HMSSDK {
|
|
|
528
825
|
return await _HMSManagerModule.default.endRoom(data);
|
|
529
826
|
});
|
|
530
827
|
/**
|
|
531
|
-
*
|
|
828
|
+
* Asynchronously changes the name of the local peer.
|
|
829
|
+
*
|
|
830
|
+
* This function updates the name of the local peer in the room. It is useful for scenarios where a user's display name needs to be updated during a session, such as when a user decides to change their nickname or when correcting a typo in the user's name. The updated name is reflected across all participants in the room.
|
|
532
831
|
*
|
|
533
|
-
*
|
|
832
|
+
* Once the name change is successful, all the peers receive HMSUpdateListenerActions.ON_PEER_UPDATE event with HMSPeerUpdate.NAME_CHANGED as update type. When this event is received, the UI for that peer should be updated.
|
|
534
833
|
*
|
|
834
|
+
* @param {string} name - The new name to be set for the local peer.
|
|
835
|
+
* @returns {Promise<void>} A promise that resolves when the name change operation has been successfully completed.
|
|
836
|
+
* @throws {Error} Throws an error if the name change operation fails.
|
|
837
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-name for more information on changing the peer's name.
|
|
838
|
+
* @async
|
|
839
|
+
* @function changeName
|
|
535
840
|
* @memberof HMSSDK
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* // Change the name of the local peer to 'Alice'
|
|
844
|
+
* await hmsInstance.changeName("Alice");
|
|
536
845
|
*/
|
|
537
846
|
_defineProperty(this, "changeName", async name => {
|
|
538
847
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function changeName', {
|
|
@@ -546,13 +855,22 @@ class HMSSDK {
|
|
|
546
855
|
return await _HMSManagerModule.default.changeName(data);
|
|
547
856
|
});
|
|
548
857
|
/**
|
|
549
|
-
*
|
|
858
|
+
* Asynchronously previews the audio and video tracks for a specific role before applying the role change.
|
|
859
|
+
*
|
|
860
|
+
* This method allows users to preview the expected audio and video tracks that will be visible to other peers in the room
|
|
861
|
+
* after changing their role. It is useful for scenarios where a user wants to understand the impact of a role change on their
|
|
862
|
+
* media tracks before making the change. This can help in ensuring that the right media settings are applied for the new role.
|
|
550
863
|
*
|
|
551
|
-
*
|
|
864
|
+
* @param {string} role - The role for which the preview is requested. The role should be defined within the room's role configurations.
|
|
865
|
+
* @returns {Promise<any>} A promise that resolves with the preview tracks information. The resolved object contains details about the audio and video tracks that would be available to the user if the role were changed to the specified role.
|
|
552
866
|
*
|
|
553
|
-
*
|
|
867
|
+
* @example
|
|
868
|
+
* // Preview the tracks for the 'speaker' role
|
|
869
|
+
* const previewTracks = await hmsInstance.previewForRole('speaker');
|
|
870
|
+
* console.log(previewTracks);
|
|
554
871
|
*
|
|
555
|
-
* @
|
|
872
|
+
* @async
|
|
873
|
+
* @function previewForRole
|
|
556
874
|
* @memberof HMSSDK
|
|
557
875
|
*/
|
|
558
876
|
_defineProperty(this, "previewForRole", async role => {
|
|
@@ -568,13 +886,22 @@ class HMSSDK {
|
|
|
568
886
|
return previewTracks;
|
|
569
887
|
});
|
|
570
888
|
/**
|
|
571
|
-
*
|
|
889
|
+
* Asynchronously cancels the preview for a role change.
|
|
572
890
|
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
891
|
+
* This method is intended to be used after a `previewForRole` invocation. It cancels the ongoing preview operation,
|
|
892
|
+
* effectively clearing any tracks that were created in anticipation of a role change. This is useful in scenarios where
|
|
893
|
+
* a role change preview was initiated but needs to be aborted before the actual role change occurs, allowing for clean
|
|
894
|
+
* state management and resource cleanup.
|
|
576
895
|
*
|
|
896
|
+
* @async
|
|
897
|
+
* @function cancelPreview
|
|
577
898
|
* @memberof HMSSDK
|
|
899
|
+
* @returns {Promise<{data: string}>} A promise that resolves with an object containing a data string.
|
|
900
|
+
*
|
|
901
|
+
* @example
|
|
902
|
+
* // Cancel a previously initiated role change preview
|
|
903
|
+
* await hmsInstance.cancelPreview();
|
|
904
|
+
*
|
|
578
905
|
*/
|
|
579
906
|
_defineProperty(this, "cancelPreview", async () => {
|
|
580
907
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function cancelPreview', {
|
|
@@ -586,11 +913,25 @@ class HMSSDK {
|
|
|
586
913
|
return data;
|
|
587
914
|
});
|
|
588
915
|
/**
|
|
589
|
-
*
|
|
916
|
+
* Asynchronously accepts a role change request for the local peer.
|
|
917
|
+
*
|
|
918
|
+
* This method is used when a role change request has been made to the local peer, typically by an admin or moderator of the room.
|
|
919
|
+
* Invoking this method signals acceptance of the new role, and the role change is applied to the local peer. This can affect the peer's
|
|
920
|
+
* permissions and capabilities within the room, such as the ability to send video, audio, or chat messages.
|
|
590
921
|
*
|
|
591
|
-
*
|
|
922
|
+
* The successful execution of this method triggers an update across the room, notifying other peers of the role change.
|
|
923
|
+
* It is important to handle this method's response to ensure the local UI reflects the new role's permissions and capabilities.
|
|
592
924
|
*
|
|
925
|
+
* @async
|
|
926
|
+
* @function acceptRoleChange
|
|
593
927
|
* @memberof HMSSDK
|
|
928
|
+
* @returns {Promise<void>} A promise that resolves when the role change has been successfully accepted and applied.
|
|
929
|
+
* @throws {Error} Throws an error if the role change acceptance operation fails.
|
|
930
|
+
* @example
|
|
931
|
+
* // Accept a role change request to become a 'moderator'
|
|
932
|
+
* await hmsInstance.acceptRoleChange();
|
|
933
|
+
*
|
|
934
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role
|
|
594
935
|
*/
|
|
595
936
|
_defineProperty(this, "acceptRoleChange", async () => {
|
|
596
937
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function acceptRoleChange', {
|
|
@@ -601,27 +942,54 @@ class HMSSDK {
|
|
|
601
942
|
});
|
|
602
943
|
});
|
|
603
944
|
/**
|
|
604
|
-
*
|
|
605
|
-
* HMSRemoteAudioTrack. It sets mute status for all peers in the room only for the local peer.
|
|
945
|
+
* Sets the mute status for all remote audio tracks in the room for the local peer.
|
|
606
946
|
*
|
|
607
|
-
*
|
|
947
|
+
* This method allows the local user to mute or unmute the playback of all remote audio tracks in the room.
|
|
948
|
+
* It affects only the local peer's audio playback and does not impact other peers. This can be useful in scenarios
|
|
949
|
+
* where a user needs to quickly mute all incoming audio without affecting the audio state for other participants in the room.
|
|
608
950
|
*
|
|
951
|
+
* @param {boolean} mute - A boolean value indicating whether to mute (`true`) or unmute (`false`) all remote audio tracks for the local peer.
|
|
952
|
+
* @returns {Promise<boolean>} A promise that resolves with a boolean value indicating the success of the operation.
|
|
953
|
+
* @throws {Error} Throws an error if the operation fails.
|
|
954
|
+
* @async
|
|
955
|
+
* @function setPlaybackForAllAudio
|
|
609
956
|
* @memberof HMSSDK
|
|
957
|
+
* @example
|
|
958
|
+
* // Mute all remote audio tracks for the local peer
|
|
959
|
+
* hmsInstance.setPlaybackForAllAudio(true);
|
|
960
|
+
*
|
|
961
|
+
* @example
|
|
962
|
+
* // Unmute all remote audio tracks for the local peer
|
|
963
|
+
* hmsInstance.setPlaybackForAllAudio(false);
|
|
964
|
+
*
|
|
965
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/playback-allowed
|
|
610
966
|
*/
|
|
611
|
-
_defineProperty(this, "setPlaybackForAllAudio", mute => {
|
|
967
|
+
_defineProperty(this, "setPlaybackForAllAudio", async mute => {
|
|
612
968
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function setPlaybackForAllAudio', {
|
|
613
969
|
mute,
|
|
614
970
|
id: this.id
|
|
615
971
|
});
|
|
616
|
-
_HMSManagerModule.default.setPlaybackForAllAudio({
|
|
972
|
+
return await _HMSManagerModule.default.setPlaybackForAllAudio({
|
|
617
973
|
mute,
|
|
618
974
|
id: this.id
|
|
619
975
|
});
|
|
620
976
|
});
|
|
621
977
|
/**
|
|
622
|
-
*
|
|
978
|
+
* Mutes the audio for all peers in the room.
|
|
623
979
|
*
|
|
980
|
+
* This asynchronous function communicates with the native `HMSManager` module to mute the audio tracks of all remote peers in the room.
|
|
981
|
+
* It is particularly useful in scenarios where a moderator needs to quickly mute all participants to prevent background noise or interruptions during a session.
|
|
982
|
+
*
|
|
983
|
+
* @async
|
|
984
|
+
* @function remoteMuteAllAudio
|
|
624
985
|
* @memberof HMSSDK
|
|
986
|
+
* @returns {Promise<{success: boolean}>} A promise that resolves with a boolean value indicating the success of the operation.
|
|
987
|
+
* @throws {Error} Throws an error if the operation fails.
|
|
988
|
+
* @example
|
|
989
|
+
* // Mute all remote audio tracks in the room
|
|
990
|
+
* await hmsInstance.remoteMuteAllAudio();
|
|
991
|
+
*
|
|
992
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/remote-mute
|
|
625
993
|
*/
|
|
626
994
|
_defineProperty(this, "remoteMuteAllAudio", async () => {
|
|
627
995
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function remoteMuteAllAudio', {
|
|
@@ -632,13 +1000,23 @@ class HMSSDK {
|
|
|
632
1000
|
});
|
|
633
1001
|
});
|
|
634
1002
|
/**
|
|
635
|
-
*
|
|
636
|
-
* current room object which is of type {@link HMSRoom}
|
|
1003
|
+
* Retrieves the current room's details.
|
|
637
1004
|
*
|
|
638
|
-
*
|
|
1005
|
+
* This method acts as a wrapper around the native `getRoom` function, providing an easy way to obtain the current room's state and details,
|
|
1006
|
+
* including participants, tracks, and other relevant information. The room object is fetched from the native module and then processed
|
|
1007
|
+
* to match the expected format in the React Native layer. This method is useful for getting the room's state at any point in time, such as
|
|
1008
|
+
* when needing to display current room information or for debugging purposes.
|
|
639
1009
|
*
|
|
1010
|
+
* @async
|
|
1011
|
+
* @function getRoom
|
|
640
1012
|
* @memberof HMSSDK
|
|
641
|
-
* @
|
|
1013
|
+
* @returns {Promise<HMSRoom>} A promise that resolves to the current room object.
|
|
1014
|
+
* @example
|
|
1015
|
+
* // Fetch the current room details
|
|
1016
|
+
* const roomDetails = await hmsInstance.getRoom();
|
|
1017
|
+
* console.log(roomDetails);
|
|
1018
|
+
*
|
|
1019
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/get-methods
|
|
642
1020
|
*/
|
|
643
1021
|
_defineProperty(this, "getRoom", async () => {
|
|
644
1022
|
var _getHmsRoomCache;
|
|
@@ -653,11 +1031,23 @@ class HMSSDK {
|
|
|
653
1031
|
return encodedHmsRoom;
|
|
654
1032
|
});
|
|
655
1033
|
/**
|
|
656
|
-
*
|
|
657
|
-
*
|
|
1034
|
+
* Retrieves the current local peer's details.
|
|
1035
|
+
*
|
|
1036
|
+
* This asynchronous method wraps around the native `getLocalPeer` function, providing a straightforward way to obtain the current local peer's details,
|
|
1037
|
+
* including their ID, name, role, and any tracks they may be publishing. The local peer object is fetched from the native module and then processed
|
|
1038
|
+
* to match the expected format in the React Native layer. This method is particularly useful for operations that require information about the local user,
|
|
1039
|
+
* such as updating UI elements to reflect the current user's status or for debugging purposes.
|
|
658
1040
|
*
|
|
1041
|
+
* @async
|
|
1042
|
+
* @function getLocalPeer
|
|
659
1043
|
* @memberof HMSSDK
|
|
660
|
-
* @
|
|
1044
|
+
* @returns {Promise<HMSLocalPeer>} A promise that resolves to the current local peer object.
|
|
1045
|
+
* @example
|
|
1046
|
+
* // Fetch the current local peer's details
|
|
1047
|
+
* const localPeerDetails = await hmsInstance.getLocalPeer();
|
|
1048
|
+
* console.log(localPeerDetails);
|
|
1049
|
+
*
|
|
1050
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/get-methods
|
|
661
1051
|
*/
|
|
662
1052
|
_defineProperty(this, "getLocalPeer", async () => {
|
|
663
1053
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getLocalPeer', {
|
|
@@ -670,11 +1060,22 @@ class HMSSDK {
|
|
|
670
1060
|
return encodedLocalPeer;
|
|
671
1061
|
});
|
|
672
1062
|
/**
|
|
673
|
-
*
|
|
674
|
-
*
|
|
1063
|
+
* Retrieves an array of remote peers currently in the room.
|
|
1064
|
+
*
|
|
1065
|
+
* This asynchronous method serves as a wrapper around the native `getRemotePeers` function, facilitating the retrieval of remote peers' details.
|
|
1066
|
+
* It fetches an array of `HMSRemotePeer` objects, each representing a remote participant in the room. The method processes the fetched data
|
|
1067
|
+
* to conform to the expected format in the React Native layer, making it suitable for UI rendering or further processing.
|
|
675
1068
|
*
|
|
1069
|
+
* @async
|
|
1070
|
+
* @function getRemotePeers
|
|
676
1071
|
* @memberof HMSSDK
|
|
677
|
-
* @
|
|
1072
|
+
* @returns {Promise<HMSRemotePeer[]>} A promise that resolves with an array of `HMSRemotePeer` objects, representing the remote peers in the room.
|
|
1073
|
+
* @example
|
|
1074
|
+
* // Fetch the list of remote peers in the room
|
|
1075
|
+
* const remotePeers = await hmsInstance.getRemotePeers();
|
|
1076
|
+
* console.log(remotePeers);
|
|
1077
|
+
*
|
|
1078
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/listen-to-room-updates/get-methods
|
|
678
1079
|
*/
|
|
679
1080
|
_defineProperty(this, "getRemotePeers", async () => {
|
|
680
1081
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getRemotePeers', {
|
|
@@ -687,11 +1088,22 @@ class HMSSDK {
|
|
|
687
1088
|
return encodedRemotePeers;
|
|
688
1089
|
});
|
|
689
1090
|
/**
|
|
690
|
-
*
|
|
691
|
-
*
|
|
1091
|
+
* Retrieves a list of all roles currently available in the room.
|
|
1092
|
+
*
|
|
1093
|
+
* This asynchronous method calls the native `getRoles` function to fetch an array of `HMSRole` objects, representing the roles defined for the room.
|
|
1094
|
+
* Each `HMSRole` object includes details such as the role name, permissions, and other role-specific settings. The roles are then processed
|
|
1095
|
+
* to match the expected format in the React Native layer. This method is useful for operations that require a comprehensive list of roles,
|
|
1096
|
+
* such as displaying role options in a UI dropdown for role assignment or for role-based access control checks.
|
|
692
1097
|
*
|
|
1098
|
+
* @async
|
|
1099
|
+
* @function getRoles
|
|
693
1100
|
* @memberof HMSSDK
|
|
694
|
-
* @
|
|
1101
|
+
* @returns {Promise<HMSRole[]>} A promise that resolves with an array of `HMSRole` objects, representing the available roles in the room.
|
|
1102
|
+
*
|
|
1103
|
+
* @example
|
|
1104
|
+
* // Fetch the list of available roles in the room
|
|
1105
|
+
* const roles = await hmsInstance.getRoles();
|
|
1106
|
+
* console.log(roles);
|
|
695
1107
|
*/
|
|
696
1108
|
_defineProperty(this, "getRoles", async () => {
|
|
697
1109
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getRoles', {
|
|
@@ -704,30 +1116,56 @@ class HMSSDK {
|
|
|
704
1116
|
return encodedRoles;
|
|
705
1117
|
});
|
|
706
1118
|
/**
|
|
707
|
-
*
|
|
1119
|
+
* Sets the volume for a specific track of any peer in the room.
|
|
1120
|
+
*
|
|
1121
|
+
* This function allows the adjustment of the playback volume for any given audio track of a peer within the room.
|
|
1122
|
+
* It is particularly useful for controlling the audio levels of individual participants in a conference call or meeting.
|
|
1123
|
+
* The volume level is specified as a number. Volume level can vary from 0(min) to 10(max). The default value for volume is 1.0.
|
|
708
1124
|
*
|
|
709
|
-
*
|
|
1125
|
+
* @param {HMSTrack} track - The track object whose volume is to be set. This object must include a valid `trackId`.
|
|
1126
|
+
* @param {number} volume - The volume level to set for the specified track.
|
|
1127
|
+
* @returns {Promise<void>} A promise that resolves when the operation to set the track's volume is complete.
|
|
1128
|
+
* @throws {Error} Throws an error if the operation fails or the track cannot be found.
|
|
710
1129
|
*
|
|
1130
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/track/set-volume
|
|
1131
|
+
*
|
|
1132
|
+
* @async
|
|
711
1133
|
* @memberof HMSSDK
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* // Assuming `track` is an instance of HMSTrack representing the participant's audio track
|
|
1137
|
+
* hmsInstance.setVolume(track, 10);
|
|
712
1138
|
*/
|
|
713
|
-
_defineProperty(this, "setVolume", (track, volume) => {
|
|
1139
|
+
_defineProperty(this, "setVolume", async (track, volume) => {
|
|
714
1140
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function setVolume', {
|
|
715
1141
|
track,
|
|
716
1142
|
volume,
|
|
717
1143
|
id: this.id
|
|
718
1144
|
});
|
|
719
|
-
_HMSManagerModule.default.setVolume({
|
|
1145
|
+
return await _HMSManagerModule.default.setVolume({
|
|
720
1146
|
id: this.id,
|
|
721
1147
|
trackId: track.trackId,
|
|
722
1148
|
volume
|
|
723
1149
|
});
|
|
724
1150
|
});
|
|
725
1151
|
/**
|
|
726
|
-
*
|
|
1152
|
+
* Initiates screen sharing in the room.
|
|
1153
|
+
*
|
|
1154
|
+
* This asynchronous function triggers the screen sharing feature, allowing the local peer to share their screen with other participants in the room.
|
|
1155
|
+
* Upon successful execution, other participants in the room will be able to see the shared screen as part of the video conference.
|
|
727
1156
|
*
|
|
728
|
-
*
|
|
1157
|
+
* Note: Proper permissions must be granted by the user for screen sharing to work. Ensure to handle permission requests appropriately in your application.
|
|
729
1158
|
*
|
|
1159
|
+
* @async
|
|
1160
|
+
* @function startScreenshare
|
|
730
1161
|
* @memberof HMSSDK
|
|
1162
|
+
* @returns {Promise<void>} A promise that resolves when the screen sharing has successfully started.
|
|
1163
|
+
* @throws {Error} Throws an error if the operation fails or screen sharing cannot be initiated.
|
|
1164
|
+
*
|
|
1165
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/screenshare
|
|
1166
|
+
* @example
|
|
1167
|
+
* // Start screen sharing
|
|
1168
|
+
* await hmsInstance.startScreenshare();
|
|
731
1169
|
*/
|
|
732
1170
|
_defineProperty(this, "startScreenshare", async () => {
|
|
733
1171
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function startScreenshare', {
|
|
@@ -738,11 +1176,22 @@ class HMSSDK {
|
|
|
738
1176
|
});
|
|
739
1177
|
});
|
|
740
1178
|
/**
|
|
741
|
-
*
|
|
1179
|
+
* Checks if the screen sharing is currently active in the room.
|
|
742
1180
|
*
|
|
743
|
-
*
|
|
1181
|
+
* This asynchronous method queries the native `HMSManager` module to determine if the screen is currently being shared by the local peer in the room.
|
|
1182
|
+
* It returns a promise that resolves to a boolean value, indicating the screen sharing status. `true` signifies that the screen sharing is active,
|
|
1183
|
+
* while `false` indicates that it is not. This method can be used to toggle UI elements or to decide whether to start or stop screen sharing based on the current state.
|
|
744
1184
|
*
|
|
1185
|
+
* @async
|
|
1186
|
+
* @function isScreenShared
|
|
745
1187
|
* @memberof HMSSDK
|
|
1188
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether the screen is currently shared.
|
|
1189
|
+
* @example
|
|
1190
|
+
* // Check if the screen is currently shared
|
|
1191
|
+
* const isShared = await hmsInstance.isScreenShared();
|
|
1192
|
+
* console.log(isShared ? "Screen is being shared" : "Screen is not being shared");
|
|
1193
|
+
*
|
|
1194
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/screenshare
|
|
746
1195
|
*/
|
|
747
1196
|
_defineProperty(this, "isScreenShared", async () => {
|
|
748
1197
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function isScreenShared', {
|
|
@@ -753,11 +1202,25 @@ class HMSSDK {
|
|
|
753
1202
|
});
|
|
754
1203
|
});
|
|
755
1204
|
/**
|
|
756
|
-
*
|
|
1205
|
+
* Asynchronously stops the screen sharing session.
|
|
757
1206
|
*
|
|
758
|
-
*
|
|
1207
|
+
* This method communicates with the native `HMSManager` module to stop the ongoing screen sharing session initiated by the local peer.
|
|
1208
|
+
* Upon successful execution, the screen sharing session is terminated, and other participants
|
|
1209
|
+
* in the room will no longer be able to see the shared screen. This method can be used to programmatically control the end of a screen sharing session,
|
|
1210
|
+
* providing flexibility in managing the screen sharing feature within your application.
|
|
759
1211
|
*
|
|
1212
|
+
* Note: Ensure that the necessary permissions and conditions for screen sharing are managed appropriately in your application.
|
|
1213
|
+
*
|
|
1214
|
+
* @async
|
|
1215
|
+
* @function stopScreenshare
|
|
760
1216
|
* @memberof HMSSDK
|
|
1217
|
+
* @returns {Promise<void>} A promise that resolves when the screen sharing has successfully stopped.
|
|
1218
|
+
* @throws {Error} Throws an error if the operation fails or the screen sharing cannot be stopped.
|
|
1219
|
+
*
|
|
1220
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/screenshare
|
|
1221
|
+
* @example
|
|
1222
|
+
* // Stop screen sharing
|
|
1223
|
+
* await hmsInstance.stopScreenshare();
|
|
761
1224
|
*/
|
|
762
1225
|
_defineProperty(this, "stopScreenshare", async () => {
|
|
763
1226
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function stopScreenshare', {
|
|
@@ -767,6 +1230,21 @@ class HMSSDK {
|
|
|
767
1230
|
id: this.id
|
|
768
1231
|
});
|
|
769
1232
|
});
|
|
1233
|
+
/**
|
|
1234
|
+
* Enables network quality updates for the local peer.
|
|
1235
|
+
*
|
|
1236
|
+
* This method activates the network quality monitoring feature, which periodically assesses and reports the network quality of peers in a room.
|
|
1237
|
+
* The network quality updates are useful for providing feedback to the user about their current connection status, potentially prompting them to improve their network environment if necessary.
|
|
1238
|
+
* Upon enabling, network quality updates are emitted through the appropriate event listeners - `HMSPeerUpdate.NETWORK_QUALITY_UPDATED` allowing the application to react or display the network status dynamically.
|
|
1239
|
+
*
|
|
1240
|
+
* @function enableNetworkQualityUpdates
|
|
1241
|
+
* @memberof HMSSDK
|
|
1242
|
+
* @example
|
|
1243
|
+
* // Enable network quality updates
|
|
1244
|
+
* hmsInstance.enableNetworkQualityUpdates();
|
|
1245
|
+
*
|
|
1246
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/measure-network-quality-and-performance/network-quality
|
|
1247
|
+
*/
|
|
770
1248
|
_defineProperty(this, "enableNetworkQualityUpdates", () => {
|
|
771
1249
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function enableNetworkQualityUpdates', {
|
|
772
1250
|
id: this.id
|
|
@@ -775,6 +1253,21 @@ class HMSSDK {
|
|
|
775
1253
|
id: this.id
|
|
776
1254
|
});
|
|
777
1255
|
});
|
|
1256
|
+
/**
|
|
1257
|
+
* Disables network quality updates for the local peer.
|
|
1258
|
+
*
|
|
1259
|
+
* This method deactivates the network quality monitoring feature, which stops the periodic assessment and reporting of the network quality of peers in a room.
|
|
1260
|
+
* Disabling network quality updates can be useful in scenarios where network quality information is no longer needed, or to reduce the computational overhead associated with monitoring network quality.
|
|
1261
|
+
* Once disabled, network quality updates will no longer be emitted through the event listeners, allowing the application to cease reacting to or displaying network status information.
|
|
1262
|
+
*
|
|
1263
|
+
* @function disableNetworkQualityUpdates
|
|
1264
|
+
* @memberof HMSSDK
|
|
1265
|
+
* @example
|
|
1266
|
+
* // Disable network quality updates
|
|
1267
|
+
* hmsInstance.disableNetworkQualityUpdates();
|
|
1268
|
+
*
|
|
1269
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/measure-network-quality-and-performance/network-quality
|
|
1270
|
+
*/
|
|
778
1271
|
_defineProperty(this, "disableNetworkQualityUpdates", () => {
|
|
779
1272
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function disableNetworkQualityUpdates', {
|
|
780
1273
|
id: this.id
|
|
@@ -784,12 +1277,26 @@ class HMSSDK {
|
|
|
784
1277
|
});
|
|
785
1278
|
});
|
|
786
1279
|
/**
|
|
787
|
-
*
|
|
1280
|
+
* Starts streaming device audio, available only on Android devices.
|
|
788
1281
|
*
|
|
789
|
-
*
|
|
1282
|
+
* This method allows the application to share device audio, such as music or system sounds, with other participants in a video conference.
|
|
1283
|
+
* It leverages the native HMSManager's `startAudioshare` method to initiate audio sharing. The function takes an `HMSAudioMixingMode` parameter,
|
|
1284
|
+
* which specifies the audio mixing mode to be used during the audio share session.
|
|
790
1285
|
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
1286
|
+
* Note: This feature is currently supported only on Android. Attempting to use this feature on iOS will result in a console log indicating
|
|
1287
|
+
* that the API is not available for iOS.
|
|
1288
|
+
*
|
|
1289
|
+
* @async
|
|
1290
|
+
* @function startAudioshare
|
|
1291
|
+
* @param {HMSAudioMixingMode} audioMixingMode - The audio mixing mode to be used for the audio share session.
|
|
1292
|
+
* @returns {Promise} A promise that resolves to a success if the audio share is started successfully
|
|
1293
|
+
* @throws {Error} Throws an error if the operation fails or the audio share cannot be started.
|
|
1294
|
+
*
|
|
1295
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/local-audio-share
|
|
1296
|
+
*
|
|
1297
|
+
* @example
|
|
1298
|
+
* // Start audio sharing with the default mixing mode
|
|
1299
|
+
* await hmsInstance.startAudioshare(HMSAudioMixingMode.DEFAULT);
|
|
793
1300
|
*/
|
|
794
1301
|
_defineProperty(this, "startAudioshare", async audioMixingMode => {
|
|
795
1302
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function startAudioshare', {
|
|
@@ -807,11 +1314,21 @@ class HMSSDK {
|
|
|
807
1314
|
}
|
|
808
1315
|
});
|
|
809
1316
|
/**
|
|
810
|
-
*
|
|
1317
|
+
* Checks if audio sharing is currently active.
|
|
811
1318
|
*
|
|
812
|
-
*
|
|
1319
|
+
* This asynchronous method determines whether audio sharing is currently active, with support limited to Android devices.
|
|
1320
|
+
* On Android, it queries the native `HMSManager` module to check the audio sharing status and returns a promise that resolves to a boolean value.
|
|
813
1321
|
*
|
|
1322
|
+
* @async
|
|
1323
|
+
* @function isAudioShared
|
|
814
1324
|
* @memberof HMSSDK
|
|
1325
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether audio sharing is currently active.
|
|
1326
|
+
* @example
|
|
1327
|
+
* // Check if audio is being shared on an Android device
|
|
1328
|
+
* const isSharing = await hmsInstance.isAudioShared();
|
|
1329
|
+
* console.log(isSharing); // true or false based on the sharing status, or a message for iOS
|
|
1330
|
+
*
|
|
1331
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/local-audio-share
|
|
815
1332
|
*/
|
|
816
1333
|
_defineProperty(this, "isAudioShared", async () => {
|
|
817
1334
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function isAudioShared', {
|
|
@@ -823,15 +1340,25 @@ class HMSSDK {
|
|
|
823
1340
|
});
|
|
824
1341
|
} else {
|
|
825
1342
|
console.log('API currently not available for iOS');
|
|
826
|
-
return
|
|
1343
|
+
return Promise.resolve(false);
|
|
827
1344
|
}
|
|
828
1345
|
});
|
|
829
1346
|
/**
|
|
830
|
-
*
|
|
1347
|
+
* Stops the streaming of device audio, with functionality currently limited to Android devices.
|
|
831
1348
|
*
|
|
832
|
-
*
|
|
1349
|
+
* This asynchronous method communicates with the native `HMSManager` module to stop the audio sharing session that was previously started.
|
|
1350
|
+
* It is primarily used when the application needs to cease sharing device audio, such as music or system sounds, with other participants in a video conference.
|
|
1351
|
+
* On Android devices, it successfully terminates the audio share session. On iOS devices, since the feature is not supported, it logs a message indicating the unavailability of the API.
|
|
833
1352
|
*
|
|
1353
|
+
* @async
|
|
1354
|
+
* @function stopAudioshare
|
|
834
1355
|
* @memberof HMSSDK
|
|
1356
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating the success of the operation.
|
|
1357
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/local-audio-share
|
|
1358
|
+
*
|
|
1359
|
+
* @example
|
|
1360
|
+
* // Stop audio sharing
|
|
1361
|
+
* await hmsInstance.stopAudioshare();
|
|
835
1362
|
*/
|
|
836
1363
|
_defineProperty(this, "stopAudioshare", async () => {
|
|
837
1364
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function stopAudioshare', {
|
|
@@ -843,14 +1370,30 @@ class HMSSDK {
|
|
|
843
1370
|
});
|
|
844
1371
|
} else {
|
|
845
1372
|
console.log('API currently not available for iOS');
|
|
846
|
-
return
|
|
1373
|
+
return Promise.resolve(false);
|
|
847
1374
|
}
|
|
848
1375
|
});
|
|
849
1376
|
/**
|
|
850
|
-
*
|
|
1377
|
+
* Asynchronously retrieves the current audio mixing mode, with functionality currently limited to Android devices.
|
|
1378
|
+
*
|
|
1379
|
+
* This method queries the native `HMSManager` module to obtain the current audio mixing mode used in the audio share session.
|
|
1380
|
+
* The audio mixing mode determines how local and remote audio tracks are mixed together during an audio share session.
|
|
1381
|
+
*
|
|
1382
|
+
* Note: This feature is only supported on Android. Attempting to use this feature on iOS will result in a console log indicating
|
|
1383
|
+
* that the API is not available for iOS devices.
|
|
851
1384
|
*
|
|
1385
|
+
* @async
|
|
1386
|
+
* @function getAudioMixingMode
|
|
852
1387
|
* @memberof HMSSDK
|
|
853
|
-
* @
|
|
1388
|
+
* @returns {Promise<string>} A promise that resolves to a string indicating the current audio mixing mode.
|
|
1389
|
+
*
|
|
1390
|
+
* @throws {Error} Throws an error if the operation fails or the audio mixing mode cannot be retrieved.
|
|
1391
|
+
*
|
|
1392
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/local-audio-share
|
|
1393
|
+
* @example
|
|
1394
|
+
* // Get the current audio mixing mode on an Android device
|
|
1395
|
+
* const mixingMode = await hmsInstance.getAudioMixingMode();
|
|
1396
|
+
* console.log(mixingMode); // Outputs the current audio mixing mode or a message for iOS
|
|
854
1397
|
*/
|
|
855
1398
|
_defineProperty(this, "getAudioMixingMode", async () => {
|
|
856
1399
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getAudioMixingMode', {
|
|
@@ -862,15 +1405,27 @@ class HMSSDK {
|
|
|
862
1405
|
});
|
|
863
1406
|
} else {
|
|
864
1407
|
console.log('API currently not available for iOS');
|
|
865
|
-
return 'API currently not available for iOS';
|
|
1408
|
+
return Promise.reject('API currently not available for iOS');
|
|
866
1409
|
}
|
|
867
1410
|
});
|
|
868
1411
|
/**
|
|
869
|
-
*
|
|
1412
|
+
* Sets the audio mixing mode for the current session. Android only.
|
|
870
1413
|
*
|
|
871
|
-
*
|
|
1414
|
+
* This asynchronous function is used to change the mode of audio mixing during a session. It is currently
|
|
1415
|
+
* available only for Android. The function logs the action with the instance ID and the specified audio mixing mode,
|
|
1416
|
+
* then calls the native `setAudioMixingMode` method in `HMSManager` with the provided parameters.
|
|
1417
|
+
*
|
|
1418
|
+
* If the platform is not Android, it logs a message indicating that the API is not available for iOS.
|
|
1419
|
+
*
|
|
1420
|
+
* @param {HMSAudioMixingMode} audioMixingMode - The audio mixing mode to be set.
|
|
1421
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating the success of the operation.
|
|
1422
|
+
* @throws {Error} Throws an error if the operation fails or the audio mixing mode cannot be set.
|
|
1423
|
+
*
|
|
1424
|
+
* @example
|
|
1425
|
+
* await hmsInstance.setAudioMixingMode(HMSAudioMixingMode.TALK_AND_MUSIC);
|
|
1426
|
+
*
|
|
1427
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/local-audio-share
|
|
872
1428
|
*
|
|
873
|
-
* @param {HMSAudioMixingMode}
|
|
874
1429
|
* @memberof HMSSDK
|
|
875
1430
|
*/
|
|
876
1431
|
_defineProperty(this, "setAudioMixingMode", async audioMixingMode => {
|
|
@@ -885,17 +1440,24 @@ class HMSSDK {
|
|
|
885
1440
|
});
|
|
886
1441
|
} else {
|
|
887
1442
|
console.log('API currently not available for iOS');
|
|
888
|
-
return 'API currently not available for iOS';
|
|
1443
|
+
return Promise.reject('API currently not available for iOS');
|
|
889
1444
|
}
|
|
890
1445
|
});
|
|
891
1446
|
/**
|
|
892
|
-
*
|
|
893
|
-
*
|
|
1447
|
+
* Retrieves a list of audio output devices. Android only.
|
|
1448
|
+
*
|
|
1449
|
+
* This method asynchronously fetches and returns an array of audio output devices available on the device.
|
|
1450
|
+
* It is designed to work specifically on Android platforms. For iOS, it will reject the promise with a message
|
|
1451
|
+
* indicating that the API is not available. This can be useful for applications that need to display or allow
|
|
1452
|
+
* the user to select from available audio output options, such as speakers, headphones, or Bluetooth devices.
|
|
894
1453
|
*
|
|
895
|
-
*
|
|
1454
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/configure-your-device/speaker/audio-output-routing
|
|
896
1455
|
*
|
|
897
1456
|
* @memberof HMSSDK
|
|
898
|
-
* @
|
|
1457
|
+
* @returns {Promise<HMSAudioDevice[]>} A promise that resolves to an array of `HMSAudioDevice` objects on Android. On iOS, the promise is rejected.
|
|
1458
|
+
* @example
|
|
1459
|
+
* // Get the list of audio output devices
|
|
1460
|
+
* const audioDevices = await hmsInstance.getAudioDevicesList();
|
|
899
1461
|
*/
|
|
900
1462
|
_defineProperty(this, "getAudioDevicesList", async () => {
|
|
901
1463
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getAudioDevicesList', {
|
|
@@ -907,17 +1469,25 @@ class HMSSDK {
|
|
|
907
1469
|
});
|
|
908
1470
|
} else {
|
|
909
1471
|
console.log('API currently not available for iOS');
|
|
910
|
-
return 'API currently not available for iOS';
|
|
1472
|
+
return Promise.reject('API currently not available for iOS');
|
|
911
1473
|
}
|
|
912
1474
|
});
|
|
913
1475
|
/**
|
|
914
|
-
*
|
|
915
|
-
* type {@link HMSAudioDevice}, currently available only for android.
|
|
1476
|
+
* Retrieves the current audio output device type on Android devices.
|
|
916
1477
|
*
|
|
917
|
-
*
|
|
1478
|
+
* This method is a wrapper function that returns the type of the current audio output device.
|
|
1479
|
+
* The return type is a `HMSAudioDevice`, which is an enumeration representing different types of audio output devices.
|
|
1480
|
+
*
|
|
1481
|
+
* Note: This API is not available for iOS devices. If invoked on iOS, it logs a message indicating the unavailability and rejects the promise.
|
|
1482
|
+
*
|
|
1483
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/configure-your-device/speaker/audio-output-routing
|
|
918
1484
|
*
|
|
919
1485
|
* @memberof HMSSDK
|
|
920
|
-
* @
|
|
1486
|
+
* @returns {Promise<HMSAudioDevice>} A promise that resolves to the current audio output device type if the platform is Android. If the platform is iOS, the promise is rejected.
|
|
1487
|
+
*
|
|
1488
|
+
* @example
|
|
1489
|
+
* // Get the current audio output device type
|
|
1490
|
+
* const currentAudioOutputDevice = await hmsInstance.getAudioOutputRouteType();
|
|
921
1491
|
*/
|
|
922
1492
|
_defineProperty(this, "getAudioOutputRouteType", async () => {
|
|
923
1493
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getAudioOutputRouteType', {
|
|
@@ -929,16 +1499,23 @@ class HMSSDK {
|
|
|
929
1499
|
});
|
|
930
1500
|
} else {
|
|
931
1501
|
console.log('API currently not available for iOS');
|
|
932
|
-
return 'API currently not available for iOS';
|
|
1502
|
+
return Promise.reject('API currently not available for iOS');
|
|
933
1503
|
}
|
|
934
1504
|
});
|
|
935
1505
|
/**
|
|
936
|
-
*
|
|
1506
|
+
* Switches the audio output device to a specified device.
|
|
1507
|
+
* This function is a wrapper around the native module's method to change the audio output route.
|
|
1508
|
+
* It allows for changing the audio output to a device other than the default one, such as a Bluetooth headset or speaker.
|
|
937
1509
|
*
|
|
938
|
-
*
|
|
1510
|
+
* @param {HMSAudioDevice} audioDevice - The audio device to switch the output to. This should be one of the devices available in `HMSAudioDevice`.
|
|
1511
|
+
*
|
|
1512
|
+
* @returns {Promise<void>} A promise that resolves when the audio output device is successfully switched. Rejected if the operation fails.
|
|
1513
|
+
*
|
|
1514
|
+
* @example
|
|
1515
|
+
* // To switch audio output to a Bluetooth device
|
|
1516
|
+
* hmsSDK.switchAudioOutput(HMSAudioDevice.Bluetooth);
|
|
939
1517
|
*
|
|
940
1518
|
* @memberof HMSSDK
|
|
941
|
-
* @param audioDevice
|
|
942
1519
|
*/
|
|
943
1520
|
_defineProperty(this, "switchAudioOutput", audioDevice => {
|
|
944
1521
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function switchAudioOutput', {
|
|
@@ -964,7 +1541,7 @@ class HMSSDK {
|
|
|
964
1541
|
/**
|
|
965
1542
|
* - This wrapper function used to change Audio Mode manually, currently available only for android.
|
|
966
1543
|
*
|
|
967
|
-
*
|
|
1544
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/configure-your-device/speaker/audio-mode-change
|
|
968
1545
|
*
|
|
969
1546
|
* @param {HMSAudioMode}
|
|
970
1547
|
* @memberof HMSSDK
|
|
@@ -985,12 +1562,16 @@ class HMSSDK {
|
|
|
985
1562
|
}
|
|
986
1563
|
});
|
|
987
1564
|
/**
|
|
988
|
-
*
|
|
1565
|
+
* Adds a listener for changes in the audio output device.
|
|
1566
|
+
* This function is platform-specific and currently only implemented for Android devices.
|
|
1567
|
+
* When the audio output device changes (e.g., switching from the phone speaker to a Bluetooth headset), the specified callback function is triggered.
|
|
1568
|
+
* This can be useful for applications that need to react to changes in audio routing, such as updating the UI to reflect the current output device.
|
|
989
1569
|
*
|
|
990
|
-
*
|
|
1570
|
+
* Note: This API is not available on iOS as of the current implementation. Attempting to use it on iOS will result in a rejected promise with an appropriate error message.
|
|
991
1571
|
*
|
|
992
|
-
* @param {Function}
|
|
1572
|
+
* @param {Function} callback - The function to be called when the audio output device changes. This function does not receive any parameters.
|
|
993
1573
|
* @memberof HMSSDK
|
|
1574
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/configure-your-device/speaker/audio-output-routing
|
|
994
1575
|
*/
|
|
995
1576
|
_defineProperty(this, "setAudioDeviceChangeListener", callback => {
|
|
996
1577
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function setAudioDeviceChangeListener', {
|
|
@@ -1003,9 +1584,15 @@ class HMSSDK {
|
|
|
1003
1584
|
});
|
|
1004
1585
|
} else {
|
|
1005
1586
|
console.log('API currently not available for iOS');
|
|
1006
|
-
return 'API currently not available for iOS';
|
|
1587
|
+
return Promise.reject('API currently not available for iOS');
|
|
1007
1588
|
}
|
|
1008
1589
|
});
|
|
1590
|
+
/**
|
|
1591
|
+
* Asynchronously retrieves a remote video track by its track ID.
|
|
1592
|
+
*
|
|
1593
|
+
* @param {string} trackId - The unique identifier for the remote video track to be retrieved.
|
|
1594
|
+
* @returns {Promise<HMSRemoteVideoTrack>} A promise that resolves to the encoded remote video track data.
|
|
1595
|
+
*/
|
|
1009
1596
|
_defineProperty(this, "getRemoteVideoTrackFromTrackId", async trackId => {
|
|
1010
1597
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getRemoteVideoTrackFromTrackId', {
|
|
1011
1598
|
id: this.id,
|
|
@@ -1017,17 +1604,33 @@ class HMSSDK {
|
|
|
1017
1604
|
});
|
|
1018
1605
|
return _HMSEncoder.HMSEncoder.encodeHmsRemoteVideoTrack(remoteVideoTrackData, this.id);
|
|
1019
1606
|
});
|
|
1607
|
+
/**
|
|
1608
|
+
* Retrieves a remote audio track by its track ID.
|
|
1609
|
+
*
|
|
1610
|
+
* @param {string} trackId - The unique identifier for the remote audio track to be retrieved.
|
|
1611
|
+
* @returns {Promise<HMSRemoteAudioTrack>} A promise that resolves to the encoded remote audio track data.
|
|
1612
|
+
*/
|
|
1020
1613
|
_defineProperty(this, "getRemoteAudioTrackFromTrackId", async trackId => {
|
|
1614
|
+
// Log the function call with the track ID for debugging purposes.
|
|
1021
1615
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getRemoteAudioTrackFromTrackId', {
|
|
1022
1616
|
id: this.id,
|
|
1023
1617
|
trackId
|
|
1024
1618
|
});
|
|
1619
|
+
|
|
1620
|
+
// Fetch the remote audio track data from the native HMSManager.
|
|
1025
1621
|
const remoteAudioTrackData = await _HMSManagerModule.default.getRemoteAudioTrackFromTrackId({
|
|
1026
1622
|
id: this.id,
|
|
1027
1623
|
trackId
|
|
1028
1624
|
});
|
|
1625
|
+
// Encode and return the remote audio track data.
|
|
1029
1626
|
return _HMSEncoder.HMSEncoder.encodeHmsRemoteAudioTrack(remoteAudioTrackData, this.id);
|
|
1030
1627
|
});
|
|
1628
|
+
/**
|
|
1629
|
+
* Retrieves a peer object based on the provided peer ID.
|
|
1630
|
+
*
|
|
1631
|
+
* @param {string} peerId - The ID of the peer to retrieve.
|
|
1632
|
+
* @returns {HMSPeer | undefined} An encoded HMSPeer object if the peer is found otherwise `undefined`.
|
|
1633
|
+
*/
|
|
1031
1634
|
_defineProperty(this, "getPeerFromPeerId", peerId => {
|
|
1032
1635
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function getPeerFromPeerId', {
|
|
1033
1636
|
id: this.id,
|
|
@@ -1130,12 +1733,39 @@ class HMSSDK {
|
|
|
1130
1733
|
enabled
|
|
1131
1734
|
});
|
|
1132
1735
|
});
|
|
1736
|
+
_defineProperty(this, "setPermissionsAcceptedOnAndroid", async () => {
|
|
1737
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
1738
|
+
Promise.reject('setPermissionsAcceptedOnAndroid API not available for iOS');
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function setPermissionsAcceptedOnAndroid', {
|
|
1742
|
+
id: this.id
|
|
1743
|
+
});
|
|
1744
|
+
return await _HMSManagerModule.default.setPermissionsAccepted({
|
|
1745
|
+
id: this.id
|
|
1746
|
+
});
|
|
1747
|
+
});
|
|
1133
1748
|
/**
|
|
1134
|
-
*
|
|
1749
|
+
* Registers an event listener for various HMS SDK events.
|
|
1135
1750
|
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1751
|
+
* This method allows the registration of callbacks for different types of events that can occur within the HMS SDK.
|
|
1752
|
+
* These events include but are not limited to updates about the room, peers, tracks, and errors.
|
|
1753
|
+
* The method dynamically adds listeners based on the specified action and associates them with a callback function
|
|
1754
|
+
* to handle the event. It ensures that only one subscription exists per event type to avoid duplicate listeners.
|
|
1755
|
+
*
|
|
1756
|
+
* @param {HMSUpdateListenerActions | HMSPIPListenerActions} action - The specific action/event to listen for.
|
|
1757
|
+
* @param {Function} callback - The callback function to execute when the event occurs. The specifics of the callback parameters depend on the event type.
|
|
1138
1758
|
* @memberof HMSSDK
|
|
1759
|
+
*
|
|
1760
|
+
* @example
|
|
1761
|
+
* hmsInstance.addEventListener(HMSUpdateListenerActions.ON_JOIN, (event) => {
|
|
1762
|
+
* console.log('Joined the room:', event);
|
|
1763
|
+
* });
|
|
1764
|
+
*
|
|
1765
|
+
* @example
|
|
1766
|
+
* hmsInstance.addEventListener(HMSUpdateListenerActions.ON_PEER_UPDATE, (event) => {
|
|
1767
|
+
* console.log('Peer update:', event);
|
|
1768
|
+
* });
|
|
1139
1769
|
*/
|
|
1140
1770
|
_defineProperty(this, "addEventListener", (action, callback) => {
|
|
1141
1771
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function addEventListener', {
|
|
@@ -1167,6 +1797,18 @@ class HMSSDK {
|
|
|
1167
1797
|
this.onJoinDelegate = callback;
|
|
1168
1798
|
break;
|
|
1169
1799
|
}
|
|
1800
|
+
case _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED:
|
|
1801
|
+
{
|
|
1802
|
+
// Checking if we already have ON_PERMISSIONS_REQUESTED subscription
|
|
1803
|
+
if (!this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED]) {
|
|
1804
|
+
// Adding ON_PERMISSIONS_REQUESTED native listener
|
|
1805
|
+
const permissionsRequestedSubscription = _HMSNativeEventListener.default.addListener(this.id, _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED, this.onPermissionsRequestedListener);
|
|
1806
|
+
this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED] = permissionsRequestedSubscription;
|
|
1807
|
+
}
|
|
1808
|
+
// Adding App Delegate listener
|
|
1809
|
+
this.onPermissionsRequestedDelegate = callback;
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1170
1812
|
case _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_ROOM_UPDATE:
|
|
1171
1813
|
{
|
|
1172
1814
|
// Checking if we already have ON_ROOM_UPDATE subscription
|
|
@@ -1436,11 +2078,21 @@ class HMSSDK {
|
|
|
1436
2078
|
}
|
|
1437
2079
|
});
|
|
1438
2080
|
/**
|
|
1439
|
-
*
|
|
2081
|
+
* Removes an event listener for a specified event action.
|
|
2082
|
+
*
|
|
2083
|
+
* This method allows for the deregistration of previously registered callbacks for specific event types within the HMS SDK.
|
|
2084
|
+
* By specifying the action and the callback, it ensures that the event listener associated with that action is removed,
|
|
2085
|
+
* preventing the callback from being executed when the event occurs in the future. This is useful for cleaning up resources
|
|
2086
|
+
* and avoiding potential memory leaks in applications that dynamically add and remove event listeners based on component lifecycle
|
|
2087
|
+
* or user interactions.
|
|
1440
2088
|
*
|
|
1441
|
-
* @param {
|
|
1442
|
-
* @param {
|
|
2089
|
+
* @param {HMSUpdateListenerActions | HMSPIPListenerActions} action - The specific action/event for which the listener is to be removed.
|
|
2090
|
+
* @param {Function} callback - The callback function that was originally registered for the event. This parameter is necessary to ensure
|
|
2091
|
+
* that only the specific callback associated with the action is removed.
|
|
1443
2092
|
* @memberof HMSSDK
|
|
2093
|
+
* @example
|
|
2094
|
+
* // Remove a listener for the ON_JOIN event
|
|
2095
|
+
* hmsInstance.removeEventListener(HMSUpdateListenerActions.ON_JOIN, onJoinCallback);
|
|
1444
2096
|
*/
|
|
1445
2097
|
_defineProperty(this, "removeEventListener", action => {
|
|
1446
2098
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function removeEventListener', {
|
|
@@ -1472,6 +2124,18 @@ class HMSSDK {
|
|
|
1472
2124
|
this.onJoinDelegate = null;
|
|
1473
2125
|
break;
|
|
1474
2126
|
}
|
|
2127
|
+
case _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED:
|
|
2128
|
+
{
|
|
2129
|
+
const subscription = this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED];
|
|
2130
|
+
// Removing ON_PERMISSIONS_REQUESTED native listener
|
|
2131
|
+
if (subscription) {
|
|
2132
|
+
subscription.remove();
|
|
2133
|
+
this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_PERMISSIONS_REQUESTED] = undefined;
|
|
2134
|
+
}
|
|
2135
|
+
// Removing App Delegate listener
|
|
2136
|
+
this.onPermissionsRequestedDelegate = null;
|
|
2137
|
+
break;
|
|
2138
|
+
}
|
|
1475
2139
|
case _HMSUpdateListenerActions.HMSUpdateListenerActions.ON_ROOM_UPDATE:
|
|
1476
2140
|
{
|
|
1477
2141
|
const subscription = this.emitterSubscriptions[_HMSUpdateListenerActions.HMSUpdateListenerActions.ON_ROOM_UPDATE];
|
|
@@ -1763,20 +2427,6 @@ class HMSSDK {
|
|
|
1763
2427
|
id: this.id
|
|
1764
2428
|
});
|
|
1765
2429
|
});
|
|
1766
|
-
/**
|
|
1767
|
-
* - Below are all the listeners that are connected to native side.
|
|
1768
|
-
*
|
|
1769
|
-
* - All of the are connected when build function is called, we can connect them to the app by
|
|
1770
|
-
* calling {@link addEventListener} with corresponding event type.
|
|
1771
|
-
*
|
|
1772
|
-
* - Before passing the data to the eventListener of the app these listeners encode the data in
|
|
1773
|
-
* ts classes for a proper structuring of the data.
|
|
1774
|
-
*
|
|
1775
|
-
* - Even When event listeners of the app are disconnected using {@link removeEventListener} or
|
|
1776
|
-
* {@link removeAllListeners} or not even connected in first place, these functions still run to
|
|
1777
|
-
* maintain the current state of the instance of {@link HMSSDK}.
|
|
1778
|
-
*
|
|
1779
|
-
*/
|
|
1780
2430
|
_defineProperty(this, "onPreviewListener", data => {
|
|
1781
2431
|
if (data.id !== this.id) {
|
|
1782
2432
|
return;
|
|
@@ -1808,6 +2458,17 @@ class HMSSDK {
|
|
|
1808
2458
|
});
|
|
1809
2459
|
}
|
|
1810
2460
|
});
|
|
2461
|
+
_defineProperty(this, "onPermissionsRequestedListener", data => {
|
|
2462
|
+
if (data.id !== this.id) {
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
if (this.onPermissionsRequestedDelegate) {
|
|
2466
|
+
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Listener ON_PERMISSIONS_REQUESTED_LISTENER_CALL', data);
|
|
2467
|
+
this.onPermissionsRequestedDelegate({
|
|
2468
|
+
...data
|
|
2469
|
+
});
|
|
2470
|
+
}
|
|
2471
|
+
});
|
|
1811
2472
|
_defineProperty(this, "onRoomListener", data => {
|
|
1812
2473
|
var _getHmsRoomCache2;
|
|
1813
2474
|
if (data.id !== this.id) {
|
|
@@ -2122,6 +2783,15 @@ class HMSSDK {
|
|
|
2122
2783
|
});
|
|
2123
2784
|
}
|
|
2124
2785
|
});
|
|
2786
|
+
/**
|
|
2787
|
+
* Listener for the `SessionStoreAvailable` event.
|
|
2788
|
+
*
|
|
2789
|
+
* This listener is triggered when the session store becomes available in the SDK. It is an important event
|
|
2790
|
+
* for developers who need to access or manipulate the session store after it has been initialized and made available.
|
|
2791
|
+
*
|
|
2792
|
+
* @param {Object} data - The event data.
|
|
2793
|
+
* @param {HMSSessionStore} data.sessionStore - The session store object that has been made available.
|
|
2794
|
+
*/
|
|
2125
2795
|
_defineProperty(this, "onSessionStoreAvailableListener", data => {
|
|
2126
2796
|
if (data.id !== this.id) {
|
|
2127
2797
|
return;
|
|
@@ -2134,8 +2804,20 @@ class HMSSDK {
|
|
|
2134
2804
|
});
|
|
2135
2805
|
}
|
|
2136
2806
|
});
|
|
2137
|
-
|
|
2138
|
-
*
|
|
2807
|
+
/**
|
|
2808
|
+
* Listener for the `PIPRoomLeave` event. Android only.
|
|
2809
|
+
*
|
|
2810
|
+
* This listener is triggered when a room is left from the Picture in Picture (PIP) mode, which is currently supported only on Android platforms.
|
|
2811
|
+
* It is an essential event for handling cleanup or UI updates when the user exits the room while in PIP mode.
|
|
2812
|
+
* @param {Object} data - The event data.
|
|
2813
|
+
* @memberof HMSSDK
|
|
2814
|
+
* @example
|
|
2815
|
+
* // Example of handling the `PIPRoomLeave` event
|
|
2816
|
+
* hms.onPIPRoomLeave((data) => {
|
|
2817
|
+
* // Handle PIP room leave event
|
|
2818
|
+
* });
|
|
2819
|
+
*
|
|
2820
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
2139
2821
|
*/
|
|
2140
2822
|
_defineProperty(this, "onPIPRoomLeaveListener", data => {
|
|
2141
2823
|
if (data.id !== this.id) {
|
|
@@ -2149,8 +2831,25 @@ class HMSSDK {
|
|
|
2149
2831
|
});
|
|
2150
2832
|
}
|
|
2151
2833
|
});
|
|
2152
|
-
|
|
2153
|
-
*
|
|
2834
|
+
/**
|
|
2835
|
+
* Listener for the `PIPModeChanged` event.
|
|
2836
|
+
* This listener is triggered when the Picture in Picture (PIP) mode is toggled on or off.
|
|
2837
|
+
* It is an important event for handling UI updates or other actions when the user enters or exits PIP mode.
|
|
2838
|
+
* @param {Object} data - The event data.
|
|
2839
|
+
* @param {boolean} data.isInPictureInPictureMode - A boolean value indicating whether the user is currently in PIP mode.
|
|
2840
|
+
* @returns {void} - Returns nothing.
|
|
2841
|
+
* @memberof HMSSDK
|
|
2842
|
+
* @example
|
|
2843
|
+
* // Example of handling the `PIPModeChanged` event
|
|
2844
|
+
* hms.onPIPModeChanged((data) => {
|
|
2845
|
+
* if (data.isInPictureInPictureMode) {
|
|
2846
|
+
* // Handle PIP mode enabled
|
|
2847
|
+
* } else {
|
|
2848
|
+
* // Handle PIP mode disabled
|
|
2849
|
+
* }
|
|
2850
|
+
* });
|
|
2851
|
+
*
|
|
2852
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
2154
2853
|
*/
|
|
2155
2854
|
_defineProperty(this, "onPIPModeChangedListener", data => {
|
|
2156
2855
|
if (this.onPIPModeChangedDelegate) {
|
|
@@ -2159,9 +2858,20 @@ class HMSSDK {
|
|
|
2159
2858
|
}
|
|
2160
2859
|
});
|
|
2161
2860
|
/**
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2861
|
+
* Updates the logger instance for this HMSSDK instance.
|
|
2862
|
+
*
|
|
2863
|
+
* This method allows for the dynamic updating of the logger instance used by the HMSSDK.
|
|
2864
|
+
* It can be used to change the logger settings or replace the logger entirely at runtime.
|
|
2865
|
+
* This is particularly useful for adjusting log levels or redirecting log output based on application state or user preferences.
|
|
2866
|
+
*
|
|
2867
|
+
* @param {HMSLogger} hmsLogger - The new logger instance to be used. If not provided, the logger will be reset to default.
|
|
2164
2868
|
* @memberof HMSSDK
|
|
2869
|
+
* @example
|
|
2870
|
+
* // Set a custom logger with a specific configuration
|
|
2871
|
+
* const customLogger = new HMSLogger();
|
|
2872
|
+
* customLogger.setLevel('verbose');
|
|
2873
|
+
* hmsInstance.setLogger(customLogger);
|
|
2874
|
+
*
|
|
2165
2875
|
*/
|
|
2166
2876
|
_defineProperty(this, "setLogger", hmsLogger => {
|
|
2167
2877
|
(0, _HMSLogger.setLogger)(this.id, hmsLogger);
|
|
@@ -2170,20 +2880,40 @@ class HMSSDK {
|
|
|
2170
2880
|
}
|
|
2171
2881
|
|
|
2172
2882
|
/**
|
|
2173
|
-
*
|
|
2174
|
-
* - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods.
|
|
2883
|
+
* Asynchronously builds and returns an instance of the HMSSDK class.
|
|
2175
2884
|
*
|
|
2176
|
-
*
|
|
2885
|
+
* This method initializes the HMSSDK with optional configuration parameters and returns the initialized instance.
|
|
2886
|
+
* It is responsible for setting up the SDK with specific settings for track management, app groups, extensions for iOS screen sharing,
|
|
2887
|
+
* logging configurations, etc.
|
|
2177
2888
|
*
|
|
2889
|
+
*
|
|
2890
|
+
* @param {Object} params - Optional configuration parameters for initializing the HMSSDK.
|
|
2891
|
+
* @param {trackSettings} params.trackSettings is an optional value only required to enable features like iOS Screen/Audio Share, Android Software Echo Cancellation, etc
|
|
2892
|
+
* @param {appGroup} params.appGroup is an optional value only required for implementing Screen & Audio Share on iOS. They are not required for Android. DO NOT USE if your app does not implements Screen or Audio Share on iOS.
|
|
2893
|
+
* @param {preferredExtension} params.preferredExtension is an optional value only required for implementing Screen & Audio Share on iOS. They are not required for Android. DO NOT USE if your app does not implements Screen or Audio Share on iOS.
|
|
2894
|
+
* @param {boolean} params.haltPreviewJoinForPermissionsRequestOnAndroid - Optional flag to halt the preview/join process until permissions are explicitly granted by the user. Android only. This is particularly useful when you might want to request permissions before proceeding with the preview or join operation.
|
|
2895
|
+
* @param {HMSLogSettings} params.logSettings - Optional settings for logging.
|
|
2896
|
+
*
|
|
2897
|
+
* @returns {Promise<HMSSDK>} A promise that resolves to an instance of HMSSDK.
|
|
2898
|
+
* @throws {Error} If the HMSSDK instance cannot be created.
|
|
2899
|
+
*
|
|
2900
|
+
* @example
|
|
2901
|
+
* // Regular usage:
|
|
2178
2902
|
* const hmsInstance = await HMSSDK.build();
|
|
2179
2903
|
*
|
|
2180
|
-
*
|
|
2181
|
-
*
|
|
2182
|
-
*
|
|
2183
|
-
*
|
|
2904
|
+
* @example
|
|
2905
|
+
* // Advanced Usage:
|
|
2906
|
+
* const hmsInstance = await HMSSDK.build({
|
|
2907
|
+
* trackSettings: {...},
|
|
2908
|
+
* appGroup: 'group.example',
|
|
2909
|
+
* preferredExtension: 'com.example.extension',
|
|
2910
|
+
* logSettings: {...},
|
|
2911
|
+
* });
|
|
2184
2912
|
*
|
|
2913
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/install-the-sdk/hmssdk
|
|
2185
2914
|
* @static
|
|
2186
|
-
* @
|
|
2915
|
+
* @async
|
|
2916
|
+
* @function build
|
|
2187
2917
|
* @memberof HMSSDK
|
|
2188
2918
|
*/
|
|
2189
2919
|
static async build(params) {
|
|
@@ -2197,6 +2927,8 @@ class HMSSDK {
|
|
|
2197
2927
|
} = ReactNativeVersion.version;
|
|
2198
2928
|
let id = await _HMSManagerModule.default.build({
|
|
2199
2929
|
trackSettings: params === null || params === void 0 ? void 0 : params.trackSettings,
|
|
2930
|
+
haltPreviewJoinForPermissionsRequest: params === null || params === void 0 ? void 0 : params.haltPreviewJoinForPermissionsRequestOnAndroid,
|
|
2931
|
+
// required for Android Permissions, not required for iOS
|
|
2200
2932
|
appGroup: params === null || params === void 0 ? void 0 : params.appGroup,
|
|
2201
2933
|
// required for iOS Screenshare, not required for Android
|
|
2202
2934
|
preferredExtension: params === null || params === void 0 ? void 0 : params.preferredExtension,
|
|
@@ -2211,8 +2943,29 @@ class HMSSDK {
|
|
|
2211
2943
|
HmsSdk = new HMSSDK(id);
|
|
2212
2944
|
return HmsSdk;
|
|
2213
2945
|
}
|
|
2214
|
-
|
|
2946
|
+
/**
|
|
2215
2947
|
* - This function is used to check if Picture in Picture mode is supported on the device
|
|
2948
|
+
* @returns {Promise<boolean>} - Returns a boolean value indicating whether Picture in Picture mode is supported on the device.
|
|
2949
|
+
* @memberof HMSSDK
|
|
2950
|
+
* @example
|
|
2951
|
+
* // Example of checking if Picture in Picture mode is supported
|
|
2952
|
+
* const isPipModeSupported = await hms.isPipModeSupported();
|
|
2953
|
+
* if (isPipModeSupported) {
|
|
2954
|
+
* // Picture in Picture mode is supported
|
|
2955
|
+
* } else {
|
|
2956
|
+
* // Picture in Picture mode is not supported
|
|
2957
|
+
* }
|
|
2958
|
+
* @example
|
|
2959
|
+
* // Example of checking if Picture in Picture mode is supported
|
|
2960
|
+
* hms.isPipModeSupported().then((isPipModeSupported) => {
|
|
2961
|
+
* if (isPipModeSupported) {
|
|
2962
|
+
* // Picture in Picture mode is supported
|
|
2963
|
+
* } else {
|
|
2964
|
+
* // Picture in Picture mode is not supported
|
|
2965
|
+
* }
|
|
2966
|
+
* });
|
|
2967
|
+
*
|
|
2968
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
2216
2969
|
*/
|
|
2217
2970
|
async isPipModeSupported() {
|
|
2218
2971
|
const data = {
|
|
@@ -2222,8 +2975,36 @@ class HMSSDK {
|
|
|
2222
2975
|
return _HMSManagerModule.default.handlePipActions('isPipModeSupported', data);
|
|
2223
2976
|
}
|
|
2224
2977
|
|
|
2225
|
-
|
|
2226
|
-
*
|
|
2978
|
+
/**
|
|
2979
|
+
* Asynchronously enters Picture in Picture (PIP) mode with optional configuration.
|
|
2980
|
+
*
|
|
2981
|
+
* This method attempts to enter PIP mode based on the provided configuration.
|
|
2982
|
+
* It returns a promise that resolves to a boolean indicating the success of the operation.
|
|
2983
|
+
* If PIP mode is not supported or fails to activate, the promise may resolve to `undefined` or `false`.
|
|
2984
|
+
*
|
|
2985
|
+
* @param {HMSPIPConfig} [data] - Optional configuration for entering PIP mode. This can include settings such as `autoEnterPipMode` and `aspectRatio`.
|
|
2986
|
+
* @returns {Promise<boolean>} - A promise that resolves to `true` if PIP mode was successfully entered, `false` if unsuccessful or PIP mode is not supported.
|
|
2987
|
+
* @throws {Error} - Throws an error if the operation fails.
|
|
2988
|
+
* @memberof HMSSDK
|
|
2989
|
+
* @example
|
|
2990
|
+
* // Example of entering Picture in Picture mode
|
|
2991
|
+
* hms.enterPipMode().then((success) => {
|
|
2992
|
+
* if (success) {
|
|
2993
|
+
* // Picture in Picture mode entered successfully
|
|
2994
|
+
* } else {
|
|
2995
|
+
* // Picture in Picture mode could not be entered
|
|
2996
|
+
* }
|
|
2997
|
+
* });
|
|
2998
|
+
* @example
|
|
2999
|
+
* // Example of entering Picture in Picture mode with configuration
|
|
3000
|
+
* const success = await hms.enterPipMode({ autoEnterPipMode: true, aspectRatio: [16,9] });
|
|
3001
|
+
* if (success) {
|
|
3002
|
+
* // Picture in Picture mode entered successfully
|
|
3003
|
+
* } else {
|
|
3004
|
+
* // Picture in Picture mode could not be entered
|
|
3005
|
+
* }
|
|
3006
|
+
*
|
|
3007
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
2227
3008
|
*/
|
|
2228
3009
|
async enterPipMode(data) {
|
|
2229
3010
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function enterPipMode', data);
|
|
@@ -2233,8 +3014,26 @@ class HMSSDK {
|
|
|
2233
3014
|
});
|
|
2234
3015
|
}
|
|
2235
3016
|
|
|
2236
|
-
|
|
2237
|
-
*
|
|
3017
|
+
/**
|
|
3018
|
+
* Asynchronously sets the parameters for Picture in Picture (PIP) mode.
|
|
3019
|
+
*
|
|
3020
|
+
* This method configures the PIP window according to the provided `HMSPIPConfig` settings. It can be used to adjust various aspects of the PIP mode, such as its size, aspect ratio, and more. The method returns a promise that resolves to a boolean indicating the success of the operation. If the PIP mode is not supported or the configuration fails, the promise may resolve to `undefined` or `false`.
|
|
3021
|
+
*
|
|
3022
|
+
* @param {HMSPIPConfig} [data] - Optional configuration for setting PIP mode parameters. This can include settings such as `aspectRatio`, `autoEnterPipMode`, etc.
|
|
3023
|
+
* @returns {Promise<boolean | undefined>} - A promise that resolves to `true` if the PIP parameters were successfully set, `false` if unsuccessful. `undefined` may be returned if PIP mode is not supported.
|
|
3024
|
+
* @throws {Error} - Throws an error if the operation fails.
|
|
3025
|
+
* @memberof HMSSDK
|
|
3026
|
+
* @example
|
|
3027
|
+
* // Example of setting Picture in Picture mode parameters
|
|
3028
|
+
* hms.setPipParams({ aspectRatio: [16, 9], autoEnterPipMode: true }).then((success) => {
|
|
3029
|
+
* if (success) {
|
|
3030
|
+
* // Picture in Picture mode parameters set successfully
|
|
3031
|
+
* } else {
|
|
3032
|
+
* // Picture in Picture mode parameters could not be set
|
|
3033
|
+
* }
|
|
3034
|
+
* });
|
|
3035
|
+
*
|
|
3036
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
2238
3037
|
*/
|
|
2239
3038
|
async setPipParams(data) {
|
|
2240
3039
|
return _HMSManagerModule.default.handlePipActions('setPictureInPictureParams', {
|
|
@@ -2243,29 +3042,88 @@ class HMSSDK {
|
|
|
2243
3042
|
});
|
|
2244
3043
|
}
|
|
2245
3044
|
|
|
2246
|
-
|
|
2247
|
-
*
|
|
3045
|
+
/**
|
|
3046
|
+
* Changes the video track used in Picture in Picture (PIP) mode on iOS devices.
|
|
3047
|
+
*
|
|
3048
|
+
* This function is specifically designed for iOS platforms to switch the video track displayed in PIP mode.
|
|
3049
|
+
* It takes a `HMSVideoTrack` object as an argument, which contains the track ID of the video track to be displayed in PIP mode.
|
|
3050
|
+
* This allows for dynamic changes to the video source in PIP mode, enhancing the flexibility of video presentation in applications that support PIP.
|
|
3051
|
+
*
|
|
3052
|
+
* @param {HMSVideoTrack} track - The video track to be used in PIP mode. Must contain a valid `trackId`.
|
|
3053
|
+
* @returns {Promise} - A promise that resolves when the video track has been successfully changed for PIP mode, or rejects with an error if the operation fails.
|
|
3054
|
+
* @throws {Error} - Throws an error if the operation fails.
|
|
3055
|
+
* @async
|
|
3056
|
+
* @function changeIOSPIPVideoTrack
|
|
3057
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
3058
|
+
* @memberof HMSSDK
|
|
3059
|
+
* @example
|
|
3060
|
+
* // Example of changing the video track for PIP mode on iOS
|
|
3061
|
+
* hms.changeIOSPIPVideoTrack(videoTrack).then(() => {
|
|
3062
|
+
* console.log('Video track for PIP mode changed successfully');
|
|
3063
|
+
* }).catch(error => {
|
|
3064
|
+
* console.error('Failed to change video track for PIP mode', error);
|
|
3065
|
+
* });
|
|
3066
|
+
*
|
|
2248
3067
|
*/
|
|
2249
3068
|
async changeIOSPIPVideoTrack(track) {
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
3069
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
3070
|
+
const data = {
|
|
3071
|
+
id: this.id,
|
|
3072
|
+
trackId: track.trackId
|
|
3073
|
+
};
|
|
3074
|
+
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function changeIOSPIPVideoTrack', data);
|
|
3075
|
+
return await _HMSManagerModule.default.changeIOSPIPVideoTrack(data);
|
|
3076
|
+
} else {
|
|
3077
|
+
return Promise.resolve(false);
|
|
3078
|
+
}
|
|
2256
3079
|
}
|
|
2257
3080
|
|
|
2258
|
-
|
|
2259
|
-
* -
|
|
3081
|
+
/**
|
|
3082
|
+
* - This function is used to automatically switch the video track of the active speaker to the Picture in Picture (PIP) mode window on iOS devices.
|
|
3083
|
+
* - When enabled, the video track of the active speaker will be displayed in the PIP mode window, providing a focused view of the current speaker during a meeting or conference.
|
|
3084
|
+
* @param {boolean} enable - A boolean value indicating whether to enable or disable the automatic switching of the active speaker video track in PIP mode.
|
|
3085
|
+
* @returns {Promise} - A promise that resolves when the operation is successful, or rejects with an error if the operation fails.
|
|
3086
|
+
* @throws {Error} - Throws an error if the operation fails.
|
|
3087
|
+
* @async
|
|
3088
|
+
* @function setActiveSpeakerInIOSPIP
|
|
3089
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/pip-mode
|
|
3090
|
+
* @memberof HMSSDK
|
|
3091
|
+
* @example
|
|
3092
|
+
* // Example of enabling the automatic switching of the active speaker video track in PIP mode
|
|
3093
|
+
* hms.setActiveSpeakerInIOSPIP(true).then(() => {
|
|
3094
|
+
* console.log('Active speaker video track enabled in PIP mode');
|
|
3095
|
+
* }).catch(error => {
|
|
3096
|
+
* console.error('Failed to enable active speaker video track in PIP mode', error);
|
|
3097
|
+
* });
|
|
2260
3098
|
*/
|
|
2261
3099
|
async setActiveSpeakerInIOSPIP(enable) {
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
3100
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
3101
|
+
const data = {
|
|
3102
|
+
id: this.id,
|
|
3103
|
+
enable
|
|
3104
|
+
};
|
|
3105
|
+
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function setActiveSpeakerInIOSPIP', data);
|
|
3106
|
+
return await _HMSManagerModule.default.setActiveSpeakerInIOSPIP(data);
|
|
3107
|
+
} else {
|
|
3108
|
+
return Promise.resolve(false);
|
|
3109
|
+
}
|
|
2268
3110
|
}
|
|
3111
|
+
|
|
3112
|
+
/**
|
|
3113
|
+
* Initiates real-time transcription services.
|
|
3114
|
+
*
|
|
3115
|
+
* This asynchronous function triggers the HMSManager to start real-time transcription services,
|
|
3116
|
+
* capturing and transcribing audio in real time.
|
|
3117
|
+
*
|
|
3118
|
+
* @async
|
|
3119
|
+
* @function startRealTimeTranscription
|
|
3120
|
+
* @memberof HMSSDK
|
|
3121
|
+
* @example
|
|
3122
|
+
* // Example of starting real-time transcription services
|
|
3123
|
+
* await hmsInstance.startRealTimeTranscription();
|
|
3124
|
+
*
|
|
3125
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/extend-capabilities/live-captions
|
|
3126
|
+
*/
|
|
2269
3127
|
async startRealTimeTranscription() {
|
|
2270
3128
|
const data = {
|
|
2271
3129
|
id: this.id,
|
|
@@ -2274,6 +3132,20 @@ class HMSSDK {
|
|
|
2274
3132
|
_HMSLogger.logger === null || _HMSLogger.logger === void 0 || _HMSLogger.logger.verbose('#Function startRealTimeTranscription', data);
|
|
2275
3133
|
return _HMSManagerModule.default.handleRealTimeTranscription(data);
|
|
2276
3134
|
}
|
|
3135
|
+
|
|
3136
|
+
/**
|
|
3137
|
+
* Stops the real-time transcription services.
|
|
3138
|
+
*
|
|
3139
|
+
* This asynchronous function signals the HMSManager to terminate the ongoing real-time transcription services.
|
|
3140
|
+
*
|
|
3141
|
+
* @async
|
|
3142
|
+
* @function stopRealTimeTranscription
|
|
3143
|
+
* @memberof HMSSDK
|
|
3144
|
+
* @example
|
|
3145
|
+
* await hmsInstance.stopRealTimeTranscription();
|
|
3146
|
+
*
|
|
3147
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/extend-capabilities/live-captions
|
|
3148
|
+
*/
|
|
2277
3149
|
async stopRealTimeTranscription() {
|
|
2278
3150
|
const data = {
|
|
2279
3151
|
id: this.id,
|
|
@@ -2290,9 +3162,15 @@ class HMSSDK {
|
|
|
2290
3162
|
}
|
|
2291
3163
|
|
|
2292
3164
|
/**
|
|
2293
|
-
*
|
|
2294
|
-
*
|
|
3165
|
+
* Retrieves the current logger instance used by the HMSSDK.
|
|
3166
|
+
*
|
|
3167
|
+
* This static method provides access to the logger instance, allowing for the manipulation of log levels and the retrieval of log information. It is useful for debugging purposes, enabling developers to monitor and adjust the verbosity of logs generated by the HMS SDK.
|
|
3168
|
+
*
|
|
3169
|
+
* @returns {HMSLogger} The current logger instance.
|
|
2295
3170
|
* @memberof HMSSDK
|
|
3171
|
+
* @example
|
|
3172
|
+
* const logger = HMSSDK.getLogger();
|
|
3173
|
+
* logger.setLevel('debug'); // Adjusting the log level to debug
|
|
2296
3174
|
*/
|
|
2297
3175
|
static getLogger() {
|
|
2298
3176
|
return (0, _HMSLogger.getLogger)();
|