@100mslive/react-native-hms 0.9.1 → 0.9.2
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 +239 -26
- package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +10 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +27 -1
- package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +2 -2
- package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +34 -5
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +11 -0
- package/ios/HmsDecoder.swift +35 -2
- package/ios/HmsHelper.swift +14 -0
- package/ios/HmsSDK.swift +4 -3
- package/lib/commonjs/classes/HMSEncoder.js +17 -1
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSConfig.js +3 -0
- package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSRecordingConfig.js +23 -0
- package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -0
- package/lib/commonjs/classes/HMSHLSRecordingState.js +29 -0
- package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -0
- package/lib/commonjs/classes/HMSLogger.js +21 -21
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSMessage.js +4 -1
- package/lib/commonjs/classes/HMSMessage.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js +26 -0
- package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -0
- package/lib/commonjs/classes/HMSMessageRecipientType.js +15 -0
- package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -0
- package/lib/commonjs/classes/HMSPeerUpdate.js +0 -8
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js +3 -0
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +16 -3
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/index.js +56 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +16 -1
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSHLSConfig.js +3 -0
- package/lib/module/classes/HMSHLSConfig.js.map +1 -1
- package/lib/module/classes/HMSHLSRecordingConfig.js +14 -0
- package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -0
- package/lib/module/classes/HMSHLSRecordingState.js +20 -0
- package/lib/module/classes/HMSHLSRecordingState.js.map +1 -0
- package/lib/module/classes/HMSLogger.js +21 -21
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSMessage.js +4 -1
- package/lib/module/classes/HMSMessage.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipient.js +17 -0
- package/lib/module/classes/HMSMessageRecipient.js.map +1 -0
- package/lib/module/classes/HMSMessageRecipientType.js +8 -0
- package/lib/module/classes/HMSMessageRecipientType.js.map +1 -0
- package/lib/module/classes/HMSPeerUpdate.js +0 -8
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSRoom.js +3 -0
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +16 -3
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSEncoder.d.ts +2 -0
- package/lib/typescript/classes/HMSHLSConfig.d.ts +5 -2
- package/lib/typescript/classes/HMSHLSRecordingConfig.d.ts +8 -0
- package/lib/typescript/classes/HMSHLSRecordingState.d.ts +12 -0
- package/lib/typescript/classes/HMSMessage.d.ts +8 -4
- package/lib/typescript/classes/HMSMessageRecipient.d.ts +13 -0
- package/lib/typescript/classes/HMSMessageRecipientType.d.ts +5 -0
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -9
- package/lib/typescript/classes/HMSRoom.d.ts +3 -0
- package/lib/typescript/classes/HMSSDK.d.ts +294 -7
- package/lib/typescript/index.d.ts +4 -0
- package/package.json +1 -1
- package/react-native-hms.podspec +1 -1
- package/src/classes/HMSEncoder.ts +47 -16
- package/src/classes/HMSHLSConfig.ts +8 -2
- package/src/classes/HMSHLSRecordingConfig.ts +9 -0
- package/src/classes/HMSHLSRecordingState.ts +18 -0
- package/src/classes/HMSLogger.ts +3 -3
- package/src/classes/HMSMessage.ts +11 -5
- package/src/classes/HMSMessageRecipient.ts +19 -0
- package/src/classes/HMSMessageRecipientType.ts +5 -0
- package/src/classes/HMSPeerUpdate.ts +0 -8
- package/src/classes/HMSRoom.ts +4 -0
- package/src/classes/HMSSDK.tsx +297 -8
- package/src/index.ts +4 -0
|
@@ -51,7 +51,7 @@ export declare class HMSSDK {
|
|
|
51
51
|
constructor(id: string);
|
|
52
52
|
/**
|
|
53
53
|
* - Returns an instance of [HMSSDK]{@link HMSSDK}
|
|
54
|
-
* - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods
|
|
54
|
+
* - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods.
|
|
55
55
|
*
|
|
56
56
|
* @static
|
|
57
57
|
* @returns
|
|
@@ -60,58 +60,332 @@ export declare class HMSSDK {
|
|
|
60
60
|
static build(params?: {
|
|
61
61
|
trackSettings: HMSTrackSettings;
|
|
62
62
|
}): Promise<HMSSDK>;
|
|
63
|
+
/**
|
|
64
|
+
* - Returns the instance of logger which can be used to manipulate log levels.
|
|
65
|
+
* @returns @instance HMSLogger
|
|
66
|
+
* @memberof HMSSDK
|
|
67
|
+
*/
|
|
63
68
|
static getLogger(): HMSLogger | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* - Updates the logger for this instance of HMSSDK
|
|
71
|
+
* @param {HMSLogger} hmsLogger
|
|
72
|
+
* @memberof HMSSDK
|
|
73
|
+
*/
|
|
64
74
|
setLogger: (hmsLogger: HMSLogger) => void;
|
|
75
|
+
/**
|
|
76
|
+
* - Calls removeListeners that in turn breaks all connections with native listeners.
|
|
77
|
+
*
|
|
78
|
+
* @memberof HMSSDK
|
|
79
|
+
*/
|
|
65
80
|
destroy: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* - Attaches preview listener for native callbacks.
|
|
83
|
+
* Note:this function connects sdk to native side and not app to sdk.
|
|
84
|
+
*
|
|
85
|
+
* @memberof HMSSDK
|
|
86
|
+
*/
|
|
66
87
|
attachPreviewListener: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* - Attaches all the listeners to native callbacks.
|
|
90
|
+
* Note: this function connects sdk to native side and not app to sdk.
|
|
91
|
+
* @memberof HMSSDK
|
|
92
|
+
*/
|
|
67
93
|
attachListeners: () => void;
|
|
94
|
+
/**
|
|
95
|
+
* Disconnects all the listeners of this sdk from native listeners.
|
|
96
|
+
* Note: this function is only called from destroy function and should only be called when the current instance of {@link HMSSDK} is not required anymore.
|
|
97
|
+
* @memberof HMSSDK
|
|
98
|
+
*/
|
|
68
99
|
removeListeners: () => void;
|
|
69
100
|
/**
|
|
70
|
-
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room
|
|
71
|
-
* after joining the room user will start receiving the events and updates of the room
|
|
101
|
+
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room.
|
|
102
|
+
* after joining the room user will start receiving the events and updates of the room.
|
|
103
|
+
*
|
|
104
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/join} for more info
|
|
72
105
|
*
|
|
73
106
|
* @param {HMSConfig} config
|
|
74
107
|
* @memberof HMSSDK
|
|
75
108
|
*/
|
|
76
109
|
join: (config: HMSConfig) => Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* - preview function is used to initiate a preview for the localPeer.
|
|
112
|
+
* - We can call this function and wait for a response in previewListener, the response will contain previewTracks for local peer.
|
|
113
|
+
*
|
|
114
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/preview} for more info
|
|
115
|
+
*
|
|
116
|
+
* @param {HMSConfig} config
|
|
117
|
+
* @memberof HMSSDK
|
|
118
|
+
*/
|
|
77
119
|
preview: (config: HMSConfig) => void;
|
|
120
|
+
/**
|
|
121
|
+
* - previewForRole can be used when there is role change request for current localPeer and we want
|
|
122
|
+
* to show the localPeer how the tracks look before publishing them to room.
|
|
123
|
+
*
|
|
124
|
+
* - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
|
|
125
|
+
*
|
|
126
|
+
* checkout {@link https://www.100ms.live/docs/react-native} for more info
|
|
127
|
+
*
|
|
128
|
+
* @param {HMSRole}
|
|
129
|
+
* @memberof HMSSDK
|
|
130
|
+
*/
|
|
78
131
|
previewForRole: (role: HMSRole) => Promise<any>;
|
|
132
|
+
/**
|
|
133
|
+
* - HmsView is react component that takes one track and starts showing that track on a tile.
|
|
134
|
+
* - The appearance of tile is completely customizable with style prop.
|
|
135
|
+
* - setting sink true or false for a video tile will add or remove sink for a video.
|
|
136
|
+
* - scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
|
|
137
|
+
*
|
|
138
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
|
|
139
|
+
*
|
|
140
|
+
* @param {HmsComponentProps}
|
|
141
|
+
* @memberof HMSSDK
|
|
142
|
+
*/
|
|
79
143
|
HmsView: ({ sink, trackId, style, mirror, scaleType, }: HmsComponentProps) => JSX.Element;
|
|
80
144
|
/**
|
|
81
|
-
* Calls leave function of native sdk and session of current user is invalidated
|
|
145
|
+
* Calls leave function of native sdk and session of current user is invalidated.
|
|
146
|
+
*
|
|
147
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/leave} for more info
|
|
82
148
|
*
|
|
83
149
|
* @memberof HMSSDK
|
|
84
150
|
*/
|
|
85
151
|
leave: () => Promise<any>;
|
|
152
|
+
/**
|
|
153
|
+
* - This function sends message to all the peers in the room, the get the message in onMessage listener.
|
|
154
|
+
*
|
|
155
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
156
|
+
*
|
|
157
|
+
* @param {message: string} and @param {type: string}
|
|
158
|
+
* @memberof HMSSDK
|
|
159
|
+
*/
|
|
86
160
|
sendBroadcastMessage: (message: string, type?: string) => Promise<any>;
|
|
161
|
+
/**
|
|
162
|
+
* - sendGroupMessage sends a message to specific set of roles, whoever has any of those role in room
|
|
163
|
+
* will get the message in onMessage listener.
|
|
164
|
+
*
|
|
165
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
166
|
+
*
|
|
167
|
+
* @memberof HMSSDK
|
|
168
|
+
*/
|
|
87
169
|
sendGroupMessage: (message: string, roles: HMSRole[], type?: string) => Promise<any>;
|
|
170
|
+
/**
|
|
171
|
+
* - sendDirectMessage sends a private message to a single peer, only that peer will get the message
|
|
172
|
+
* in onMessage Listener.
|
|
173
|
+
*
|
|
174
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
175
|
+
*
|
|
176
|
+
* @memberof HMSSDK
|
|
177
|
+
*/
|
|
88
178
|
sendDirectMessage: (message: string, peer: HMSPeer, type?: string) => Promise<any>;
|
|
179
|
+
/**
|
|
180
|
+
* - changeMetadata changes a specific field in localPeer which is [metadata] it is a string that can
|
|
181
|
+
* be used for various functionalities like raiseHand, beRightBack and many more that explains the
|
|
182
|
+
* current status of the peer.
|
|
183
|
+
*
|
|
184
|
+
* - it is advised to use a json object in string format to store multiple dataPoints in metadata.
|
|
185
|
+
*
|
|
186
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-metadata} for more info
|
|
187
|
+
*
|
|
188
|
+
* @param {string}
|
|
189
|
+
* @memberof HMSSDK
|
|
190
|
+
*/
|
|
89
191
|
changeMetadata: (metadata: string) => void;
|
|
192
|
+
/**
|
|
193
|
+
* - startRTMPOrRecording takes a configuration object {@link HMSRTMPConfig} and stats the RTMP recording
|
|
194
|
+
* - this object of {@link HMSRTMPConfig} sets the urls for streaming and weather to set recording on or not
|
|
195
|
+
* - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
|
|
196
|
+
*
|
|
197
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
|
|
198
|
+
*
|
|
199
|
+
* @memberof HMSSDK
|
|
200
|
+
*/
|
|
90
201
|
startRTMPOrRecording: (data: HMSRTMPConfig) => Promise<any>;
|
|
202
|
+
/**
|
|
203
|
+
* - this function stops all the ongoing RTMP streaming and recording.
|
|
204
|
+
* - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
|
|
205
|
+
*
|
|
206
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
|
|
207
|
+
*
|
|
208
|
+
* @memberof HMSSDK
|
|
209
|
+
*/
|
|
91
210
|
stopRtmpAndRecording: () => Promise<any>;
|
|
211
|
+
/**
|
|
212
|
+
* - This function starts HLSStreaming.
|
|
213
|
+
* - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
|
|
214
|
+
*
|
|
215
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
|
|
216
|
+
*
|
|
217
|
+
* @param {HMSHLSConfig}
|
|
218
|
+
* @memberof HMSSDK
|
|
219
|
+
*/
|
|
92
220
|
startHLSStreaming: (data: HMSHLSConfig) => Promise<any>;
|
|
221
|
+
/**
|
|
222
|
+
* - stopHLSStreaming function stops the ongoing HLSStreams.
|
|
223
|
+
* - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
|
|
224
|
+
*
|
|
225
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
|
|
226
|
+
*
|
|
227
|
+
* @memberof HMSSDK
|
|
228
|
+
*/
|
|
93
229
|
stopHLSStreaming: () => Promise<any>;
|
|
230
|
+
/**
|
|
231
|
+
* - This function can be used in a situation when we want to change role hence manipulate their
|
|
232
|
+
* access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
|
|
233
|
+
* role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
|
|
234
|
+
* the role or ask the to accept the role change request using a boolean force.
|
|
235
|
+
*
|
|
236
|
+
* - if we change the role forcefully the peer's role will be updated without asking the peer
|
|
237
|
+
* otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
|
|
238
|
+
* for more information on this checkout {@link onRoleChangeRequestListener}
|
|
239
|
+
*
|
|
240
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
241
|
+
*
|
|
242
|
+
* @memberof HMSSDK
|
|
243
|
+
*/
|
|
94
244
|
changeRole: (peer: HMSPeer, role: HMSRole, force?: boolean) => Promise<any>;
|
|
245
|
+
/**
|
|
246
|
+
* - This function can be used to manipulate mute status of any track.
|
|
247
|
+
* - Targeted peer affected by this action will get a callback in {@link onChangeTrackStateRequestListener}.
|
|
248
|
+
*
|
|
249
|
+
* * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-track-state} for more info
|
|
250
|
+
*
|
|
251
|
+
* @param {HMSTrack}
|
|
252
|
+
* @memberof HMSSDK
|
|
253
|
+
*/
|
|
95
254
|
changeTrackState: (track: HMSTrack, mute: boolean) => Promise<any>;
|
|
255
|
+
/**
|
|
256
|
+
* - changeTrackStateForRoles is an enhancement on the functionality of {@link changeTrackState}.
|
|
257
|
+
* - We can change mute status for all the tracks of peers having a particular role.
|
|
258
|
+
* - @param source determines the source of the track ex. video, audio etc.
|
|
259
|
+
* - The peers affected by this action will get a callback in {@link onChangeTrackStateRequestListener}.
|
|
260
|
+
*
|
|
261
|
+
* @memberof HMSSDK
|
|
262
|
+
*/
|
|
96
263
|
changeTrackStateForRoles: (mute: boolean, type?: HMSTrackType | undefined, source?: string | undefined, roles?: HMSRole[] | undefined) => Promise<any>;
|
|
264
|
+
/**
|
|
265
|
+
* - removePeer can forcefully disconnect a Peer from the room.
|
|
266
|
+
* - the user who's removed from this action will get a callback in {@link onRemovedFromRoomListener}.
|
|
267
|
+
*
|
|
268
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/remove-peer} for more info
|
|
269
|
+
*
|
|
270
|
+
* @memberof HMSSDK
|
|
271
|
+
*/
|
|
97
272
|
removePeer: (peer: HMSPeer, reason: string) => Promise<any>;
|
|
273
|
+
/**
|
|
274
|
+
* - endRoom can be used in a situation where we want to disconnect all the peers from current room
|
|
275
|
+
* and end the call.
|
|
276
|
+
* - everyone in the room will get an update of this action in {@link onRemovedFromRoomListener}.
|
|
277
|
+
*
|
|
278
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/end-room} for more info
|
|
279
|
+
*
|
|
280
|
+
* @memberof HMSSDK
|
|
281
|
+
*/
|
|
98
282
|
endRoom: (reason: string, lock?: boolean) => Promise<any>;
|
|
283
|
+
/**
|
|
284
|
+
* - This function can be used to change name of localPeer.
|
|
285
|
+
*
|
|
286
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-name} for more info
|
|
287
|
+
*
|
|
288
|
+
* @memberof HMSSDK
|
|
289
|
+
*/
|
|
99
290
|
changeName: (name: string) => Promise<any>;
|
|
291
|
+
/**
|
|
292
|
+
* - Calling this function will accept the most recent roleChange request made by anyone in the room
|
|
293
|
+
*
|
|
294
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
295
|
+
*
|
|
296
|
+
* @memberof HMSSDK
|
|
297
|
+
*/
|
|
100
298
|
acceptRoleChange: () => Promise<any>;
|
|
299
|
+
/**
|
|
300
|
+
* - setPlaybackForAllAudio is an extension of the abilities of {@link setPlaybackAllowed} in
|
|
301
|
+
* {@link HMSRemoteAudioTrack}, it sets mute status for all peers in the room
|
|
302
|
+
*
|
|
303
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/playback-allowed} for more info
|
|
304
|
+
*
|
|
305
|
+
* @memberof HMSSDK
|
|
306
|
+
*/
|
|
101
307
|
setPlaybackForAllAudio: (mute: boolean) => void;
|
|
308
|
+
/**
|
|
309
|
+
* - This function mutes audio for all peers in the room.
|
|
310
|
+
*
|
|
311
|
+
* @memberof HMSSDK
|
|
312
|
+
*/
|
|
102
313
|
remoteMuteAllAudio: () => void;
|
|
314
|
+
/**
|
|
315
|
+
* - getRoom is a wrapper function on an existing native function also known as getRoom the returns
|
|
316
|
+
* current room object which is of type {@link HMSRoom}
|
|
317
|
+
*
|
|
318
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/room} for more info
|
|
319
|
+
*
|
|
320
|
+
* @memberof HMSSDK
|
|
321
|
+
* @return HMSRoom
|
|
322
|
+
*/
|
|
103
323
|
getRoom: () => Promise<HMSRoom>;
|
|
324
|
+
/**
|
|
325
|
+
* - This function sets the volume of any peer in the room
|
|
326
|
+
*
|
|
327
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/set-volume} for more info
|
|
328
|
+
*
|
|
329
|
+
* @memberof HMSSDK
|
|
330
|
+
*/
|
|
104
331
|
setVolume: (track: HMSTrack, volume: number) => void;
|
|
105
332
|
resetVolume: () => void;
|
|
333
|
+
/**
|
|
334
|
+
* - This is a temporary solution for the situation when mic access is taken from the app and
|
|
335
|
+
* user returns to the app with no mic access. It will re-acquire the mic by setting the volume
|
|
336
|
+
* from native side
|
|
337
|
+
*
|
|
338
|
+
* @memberof HMSSDK
|
|
339
|
+
*/
|
|
106
340
|
addAppStateListener: () => void;
|
|
107
|
-
|
|
341
|
+
/**
|
|
342
|
+
* - This function is used to start screenshare, currently available only for android
|
|
343
|
+
*
|
|
344
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
|
|
345
|
+
*
|
|
346
|
+
* @memberof HMSSDK
|
|
347
|
+
*/
|
|
348
|
+
startScreenshare: () => Promise<any>;
|
|
349
|
+
/**
|
|
350
|
+
* - Returns a boolean stating if the screen is currently shared or not
|
|
351
|
+
*
|
|
352
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
|
|
353
|
+
*
|
|
354
|
+
* @memberof HMSSDK
|
|
355
|
+
*/
|
|
108
356
|
isScreenShared: () => Promise<any>;
|
|
357
|
+
/**
|
|
358
|
+
* - stops the screenShare, currently available for android only.
|
|
359
|
+
*
|
|
360
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
|
|
361
|
+
*
|
|
362
|
+
* @memberof HMSSDK
|
|
363
|
+
*/
|
|
109
364
|
stopScreenshare: () => Promise<any>;
|
|
365
|
+
/**
|
|
366
|
+
* - enableRTCStats sets a boolean in native side which in turn allows several events to be passed
|
|
367
|
+
* through the bridge these events are {@link RTCStatsListener}, {@link onRemoteVideoStatsListener},
|
|
368
|
+
* {@link onRemoteAudioStatsListener}, {@link onLocalAudioStatsListener} and {@link onLocalVideoStatsListener}
|
|
369
|
+
*
|
|
370
|
+
* - These listeners get various dataPoints for current peers and their connectivity to the room
|
|
371
|
+
* such as jitter, latency etc.
|
|
372
|
+
*
|
|
373
|
+
* - currently available for iOS only
|
|
374
|
+
*
|
|
375
|
+
* @memberof HMSSDK
|
|
376
|
+
*/
|
|
110
377
|
enableRTCStats: () => void;
|
|
378
|
+
/**
|
|
379
|
+
* - disable RTCStats sets the same boolean to false that was set true by enableRTCStats.
|
|
380
|
+
* that activates a check which filters out the events acquired in native listeners and don't
|
|
381
|
+
* let them pass through bridge
|
|
382
|
+
*
|
|
383
|
+
* - currently available for iOS only.
|
|
384
|
+
* @memberof HMSSDK
|
|
385
|
+
*/
|
|
111
386
|
disableRTCStats: () => void;
|
|
112
387
|
/**
|
|
113
388
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
114
|
-
* - This method will be @deprecated in future and event listener will be passed in join method
|
|
115
389
|
*
|
|
116
390
|
* @param {string} action
|
|
117
391
|
* @param {*} callback
|
|
@@ -120,7 +394,6 @@ export declare class HMSSDK {
|
|
|
120
394
|
addEventListener: (action: HMSUpdateListenerActions, callback: any) => void;
|
|
121
395
|
/**
|
|
122
396
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
123
|
-
* - This method will be @deprecated in future and event listener will be passed in join method
|
|
124
397
|
*
|
|
125
398
|
* @param {string} action
|
|
126
399
|
* @param {*} callback
|
|
@@ -133,6 +406,20 @@ export declare class HMSSDK {
|
|
|
133
406
|
* @memberof HMSSDK
|
|
134
407
|
*/
|
|
135
408
|
removeAllListeners: () => void;
|
|
409
|
+
/**
|
|
410
|
+
* - Below are all the listeners that are connected to native side.
|
|
411
|
+
*
|
|
412
|
+
* - All of the are connected when build function is called, we can connect them to the app by
|
|
413
|
+
* calling {@link addEventListener} with corresponding event type.
|
|
414
|
+
*
|
|
415
|
+
* - Before passing the data to the eventListener of the app these listeners encode the data in
|
|
416
|
+
* ts classes for a proper structuring of the data.
|
|
417
|
+
*
|
|
418
|
+
* - Even When event listeners of the app are disconnected using {@link removeEventListener} or
|
|
419
|
+
* {@link removeAllListeners} or not even connected in first place, these functions still run to
|
|
420
|
+
* maintain the current state of the instance of {@link HMSSDK}.
|
|
421
|
+
*
|
|
422
|
+
*/
|
|
136
423
|
onPreviewListener: (data: any) => void;
|
|
137
424
|
onJoinListener: (data: any) => void;
|
|
138
425
|
onRoomListener: (data: any) => void;
|
|
@@ -57,5 +57,9 @@ export * from './classes/HMSRTCStats';
|
|
|
57
57
|
export * from './classes/HMSRTCStatsReport';
|
|
58
58
|
export * from './classes/HMSRemoteAudioStats';
|
|
59
59
|
export * from './classes/HMSRemoteVideoStats';
|
|
60
|
+
export * from './classes/HMSHLSRecordingConfig';
|
|
61
|
+
export * from './classes/HMSHLSRecordingState';
|
|
62
|
+
export * from './classes/HMSMessageRecipient';
|
|
63
|
+
export * from './classes/HMSMessageRecipientType';
|
|
60
64
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
61
65
|
export default HmsManager;
|
package/package.json
CHANGED
package/react-native-hms.podspec
CHANGED
|
@@ -21,7 +21,14 @@ import { HMSRemoteAudioTrack } from './HMSRemoteAudioTrack';
|
|
|
21
21
|
import { HMSRemoteVideoTrack } from './HMSRemoteVideoTrack';
|
|
22
22
|
import { HMSSpeaker } from './HMSSpeaker';
|
|
23
23
|
import { HMSSpeakerUpdate } from './HMSSpeakerUpdate';
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
HMSBrowserRecordingState,
|
|
26
|
+
HMSHLSStreamingState,
|
|
27
|
+
HMSHLSVariant,
|
|
28
|
+
HMSRtmpStreamingState,
|
|
29
|
+
HMSServerRecordingState,
|
|
30
|
+
} from '..';
|
|
31
|
+
import { HMSHLSRecordingState } from './HMSHLSRecordingState';
|
|
25
32
|
|
|
26
33
|
export class HMSEncoder {
|
|
27
34
|
static encodeHmsRoom(room: HMSRoom, id: string) {
|
|
@@ -31,10 +38,21 @@ export class HMSEncoder {
|
|
|
31
38
|
name: room?.name,
|
|
32
39
|
peerCount: room?.peerCount,
|
|
33
40
|
peers: HMSEncoder.encodeHmsPeers(room?.peers, id),
|
|
34
|
-
browserRecordingState: HMSEncoder.encodeBrowserRecordingState(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
browserRecordingState: HMSEncoder.encodeBrowserRecordingState(
|
|
42
|
+
room?.browserRecordingState
|
|
43
|
+
),
|
|
44
|
+
rtmpHMSRtmpStreamingState: HMSEncoder.encodeRTMPStreamingState(
|
|
45
|
+
room?.rtmpHMSRtmpStreamingState
|
|
46
|
+
),
|
|
47
|
+
serverRecordingState: HMSEncoder.encodeServerRecordingState(
|
|
48
|
+
room?.serverRecordingState
|
|
49
|
+
),
|
|
50
|
+
hlsStreamingState: HMSEncoder.encodeHLSStreamingState(
|
|
51
|
+
room?.hlsStreamingState
|
|
52
|
+
),
|
|
53
|
+
hlsRecordingState: HMSEncoder.encodeHLSRecordingState(
|
|
54
|
+
room?.hlsRecordingState
|
|
55
|
+
),
|
|
38
56
|
};
|
|
39
57
|
|
|
40
58
|
return new HMSRoom(encodedObj);
|
|
@@ -398,15 +416,15 @@ export class HMSEncoder {
|
|
|
398
416
|
startedAt: new Date(parseInt(data?.startedAt)),
|
|
399
417
|
stoppedAt: new Date(parseInt(data?.stoppedAt)),
|
|
400
418
|
error: data?.error,
|
|
401
|
-
})
|
|
419
|
+
});
|
|
402
420
|
}
|
|
403
421
|
|
|
404
422
|
static encodeServerRecordingState(data: any) {
|
|
405
423
|
return new HMSServerRecordingState({
|
|
406
424
|
running: data?.running,
|
|
407
425
|
error: data?.error,
|
|
408
|
-
startedAt: new Date(parseInt(data?.startedAt))
|
|
409
|
-
})
|
|
426
|
+
startedAt: new Date(parseInt(data?.startedAt)),
|
|
427
|
+
});
|
|
410
428
|
}
|
|
411
429
|
|
|
412
430
|
static encodeRTMPStreamingState(data: any) {
|
|
@@ -414,29 +432,42 @@ export class HMSEncoder {
|
|
|
414
432
|
running: data?.running,
|
|
415
433
|
startedAt: new Date(parseInt(data?.startedAt)),
|
|
416
434
|
stoppedAt: new Date(parseInt(data?.stoppedAt)),
|
|
417
|
-
error: data?.error
|
|
418
|
-
})
|
|
435
|
+
error: data?.error,
|
|
436
|
+
});
|
|
419
437
|
}
|
|
420
438
|
|
|
421
439
|
static encodeHLSStreamingState(data: any) {
|
|
422
440
|
return new HMSHLSStreamingState({
|
|
423
441
|
running: data?.running,
|
|
424
|
-
variants: this.encodeHLSVariants(data?.variants)
|
|
425
|
-
})
|
|
442
|
+
variants: this.encodeHLSVariants(data?.variants),
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
static encodeHLSRecordingState(data: any) {
|
|
447
|
+
if (data) {
|
|
448
|
+
return new HMSHLSRecordingState({
|
|
449
|
+
running: data?.running,
|
|
450
|
+
startedAt: new Date(parseInt(data?.startedAt)),
|
|
451
|
+
singleFilePerLayer: data?.singleFilePerLayer,
|
|
452
|
+
videoOnDemand: data?.videoOnDemand,
|
|
453
|
+
});
|
|
454
|
+
} else {
|
|
455
|
+
return undefined;
|
|
456
|
+
}
|
|
426
457
|
}
|
|
427
458
|
|
|
428
459
|
static encodeHLSVariants(data: any) {
|
|
429
|
-
let variants: HMSHLSVariant[] = []
|
|
460
|
+
let variants: HMSHLSVariant[] = [];
|
|
430
461
|
|
|
431
462
|
data?.map((item: any) => {
|
|
432
463
|
let variant = new HMSHLSVariant({
|
|
433
464
|
hlsStreamUrl: item.hlsStreamUrl,
|
|
434
465
|
meetingUrl: item.meetingUrl,
|
|
435
466
|
metadata: item?.metadata,
|
|
436
|
-
startedAt: new Date(parseInt(item?.startedAt))
|
|
437
|
-
})
|
|
467
|
+
startedAt: new Date(parseInt(item?.startedAt)),
|
|
468
|
+
});
|
|
438
469
|
variants.push(variant);
|
|
439
|
-
})
|
|
470
|
+
});
|
|
440
471
|
|
|
441
472
|
return variants;
|
|
442
473
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { HMSHLSMeetingURLVariant } from './HMSHLSMeetingURLVariant';
|
|
2
|
+
import type { HMSHLSRecordingConfig } from './HMSHLSRecordingConfig';
|
|
2
3
|
|
|
3
4
|
export class HMSHLSConfig {
|
|
4
|
-
|
|
5
|
+
hlsRecordingConfig?: HMSHLSRecordingConfig;
|
|
6
|
+
meetingURLVariants: Array<HMSHLSMeetingURLVariant>;
|
|
5
7
|
|
|
6
|
-
constructor(params: {
|
|
8
|
+
constructor(params: {
|
|
9
|
+
hlsRecordingConfig?: HMSHLSRecordingConfig;
|
|
10
|
+
meetingURLVariants: Array<HMSHLSMeetingURLVariant>;
|
|
11
|
+
}) {
|
|
12
|
+
this.hlsRecordingConfig = params.hlsRecordingConfig;
|
|
7
13
|
this.meetingURLVariants = params.meetingURLVariants;
|
|
8
14
|
}
|
|
9
15
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export class HMSHLSRecordingConfig {
|
|
2
|
+
singleFilePerLayer: boolean;
|
|
3
|
+
videoOnDemand: boolean;
|
|
4
|
+
|
|
5
|
+
constructor(params: { singleFilePerLayer: boolean; videoOnDemand: boolean }) {
|
|
6
|
+
this.singleFilePerLayer = params.singleFilePerLayer;
|
|
7
|
+
this.videoOnDemand = params.videoOnDemand;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class HMSHLSRecordingState {
|
|
2
|
+
singleFilePerLayer: boolean;
|
|
3
|
+
videoOnDemand: boolean;
|
|
4
|
+
running: boolean;
|
|
5
|
+
startedAt?: Date;
|
|
6
|
+
|
|
7
|
+
constructor(params: {
|
|
8
|
+
singleFilePerLayer: boolean;
|
|
9
|
+
videoOnDemand: boolean;
|
|
10
|
+
running: boolean;
|
|
11
|
+
startedAt?: Date;
|
|
12
|
+
}) {
|
|
13
|
+
this.singleFilePerLayer = params.singleFilePerLayer;
|
|
14
|
+
this.videoOnDemand = params.videoOnDemand;
|
|
15
|
+
this.running = params.running;
|
|
16
|
+
this.startedAt = params.startedAt;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/classes/HMSLogger.ts
CHANGED
|
@@ -26,8 +26,8 @@ export class HMSLogger {
|
|
|
26
26
|
if (this.onLog) {
|
|
27
27
|
this?.onLog({ message, data });
|
|
28
28
|
}
|
|
29
|
+
this.logs.push({ type: 'verbose', message, data, id: data?.id });
|
|
29
30
|
}
|
|
30
|
-
this.logs.push({ type: 'verbose', message, data, id: data?.id });
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
warn(message: string, data: any) {
|
|
@@ -36,8 +36,8 @@ export class HMSLogger {
|
|
|
36
36
|
if (this.onLog) {
|
|
37
37
|
this?.onLog({ message, data });
|
|
38
38
|
}
|
|
39
|
+
this.logs.push({ type: 'warn', message, data, id: data?.id });
|
|
39
40
|
}
|
|
40
|
-
this.logs.push({ type: 'warn', message, data, id: data?.id });
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
error(message: string, data: any) {
|
|
@@ -46,8 +46,8 @@ export class HMSLogger {
|
|
|
46
46
|
if (this.onLog) {
|
|
47
47
|
this?.onLog({ message, data });
|
|
48
48
|
}
|
|
49
|
+
this.logs.push({ type: 'error', message, data, id: data?.id });
|
|
49
50
|
}
|
|
50
|
-
this.logs.push({ type: 'error', message, data, id: data?.id });
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
getLogs() {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
import type { HMSMessageRecipient } from './HMSMessageRecipient';
|
|
2
|
+
import type { HMSPeer } from './HMSPeer';
|
|
3
|
+
|
|
1
4
|
export class HMSMessage {
|
|
2
5
|
// endpoint: string;
|
|
3
6
|
public message: string;
|
|
4
7
|
public type: string;
|
|
5
|
-
public time
|
|
6
|
-
public sender
|
|
8
|
+
public time: Date;
|
|
9
|
+
public sender: HMSPeer;
|
|
10
|
+
public recipient: HMSMessageRecipient;
|
|
7
11
|
|
|
8
12
|
constructor(params: {
|
|
9
13
|
message: string;
|
|
10
14
|
type: string;
|
|
11
|
-
time
|
|
12
|
-
sender
|
|
15
|
+
time: string;
|
|
16
|
+
sender: HMSPeer;
|
|
17
|
+
recipient: HMSMessageRecipient;
|
|
13
18
|
}) {
|
|
14
19
|
this.message = params.message;
|
|
15
20
|
this.type = params.type;
|
|
16
|
-
this.time = params.time;
|
|
21
|
+
this.time = new Date(params.time);
|
|
17
22
|
this.sender = params.sender;
|
|
23
|
+
this.recipient = params.recipient;
|
|
18
24
|
}
|
|
19
25
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HMSMessageRecipientType } from './HMSMessageRecipientType';
|
|
2
|
+
import type { HMSPeer } from './HMSPeer';
|
|
3
|
+
import type { HMSRole } from './HMSRole';
|
|
4
|
+
|
|
5
|
+
export class HMSMessageRecipient {
|
|
6
|
+
public recipientType?: HMSMessageRecipientType;
|
|
7
|
+
public recipientPeer?: HMSPeer;
|
|
8
|
+
public recipientRoles?: HMSRole[];
|
|
9
|
+
|
|
10
|
+
constructor(params: {
|
|
11
|
+
recipientType: HMSMessageRecipientType;
|
|
12
|
+
recipientPeer?: HMSPeer;
|
|
13
|
+
recipientRoles?: HMSRole[];
|
|
14
|
+
}) {
|
|
15
|
+
this.recipientType = params.recipientType;
|
|
16
|
+
this.recipientPeer = params.recipientPeer;
|
|
17
|
+
this.recipientRoles = params.recipientRoles;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export enum HMSPeerUpdate {
|
|
2
2
|
PEER_JOINED = 'PEER_JOINED',
|
|
3
3
|
PEER_LEFT = 'PEER_LEFT',
|
|
4
|
-
AUDIO_TOGGLED = 'AUDIO_TOGGLED',
|
|
5
|
-
VIDEO_TOGGLED = 'VIDEO_TOGGLED',
|
|
6
4
|
METADATA_CHANGED = 'METADATA_CHANGED',
|
|
7
|
-
BECAME_DOMINANT_SPEAKER = 'BECAME_DOMINANT_SPEAKER',
|
|
8
|
-
NO_DOMINANT_SPEAKER = 'NO_DOMINANT_SPEAKER',
|
|
9
|
-
RESIGNED_DOMINANT_SPEAKER = 'RESIGNED_DOMINANT_SPEAKER',
|
|
10
|
-
STARTED_SPEAKING = 'STARTED_SPEAKING',
|
|
11
|
-
STOPPED_SPEAKING = 'STOPPED_SPEAKING',
|
|
12
5
|
ROLE_CHANGED = 'ROLE_CHANGED',
|
|
13
6
|
NAME_CHANGED = 'NAME_CHANGED',
|
|
14
|
-
DEFAULT_UPDATE = 'DEFAULT_UPDATE'
|
|
15
7
|
}
|