@100mslive/react-native-hms 1.1.1 → 1.3.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 +145 -340
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +292 -94
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +127 -127
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +167 -115
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +283 -45
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +7 -7
- package/ios/HMSDecoder.swift +276 -137
- package/ios/HMSHelper.swift +3 -3
- package/ios/HMSManager.m +7 -0
- package/ios/HMSManager.swift +37 -2
- package/ios/HMSRNSDK.swift +339 -97
- package/ios/HMSView.m +2 -0
- package/ios/HMSView.swift +35 -3
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/classes/HMSAudioCodec.js +4 -4
- package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioDevice.js +4 -4
- package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioFilePlayerNode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixingMode.js +4 -4
- package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMode.js +4 -4
- package/lib/commonjs/classes/HMSAudioMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioNode.js +2 -1
- package/lib/commonjs/classes/HMSAudioNode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSCameraFacing.js +4 -4
- package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
- package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSConstants.js +11 -0
- package/lib/commonjs/classes/HMSConstants.js.map +1 -0
- package/lib/commonjs/classes/HMSEncoder.js +129 -102
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSException.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
- package/lib/commonjs/classes/HMSHelper.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalPeer.js +0 -1
- package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +0 -2
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLogAlarmManager.js +4 -4
- package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/commonjs/classes/HMSLogLevel.js +4 -4
- package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
- package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js +17 -25
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSMessage.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipientType.js +4 -4
- package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageType.js +4 -4
- package/lib/commonjs/classes/HMSMessageType.js.map +1 -1
- package/lib/commonjs/classes/HMSMicNode.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventEmitter.js +101 -0
- package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPListenerActions.js +4 -4
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +69 -18
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerUpdate.js +7 -5
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js +229 -0
- package/lib/commonjs/classes/HMSPeersCache.js.map +1 -0
- package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
- package/lib/commonjs/classes/HMSPublishSettings.js +0 -6
- package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSRTCStats.js.map +1 -1
- package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -1
- package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRemotePeer.js +0 -1
- package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRole.js +0 -6
- package/lib/commonjs/classes/HMSRole.js.map +1 -1
- package/lib/commonjs/classes/HMSRoleChangeRequest.js +3 -1
- package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js +79 -22
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomCache.js +128 -0
- package/lib/commonjs/classes/HMSRoomCache.js.map +1 -0
- package/lib/commonjs/classes/HMSRoomUpdate.js +4 -4
- package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +933 -158
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
- package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSSimulcastLayerSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSSpeaker.js.map +1 -1
- package/lib/commonjs/classes/HMSSubscribeSettings.js +0 -2
- package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js +4 -4
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSource.js +4 -4
- package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackType.js +4 -4
- package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackUpdate.js +4 -4
- package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -5
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoCodec.js +4 -4
- package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoViewMode.js +4 -4
- package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +2 -1
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSAudioCodec.js +3 -3
- package/lib/module/classes/HMSAudioCodec.js.map +1 -1
- package/lib/module/classes/HMSAudioDevice.js +3 -3
- package/lib/module/classes/HMSAudioDevice.js.map +1 -1
- package/lib/module/classes/HMSAudioFilePlayerNode.js.map +1 -1
- package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
- package/lib/module/classes/HMSAudioMixingMode.js +3 -3
- package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/module/classes/HMSAudioMode.js +3 -3
- package/lib/module/classes/HMSAudioMode.js.map +1 -1
- package/lib/module/classes/HMSAudioNode.js +2 -1
- package/lib/module/classes/HMSAudioNode.js.map +1 -1
- package/lib/module/classes/HMSAudioSettings.js.map +1 -1
- package/lib/module/classes/HMSAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/module/classes/HMSCameraFacing.js +3 -3
- package/lib/module/classes/HMSCameraFacing.js.map +1 -1
- package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSConstants.js +4 -0
- package/lib/module/classes/HMSConstants.js.map +1 -0
- package/lib/module/classes/HMSEncoder.js +129 -102
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSException.js.map +1 -1
- package/lib/module/classes/HMSHLSConfig.js.map +1 -1
- package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -1
- package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -1
- package/lib/module/classes/HMSHLSRecordingState.js.map +1 -1
- package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
- package/lib/module/classes/HMSHLSVariant.js.map +1 -1
- package/lib/module/classes/HMSHelper.js.map +1 -1
- package/lib/module/classes/HMSLocalAudioStats.js.map +1 -1
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalPeer.js +0 -1
- package/lib/module/classes/HMSLocalPeer.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +0 -2
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSLogAlarmManager.js +3 -3
- package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/module/classes/HMSLogLevel.js +3 -3
- package/lib/module/classes/HMSLogLevel.js.map +1 -1
- package/lib/module/classes/HMSLogSettings.js.map +1 -1
- package/lib/module/classes/HMSLogger.js +17 -25
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSMessage.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipient.js +1 -1
- package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipientType.js +3 -3
- package/lib/module/classes/HMSMessageRecipientType.js.map +1 -1
- package/lib/module/classes/HMSMessageType.js +3 -3
- package/lib/module/classes/HMSMessageType.js.map +1 -1
- package/lib/module/classes/HMSMicNode.js.map +1 -1
- package/lib/module/classes/HMSNativeEventEmitter.js +94 -0
- package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -0
- package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/module/classes/HMSPIPListenerActions.js +3 -3
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +69 -18
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerUpdate.js +4 -3
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSPeersCache.js +216 -0
- package/lib/module/classes/HMSPeersCache.js.map +1 -0
- package/lib/module/classes/HMSPermissions.js.map +1 -1
- package/lib/module/classes/HMSPublishSettings.js +0 -6
- package/lib/module/classes/HMSPublishSettings.js.map +1 -1
- package/lib/module/classes/HMSRTCStats.js.map +1 -1
- package/lib/module/classes/HMSRTCStatsReport.js.map +1 -1
- package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -1
- package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSRemotePeer.js +0 -1
- package/lib/module/classes/HMSRemotePeer.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSRole.js +0 -6
- package/lib/module/classes/HMSRole.js.map +1 -1
- package/lib/module/classes/HMSRoleChangeRequest.js +3 -1
- package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
- package/lib/module/classes/HMSRoom.js +79 -22
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSRoomCache.js +115 -0
- package/lib/module/classes/HMSRoomCache.js.map +1 -0
- package/lib/module/classes/HMSRoomUpdate.js +3 -3
- package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +934 -159
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
- package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/module/classes/HMSSimulcastLayerSettings.js.map +1 -1
- package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
- package/lib/module/classes/HMSSpeaker.js.map +1 -1
- package/lib/module/classes/HMSSubscribeSettings.js +0 -2
- package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/module/classes/HMSTrack.js.map +1 -1
- package/lib/module/classes/HMSTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSTrackSettingsInitState.js +3 -3
- package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/module/classes/HMSTrackSource.js +3 -3
- package/lib/module/classes/HMSTrackSource.js.map +1 -1
- package/lib/module/classes/HMSTrackType.js +3 -3
- package/lib/module/classes/HMSTrackType.js.map +1 -1
- package/lib/module/classes/HMSTrackUpdate.js +3 -3
- package/lib/module/classes/HMSTrackUpdate.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +4 -4
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HMSVideoCodec.js +3 -3
- package/lib/module/classes/HMSVideoCodec.js.map +1 -1
- package/lib/module/classes/HMSVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSVideoSettings.js.map +1 -1
- package/lib/module/classes/HMSVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSVideoViewMode.js +3 -3
- package/lib/module/classes/HMSVideoViewMode.js.map +1 -1
- package/lib/module/classes/HmsView.js +2 -1
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -4
- package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -2
- package/lib/typescript/classes/HMSConstants.d.ts +3 -0
- package/lib/typescript/classes/HMSEncoder.d.ts +10 -6
- package/lib/typescript/classes/HMSHLSStreamingState.d.ts +2 -2
- package/lib/typescript/classes/HMSLocalPeer.d.ts +0 -14
- package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +0 -2
- package/lib/typescript/classes/HMSLogger.d.ts +1 -7
- package/lib/typescript/classes/HMSMessageRecipient.d.ts +2 -2
- package/lib/typescript/classes/HMSNativeEventEmitter.d.ts +13 -0
- package/lib/typescript/classes/HMSPeer.d.ts +12 -18
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
- package/lib/typescript/classes/HMSPeersCache.d.ts +17 -0
- package/lib/typescript/classes/HMSPublishSettings.d.ts +8 -15
- package/lib/typescript/classes/HMSRemotePeer.d.ts +0 -14
- package/lib/typescript/classes/HMSRole.d.ts +0 -6
- package/lib/typescript/classes/HMSRoleChangeRequest.d.ts +2 -2
- package/lib/typescript/classes/HMSRoom.d.ts +11 -22
- package/lib/typescript/classes/HMSRoomCache.d.ts +16 -0
- package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -4
- package/lib/typescript/classes/HMSSDK.d.ts +3 -13
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -2
- package/lib/typescript/classes/HMSSubscribeSettings.d.ts +0 -2
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +5 -4
- package/react-native-hms.podspec +1 -1
- package/sdk-versions.json +3 -2
- package/src/classes/HMSAudioNode.ts +3 -1
- package/src/classes/HMSBrowserRecordingState.ts +4 -4
- package/src/classes/HMSChangeTrackStateRequest.ts +2 -2
- package/src/classes/HMSConstants.ts +3 -0
- package/src/classes/HMSEncoder.ts +162 -120
- package/src/classes/HMSHLSStreamingState.ts +2 -2
- package/src/classes/HMSLocalPeer.ts +0 -15
- package/src/classes/HMSLocalVideoTrack.ts +0 -2
- package/src/classes/HMSLogger.ts +20 -19
- package/src/classes/HMSMessageRecipient.ts +3 -3
- package/src/classes/HMSNativeEventEmitter.ts +109 -0
- package/src/classes/HMSPeer.ts +135 -32
- package/src/classes/HMSPeerUpdate.ts +9 -0
- package/src/classes/HMSPeersCache.ts +252 -0
- package/src/classes/HMSPublishSettings.ts +8 -18
- package/src/classes/HMSRemotePeer.ts +0 -16
- package/src/classes/HMSRole.ts +0 -9
- package/src/classes/HMSRoleChangeRequest.ts +5 -3
- package/src/classes/HMSRoom.ts +141 -37
- package/src/classes/HMSRoomCache.ts +157 -0
- package/src/classes/HMSRtmpStreamingState.ts +4 -4
- package/src/classes/HMSSDK.tsx +685 -292
- package/src/classes/HMSServerRecordingState.ts +2 -2
- package/src/classes/HMSSubscribeSettings.ts +1 -7
- package/src/classes/HMSUpdateListenerActions.ts +1 -1
- package/src/classes/HmsView.tsx +2 -1
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
<img src="https://github.com/100mslive/100ms-react-native/blob/main/100ms.svg" title="100ms logo" float=center height=256>
|
|
4
4
|
</a>
|
|
5
5
|
|
|
6
|
-
# react-native-hms
|
|
7
|
-
|
|
8
6
|
[](https://www.npmjs.com/package/@100mslive/react-native-hms)
|
|
9
7
|
[](https://www.100ms.live/)
|
|
10
8
|
[](https://www.npmjs.com/package/@100mslive/react-native-hms)
|
|
@@ -17,9 +15,18 @@
|
|
|
17
15
|
[](https://github.com/100mslive/react-native-hms/projects/1)
|
|
18
16
|
[](https://dashboard.100ms.live/register)
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
# 100ms React Native SDK
|
|
19
|
+
|
|
20
|
+
📖 Read the Complete Documentation here: https://www.100ms.live/docs/react-native/v2/foundation/basics
|
|
21
|
+
|
|
22
|
+
## 🏃 Example App
|
|
23
|
+
|
|
24
|
+
📲 Download the Example iOS app here: https://testflight.apple.com/join/v4bSIPad
|
|
25
|
+
|
|
26
|
+
🤖 Download the Example Android app here: https://appdistribution.firebase.dev/i/7b7ab3b30e627c35
|
|
27
|
+
|
|
28
|
+
To get a better understanding of how the example app is structured, what to do on `onJoin`, `onTrack` and `onPeer` listeners, creating `PeerTrackNodes`, how to use Redux, and what type of layouts and sorting you can implement in your app, checkout [Example App's README](https://github.com/100mslive/react-native-hms/blob/develop/example/README.md)
|
|
21
29
|
|
|
22
|
-
## 🏃 Run Example App
|
|
23
30
|
|
|
24
31
|
To run the Example app on your system, follow these steps -
|
|
25
32
|
|
|
@@ -27,33 +34,35 @@ To run the Example app on your system, follow these steps -
|
|
|
27
34
|
2. Go to the example folder, `cd example`
|
|
28
35
|
3. In the example folder, run `npm install`
|
|
29
36
|
4. To run on Android, run `npx react-native run-android`
|
|
30
|
-
5. To run on iOS, first install the pods in iOS folder, `cd ios; pod install`. Then, set the
|
|
37
|
+
5. To run on iOS, first install the pods in iOS folder, `cd ios; pod install`. Then, set the Correct Development Team in Xcode Signing & Capabilities section. Then, in example folder, run `npx react-native run-ios`
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
Troubleshooting Guide for resolving issues in running the Example app is [available here](https://www.100ms.live/docs/react-native/v2/guides/faq#run-the-example-app).
|
|
33
40
|
|
|
34
|
-
We have also implemented multiple views which are commonly used. Checkout the [videos & relevant code in the Example app](https://github.com/100mslive/react-native-hms/tree/main/example#additional-features).
|
|
35
41
|
|
|
36
42
|
## ☝️ Minimum Configuration
|
|
37
43
|
|
|
38
|
-
- Support for
|
|
39
|
-
- Support for Java 8
|
|
40
|
-
- Support for
|
|
41
|
-
-
|
|
42
|
-
-
|
|
44
|
+
- Support for React Native 0.64.4 or above
|
|
45
|
+
- Support for Java 8 or above
|
|
46
|
+
- Support for Android API level 24 or above
|
|
47
|
+
- Xcode 13 or above
|
|
48
|
+
- Support for iOS 12 or above
|
|
49
|
+
|
|
43
50
|
|
|
44
51
|
## 🤝 Recommended Configuration
|
|
45
52
|
|
|
46
|
-
-
|
|
47
|
-
- Java 11 or
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
53
|
+
- React Native 0.68.0 or above
|
|
54
|
+
- Java 11 or above
|
|
55
|
+
- Android API level 32 or above
|
|
56
|
+
- Xcode 14 or above
|
|
57
|
+
- iOS 16 or above
|
|
51
58
|
|
|
52
59
|
## 📱 Supported Devices
|
|
53
60
|
|
|
54
61
|
- The Android SDK supports Android API level 21 and higher. It is built for armeabi-v7a, arm64-v8a, x86, and x86_64 architectures.
|
|
62
|
+
Devices running Android OS 11 or above is recommended.
|
|
55
63
|
|
|
56
|
-
- iPhone & iPads with iOS version
|
|
64
|
+
- iPhone & iPads with iOS version 12 or above are supported.
|
|
65
|
+
Devices running iOS 16 or above is recommended.
|
|
57
66
|
|
|
58
67
|
## Installation
|
|
59
68
|
|
|
@@ -65,6 +74,8 @@ npm install @100mslive/react-native-hms --save
|
|
|
65
74
|
|
|
66
75
|
🤖 Download the Sample Android App here: https://appdistribution.firebase.dev/i/7b7ab3b30e627c35
|
|
67
76
|
|
|
77
|
+
More information about Integrating the SDK is [available here](https://www.100ms.live/docs/react-native/v2/features/integration).
|
|
78
|
+
|
|
68
79
|
## 🔐 Permissions
|
|
69
80
|
|
|
70
81
|
### 📱 For iOS Permissions
|
|
@@ -90,419 +101,213 @@ Add following permissions in `AndroidManifest.xml`
|
|
|
90
101
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
|
|
91
102
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
|
92
103
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
|
93
|
-
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
|
94
104
|
<uses-permission android:name="android.permission.INTERNET"/>
|
|
95
105
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
|
96
106
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
107
|
+
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
|
|
108
|
+
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
|
97
109
|
```
|
|
98
110
|
|
|
99
111
|
You will also need to request Camera and Record Audio permissions at runtime before you join a call or display a preview. Please follow [Android Documentation](https://developer.android.com/training/permissions/requesting#request-permission) for runtime permissions.
|
|
100
112
|
|
|
101
113
|
We suggest using [react-native-permission](https://www.npmjs.com/package/react-native-permissions) to acquire permissions from both platforms.
|
|
102
114
|
|
|
115
|
+
More information about Audio Video Permission on iOS & Android is [available here](https://www.100ms.live/docs/react-native/v2/features/integration#permissions).
|
|
116
|
+
|
|
117
|
+
|
|
103
118
|
## [QuickStart](https://www.100ms.live/docs/react-native/v2/guides/quickstart)
|
|
104
119
|
|
|
120
|
+
|
|
105
121
|
The package exports all the classes and a HMSSDK class that manages everything.
|
|
106
122
|
|
|
107
123
|
## Setting up the HMS Instance
|
|
108
124
|
|
|
109
|
-
|
|
125
|
+
First invoke the `build` method which returns an instance of `HMSSDK`. Save this instance to perform all actions related to 100ms.
|
|
110
126
|
|
|
111
|
-
```
|
|
127
|
+
```ts
|
|
112
128
|
import { HMSSDK } from '@100mslive/react-native-hms';
|
|
113
|
-
...
|
|
114
129
|
|
|
130
|
+
// create HMSSDK instance using the build method & save it for further usage
|
|
115
131
|
const hmsInstance = await HMSSDK.build();
|
|
116
|
-
// save this instance, it will be used for all the operations that we'll perform
|
|
117
|
-
|
|
118
|
-
...
|
|
119
132
|
```
|
|
120
133
|
|
|
121
|
-
## [Add
|
|
134
|
+
## [Add Event Listeners](https://www.100ms.live/docs/react-native/v2/features/event-listeners)
|
|
135
|
+
|
|
136
|
+
Add Event Listeners to get notified about actions happening in the 100ms Room.
|
|
122
137
|
|
|
123
|
-
|
|
138
|
+
The most commonly used Events are `onJoin`, `onPeerUpdate` & `onTrackUpdate`. All the available actions can be found in the `HMSUpdateListenerActions` class.
|
|
124
139
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
140
|
+
The Event Listeners are to be used for handling any update happening in 100ms Room.
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
const hmsInstance = await HMSSDK.build();
|
|
128
144
|
|
|
129
145
|
// instance acquired from build() method
|
|
130
146
|
hmsInstance.addEventListener(
|
|
131
|
-
HMSUpdateListenerActions.
|
|
132
|
-
|
|
147
|
+
HMSUpdateListenerActions.ON_JOIN,
|
|
148
|
+
joinSuccess, // function that will be called Joining a Room is successful
|
|
133
149
|
);
|
|
134
|
-
|
|
135
|
-
...
|
|
136
150
|
```
|
|
137
151
|
|
|
138
|
-
The
|
|
152
|
+
The detailed QuickStart Guide is [available here](https://www.100ms.live/docs/react-native/v2/guides/quickstart).
|
|
139
153
|
|
|
140
|
-
## [Error handling](https://www.100ms.live/docs/react-native/v2/features/error-handling)
|
|
141
154
|
|
|
142
|
-
|
|
143
|
-
import { HMSUpdateListenerActions } from '@100mslive/react-native-hms';
|
|
155
|
+
## [Join the Room](https://www.100ms.live/docs/react-native/v2/features/join)
|
|
144
156
|
|
|
145
|
-
|
|
146
|
-
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
|
|
147
|
-
```
|
|
157
|
+
To interact with _peers_ in audio or video call, the user needs to **Join** a **Room**.
|
|
148
158
|
|
|
149
|
-
|
|
159
|
+
When user indicates that they want to join the room, your app should have -
|
|
150
160
|
|
|
151
|
-
|
|
161
|
+
1. User Name - The name which should be displayed to other peers in the room.
|
|
152
162
|
|
|
153
|
-
|
|
163
|
+
2. Authentication Token - The Client side Authentication Token generated by the Token Service. Details about how to create Auth Tokens are [available here](https://www.100ms.live/docs/react-native/v2/guides/token).
|
|
154
164
|
|
|
155
|
-
|
|
156
|
-
import { HMSUpdateListenerActions, HMSConfig } from '@100mslive/react-native-hms';
|
|
157
|
-
...
|
|
165
|
+
Additionally, you can also pass these fields while Joining a Room -
|
|
158
166
|
|
|
159
|
-
|
|
167
|
+
1. Track Settings - Such as joining a Room with Muted Audio or Video using the `HMSTrackSettings` object. More information is [available here](https://www.100ms.live/docs/react-native/v2/features/join#join-with-muted-audio-video).
|
|
160
168
|
|
|
161
|
-
|
|
162
|
-
hmsInstance.preview(HmsConfig); // to start preview
|
|
163
|
-
// or
|
|
164
|
-
hmsInstance.join(HmsConfig); // to join a room
|
|
169
|
+
2. Peer Metadata - This can be used to pass any additional metadata associated with the user using `metadata` of `HMSConfig` object. For Eg: user-id mapping at the application side. More information is [available here](https://www.100ms.live/docs/react-native/v2/advanced-features/change-metadata).
|
|
165
170
|
|
|
166
|
-
...
|
|
167
|
-
```
|
|
168
171
|
|
|
169
|
-
|
|
172
|
+
NOTE: `ON_JOIN` Event Listener must be **attached** before calling `join` function to receive the event callback.
|
|
170
173
|
|
|
171
|
-
```
|
|
172
|
-
//
|
|
173
|
-
hmsInstance
|
|
174
|
+
```ts
|
|
175
|
+
// create HMSSDK instance using the build function
|
|
176
|
+
const hmsInstance = await HMSSDK.build();
|
|
174
177
|
|
|
175
|
-
// Stop Video
|
|
176
|
-
hmsInstance?.localPeer?.localVideoTrack()?.setMute(true);
|
|
177
178
|
|
|
178
|
-
//
|
|
179
|
-
hmsInstance
|
|
179
|
+
// You'll need to add Event Listeners for HMSUpdateListenerActions, which are invoked to notify about updates happening in the room like a peer joins/leaves, a track got muted/unmuted, any errors that occur, etc.
|
|
180
|
+
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_JOIN, onJoinSuccess);
|
|
181
|
+
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_PEER_UPDATE, onPeerUpdate);
|
|
182
|
+
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_TRACK_UPDATE, onTrackUpdate);
|
|
183
|
+
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
|
|
186
|
+
// Next, create an object of HMSConfig class using the available joining configurations.
|
|
187
|
+
let config = new HMSConfig({
|
|
188
|
+
authToken: 'eyJH5c...', // client-side token generated from your token service
|
|
189
|
+
username: 'John Appleseed',
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Now, we are primed to join the room. All you have to do is calling join by passing the config object
|
|
193
|
+
hmsInstance.join(config);
|
|
183
194
|
```
|
|
184
195
|
|
|
185
|
-
|
|
196
|
+
More information about Joining a Room is [available here](https://www.100ms.live/docs/react-native/v2/features/join).
|
|
186
197
|
|
|
187
|
-
To display a video on screen the 100ms package provides a UI component named `HmsView` that takes the video `trackId` and displays the video in that component.
|
|
188
198
|
|
|
189
|
-
|
|
199
|
+
## Basic Mechanism of using 100ms APIs
|
|
190
200
|
|
|
191
|
-
|
|
201
|
+
For invoking any actions simply use the `HMSSDK` instance created in above steps. Few common examples of using it are as follows -
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
// To Mute Audio of local peer - other peers will stop hearing audio
|
|
205
|
+
hmsInstance?.localPeer?.localAudioTrack()?.setMute(true);
|
|
206
|
+
|
|
207
|
+
// To Mute Video of local peer - other peers will stop seeing video
|
|
208
|
+
hmsInstance?.localPeer?.localVideoTrack()?.setMute(true);
|
|
192
209
|
|
|
193
|
-
|
|
210
|
+
// Switch Camera from Front to Back or vice-versa
|
|
211
|
+
hmsInstance?.localPeer?.localVideoTrack()?.switchCamera();
|
|
194
212
|
|
|
195
|
-
|
|
213
|
+
// Leave the ongoing Room (async function)
|
|
214
|
+
await hmsInstance?.leave();
|
|
196
215
|
|
|
197
|
-
|
|
216
|
+
// To send a Chat Message to all peers in Room
|
|
217
|
+
await hmsInstance?.sendBroadcastMessage('Hello Everyone! 👋');
|
|
218
|
+
```
|
|
198
219
|
|
|
199
|
-
|
|
200
|
-
...
|
|
201
|
-
import { HMSRemotePeer } from '@100mslive/react-native-hms';
|
|
220
|
+
More information about using `HMSSDK` APIs is [available here](https://www.100ms.live/docs/react-native/v2/guides/quickstart).
|
|
202
221
|
|
|
203
|
-
|
|
204
|
-
const localTrackId: string = hmsInstance?.localPeer?.videoTrack?.trackId;
|
|
222
|
+
## [Viewing the Video](https://www.100ms.live/docs/react-native/v2/features/render-video)
|
|
205
223
|
|
|
206
|
-
|
|
207
|
-
const remotePeers: HMSRemotePeer[] = hmsInstance?.remotePeers
|
|
208
|
-
const remoteVideoIds: string[] = [];
|
|
224
|
+
It all comes down to this. All the setup so far has been done so that we can show Live Streaming Video in our beautiful apps.
|
|
209
225
|
|
|
210
|
-
|
|
211
|
-
const remoteTrackId: string = remotePeer?.videoTrack?.trackId;
|
|
226
|
+
100ms React Native SDK provides `HmsView` component that renders the video on the screen. You can access `HmsView` from the `HMSSDK` instance created in above steps.
|
|
212
227
|
|
|
213
|
-
|
|
214
|
-
remoteVideoIds.push(remoteTrackId);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
228
|
+
We simply have to pass a Video Track's `trackId` to the `HmsView` to begin automatic rendering of Live Video Stream.
|
|
217
229
|
|
|
218
|
-
|
|
219
|
-
```
|
|
230
|
+
We can also optionally pass props like `key`, `scaleType`, `mirror` to customize the `HmsView` component.
|
|
220
231
|
|
|
221
|
-
|
|
232
|
+
```ts
|
|
233
|
+
// get HmsView from the HMSSDK instance created earlier
|
|
234
|
+
const HmsView = hmsInstance.HmsView;
|
|
222
235
|
|
|
223
|
-
|
|
224
|
-
|
|
236
|
+
<HmsView
|
|
237
|
+
trackId={videoTrackId}
|
|
238
|
+
key={videoTrackId}
|
|
239
|
+
style={styles.hmsView}
|
|
240
|
+
/>
|
|
225
241
|
|
|
226
|
-
// instance acquired from build() method
|
|
227
|
-
const HmsView = hmsInstance?.HmsView;
|
|
228
|
-
...
|
|
229
242
|
const styles = StyleSheet.create({
|
|
230
243
|
hmsView: {
|
|
231
244
|
height: '100%',
|
|
232
245
|
width: '100%',
|
|
233
246
|
},
|
|
234
247
|
});
|
|
235
|
-
|
|
236
|
-
// trackId should be acquired from the method explained above
|
|
237
|
-
// scaleType can be selected from HMSVideoViewMode as required
|
|
238
|
-
// mirror can be passed as true to flip videos horizontally
|
|
239
|
-
<HmsView style={styles.hmsView} trackId={trackId} mirror={true} scaleType={HMSVideoViewMode.ASPECT_FIT} />
|
|
240
|
-
|
|
241
|
-
...
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
## [Mute/Unmute others](https://www.100ms.live/docs/react-native/v2/features/change-track-state)
|
|
245
|
-
|
|
246
|
-
```js
|
|
247
|
-
const mute: boolean = true;
|
|
248
|
-
|
|
249
|
-
// hms instance acquired by build methodhmsInstance?.changeTrackState(audioTrack as HMSTrack, mute);
|
|
250
|
-
hmsInstance?.changeTrackState(videoTrack as HMSTrack, mute);
|
|
251
|
-
|
|
252
|
-
const unmute: boolean = false;
|
|
253
|
-
|
|
254
|
-
await hmsInstance?.changeTrackState(audioTrack as HMSTrack, unmute);
|
|
255
|
-
await hmsInstance?.changeTrackState(videoTrack as HMSTrack, unmute);
|
|
256
248
|
```
|
|
257
249
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
```js
|
|
261
|
-
const reason = 'Host ended the room';
|
|
262
|
-
const lock = false; // optional parameter
|
|
263
|
-
|
|
264
|
-
// hms instance acquired by build method
|
|
265
|
-
await hmsInstance.endRoom(reason, lock);
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## [Remove Peer](https://www.100ms.live/docs/react-native/v2/features/remove-peer)
|
|
269
|
-
|
|
270
|
-
```js
|
|
271
|
-
import { HMSPeer } from '@100mslive/react-native-hms';
|
|
272
|
-
|
|
273
|
-
const reason = 'removed from room';
|
|
274
|
-
|
|
275
|
-
// hms instance acquired by build method
|
|
276
|
-
const peer: HMSPeer = hmsInstance?.remotePeers[0];
|
|
277
|
-
|
|
278
|
-
await hmsInstance.removePeer(peer, reason);
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## [Sending messages](https://www.100ms.live/docs/react-native/v2/features/chat)
|
|
282
|
-
|
|
283
|
-
```js
|
|
284
|
-
import { HMSRole, HMSPeer } from '@100mslive/react-native-hms';
|
|
285
|
-
|
|
286
|
-
const message = 'hello'
|
|
287
|
-
const roles: HMSRole[] = hmsInstance?.knownRoles
|
|
288
|
-
// any remote peer
|
|
289
|
-
const peer: HMSPeer = hmsInstance?.remotePeers[0]
|
|
290
|
-
|
|
291
|
-
// send a different type of messages
|
|
292
|
-
await hmsInstance?.sendBroadcastMessage(message);
|
|
293
|
-
await hmsInstance?.sendGroupMessage(message, [role[0]);
|
|
294
|
-
await hmsInstance?.sendDirectMessage(message, peer);
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
## [Role Change](https://www.100ms.live/docs/react-native/v2/features/change-role)
|
|
298
|
-
|
|
299
|
-
Single Peer Role Change: Change the Role of a single peer to a specified one using the `changeRoleOfPeer` API
|
|
300
|
-
|
|
301
|
-
```js
|
|
302
|
-
const force = false
|
|
303
|
-
|
|
304
|
-
// instance acquired from build() method
|
|
305
|
-
await hmsInstance.changeRoleOfPeer(peer, newRole, force) // request role change, not forced
|
|
306
|
-
.then(d => console.log('Change Role Success: ', d))
|
|
307
|
-
.catch(e => console.log('Change Role Error: ', e));
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
Bulk Role Change: Change the role of all peers with a certain Role, to a specified one using the `changeRoleOfPeersWithRoles` API
|
|
312
|
-
|
|
313
|
-
```js
|
|
314
|
-
// fetch all available Roles in the room
|
|
315
|
-
const roles = await hmsInstance.getRoles();
|
|
316
|
-
|
|
317
|
-
// get the Host Role object
|
|
318
|
-
const hostRole = roles.find(role => role.name === 'host');
|
|
319
|
-
|
|
320
|
-
// get list of Roles to be updated - in this case "Waiting" and "Guest" Roles
|
|
321
|
-
const rolesToChange = roles.filter(role => role.name === 'waiting' || role.name === 'guest');
|
|
322
|
-
|
|
323
|
-
// now perform Role Change of all peers in "Waiting" and "Guest" Roles to the "Host" Role
|
|
324
|
-
await hmsInstance.changeRoleOfPeersWithRoles(rolesToChange, hostRole);
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
## [Raise Hand & BRB](https://www.100ms.live/docs/react-native/v2/advanced-features/change-metadata)
|
|
328
|
-
|
|
329
|
-
```js
|
|
330
|
-
const parsedMetadata = JSON.parse(hmsInstance?.localPeer?.metadata);
|
|
250
|
+
- One `HmsView` component can only be connected with one video `trackId`. To display multiple videos you have to create multiple instances of `HmsView` component.
|
|
331
251
|
|
|
332
|
-
|
|
333
|
-
// hms instance acquired by build method
|
|
334
|
-
await hmsInstance?.changeMetadata(
|
|
335
|
-
JSON.stringify({
|
|
336
|
-
...parsedMetadata,
|
|
337
|
-
isHandRaised: true,
|
|
338
|
-
})
|
|
339
|
-
);
|
|
252
|
+
- It's recommended to always pass the `key` property while creating `HmsView`. If a null or undefined `trackId` is passed in `HmsView` you will have to unmount and remount with the new `trackId`. Using the `key` prop and passing `trackId` to it automatically achieves this.
|
|
340
253
|
|
|
341
|
-
|
|
342
|
-
// hms instance acquired by build method
|
|
343
|
-
await hmsInstance?.changeMetadata(
|
|
344
|
-
JSON.stringify({
|
|
345
|
-
...parsedMetadata,
|
|
346
|
-
isBRBOn: true,
|
|
347
|
-
})
|
|
348
|
-
);
|
|
349
|
-
```
|
|
254
|
+
- `HmsView` component requires `width` and `height` in `style` prop to set bounds of the tile that will show the video stream.
|
|
350
255
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
```js
|
|
354
|
-
import {
|
|
355
|
-
HMSHLSMeetingURLVariant,
|
|
356
|
-
HMSHLSConfig,
|
|
357
|
-
} from '@100mslive/react-native-hms';
|
|
358
|
-
|
|
359
|
-
const startHLSStreaming = () => {
|
|
360
|
-
// Default Settings
|
|
361
|
-
await hmsInstance.startHLSStreaming()
|
|
362
|
-
|
|
363
|
-
// Custom Settings
|
|
364
|
-
const hmsHLSMeetingURLVariant = new HMSHLSMeetingURLVariant({
|
|
365
|
-
meetingUrl: 'https://yogi.app.100ms.live/preview/nih-bkn-vek?skip_preview=true',
|
|
366
|
-
metadata: '',
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
const hmsHLSRecordingConfig = new HMSHLSRecordingConfig({
|
|
370
|
-
singleFilePerLayer: false,
|
|
371
|
-
videoOnDemand: false,
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
const hmsHLSConfig = new HMSHLSConfig({
|
|
375
|
-
hlsRecordingConfig: hmsHLSRecordingConfig,
|
|
376
|
-
meetingURLVariants: [hlsStreamingDetails],
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
await hmsInstance.startHLSStreaming(hmsHLSConfig)
|
|
380
|
-
.then(d => console.log('Start Hls Success: ', d))
|
|
381
|
-
.catch(e => console.log('Start Hls Error: ', e));
|
|
382
|
-
};
|
|
383
|
-
```
|
|
256
|
+
- Once the requirement of that `HmsView` is finished it should **ALWAYS** be disposed.
|
|
384
257
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
```js
|
|
388
|
-
import { HMSRTMPConfig } from '@100mslive/react-native-hms';
|
|
389
|
-
|
|
390
|
-
const recordingDetails = HMSRTMPConfig({
|
|
391
|
-
record: true,
|
|
392
|
-
meetingURL: roomID + '/viewer?token=beam_recording',
|
|
393
|
-
rtmpURLs: [], // optional value
|
|
394
|
-
resolution: { height: 720, width: 1280 }, // optional value
|
|
395
|
-
// Resolution width
|
|
396
|
-
// Range is [500, 1280].
|
|
397
|
-
// Default value is 1280.
|
|
398
|
-
// If resolution height > 720 then max resolution width = 720.
|
|
399
|
-
|
|
400
|
-
// Resolution height
|
|
401
|
-
// Reange is [480, 1280].
|
|
402
|
-
// Default resolution width is 720.
|
|
403
|
-
// If resolution width > 720 then max resolution height = 720.
|
|
404
|
-
});
|
|
258
|
+
- Recommended practice is to show maximum of 3 to 4 `HmsView` on a single page/screen of the app. This avoids overloading network data consumption & video decoding resources of the device.
|
|
405
259
|
|
|
406
|
-
|
|
407
|
-
await hmsInstance?.startRTMPOrRecording(recordingDetails);
|
|
408
|
-
```
|
|
260
|
+
More information about Rendering Videos is [available here](https://www.100ms.live/docs/react-native/v2/features/render-video).
|
|
409
261
|
|
|
410
|
-
## [Get RTC Stats](https://www.100ms.live/docs/react-native/v2/features/rtc-stats)
|
|
411
262
|
|
|
412
|
-
|
|
413
|
-
// hms instance acquired by build method
|
|
414
|
-
hmsInstance?.enableRTCStats();
|
|
415
|
-
```
|
|
263
|
+
## [Using Track Updates to display Videos](https://www.100ms.live/docs/react-native/v2/features/render-video)
|
|
416
264
|
|
|
417
|
-
|
|
265
|
+
Always use ON_PEER_UPDATE and ON_TRACK_UPDATE listeners, these listeners get updated localPeer and remotePeers whenever there is any event related to these values.
|
|
266
|
+
The following code snippet shows a simple example of attaching Track Updates Event Listener & using it to show a Video.
|
|
418
267
|
|
|
419
|
-
```
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
|
|
268
|
+
```ts
|
|
269
|
+
// In this example code snippet, We are keeping things very simple.
|
|
270
|
+
// You will get an overview of how to render `HMSView`s for list of `trackId`s and how to keep that list up to date.
|
|
271
|
+
// We don't need `ON_PEER_UPDATE` event listener for keeping track of only `trackId`s.
|
|
272
|
+
// So, we have registered only `ON_TRACK_UPDATE` event listener here
|
|
423
273
|
|
|
424
|
-
|
|
274
|
+
const [trackIds, setTrackIds] = useState<string[]>([]);
|
|
425
275
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
HMSSpeaker,
|
|
430
|
-
} from '@100mslive/react-native-hms';
|
|
276
|
+
const onTrackListener = (data: { peer: HMSPeer; track: HMSTrack; type: HMSTrackUpdate }) => {
|
|
277
|
+
// We will only consider Video tracks for this example
|
|
278
|
+
if (data.track.type !== HMSTrackType.VIDEO) return;
|
|
431
279
|
|
|
432
|
-
//
|
|
433
|
-
|
|
280
|
+
// If Video track is added, add trackId to our list
|
|
281
|
+
if (data.type === HMSTrackUpdate.TRACK_ADDED) setTrackIds(prevTrackIds => [...prevTrackIds, data.track.trackId]);
|
|
434
282
|
|
|
435
|
-
|
|
436
|
-
data
|
|
437
|
-
console.log('speaker audio level: ', speaker?.level)
|
|
438
|
-
);
|
|
283
|
+
// If Video track is removed, remove trackId from our list
|
|
284
|
+
if (data.type === HMSTrackUpdate.TRACK_REMOVED) setTrackIds(prevTrackIds => prevTrackIds.filter(prevTrackId => prevTrackId !== data.track.trackId));
|
|
439
285
|
};
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
## [Local mute others](https://www.100ms.live/docs/react-native/v2/features/playback-allowed)
|
|
443
|
-
|
|
444
|
-
```js
|
|
445
|
-
const remotePeer: HMSRemotePeer;
|
|
446
|
-
const isAudioPlaybackAllowed = remotePeer.remoteAudioTrack().setPlaybackAllowed(false);
|
|
447
|
-
const isVideoPlaybackAllowed = remotePeer.remoteVideoTrack().setPlaybackAllowed(true);
|
|
448
|
-
|
|
449
|
-
// hms instance acquired by build method
|
|
450
|
-
hmsInstance.setPlaybackForAllAudio(true) // mute
|
|
451
|
-
hmsInstance.setPlaybackForAllAudio(false) // unmute
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
## [Locally Set Volume](https://www.100ms.live/docs/react-native/v2/advanced-features/set-volume)
|
|
455
|
-
|
|
456
|
-
```js
|
|
457
|
-
const volume: Float = 1.0;
|
|
458
|
-
const track: HMSTrack = remotePeer.audioTrack as HMSTrack;
|
|
459
286
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
## [Change Name](https://www.100ms.live/docs/react-native/v2/features/change-name)
|
|
465
|
-
|
|
466
|
-
```js
|
|
467
|
-
const newName: string = 'new name';
|
|
287
|
+
hmsInstance.addEventListener(
|
|
288
|
+
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
289
|
+
onTrackListener
|
|
290
|
+
);
|
|
468
291
|
|
|
469
|
-
//
|
|
470
|
-
|
|
292
|
+
// Render multiple HMSView for trackIds inside FlatList
|
|
293
|
+
// Note: HMSView will render blank if video track of peer is muted, Make sure video of peers is not muted.
|
|
294
|
+
<FlatList
|
|
295
|
+
data={trackIds} // trackIds is an array of trackIds of video tracks
|
|
296
|
+
keyExtractor={(trackId) => trackId}
|
|
297
|
+
renderItem={({ item }) => <HMSView key={item} trackId={item} style={{ width: '100%', height: 300 }} {...} />}
|
|
298
|
+
{...}
|
|
299
|
+
/>
|
|
471
300
|
```
|
|
472
301
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
Following is an example to join a Room with Muted Audio & Video:
|
|
476
|
-
```js
|
|
477
|
-
// First, create the Track Settings object
|
|
478
|
-
const trackSettings = getTrackSettings();
|
|
302
|
+
More information about Rendering Videos is [available here](https://www.100ms.live/docs/react-native/v2/features/render-video).
|
|
479
303
|
|
|
480
|
-
// Customize Audio & Video initial states as per user discretion
|
|
481
|
-
const getTrackSettings = () => {
|
|
482
304
|
|
|
483
|
-
let audioSettings = new HMSAudioTrackSettings({
|
|
484
|
-
initialState: HMSTrackSettingsInitState.MUTED,
|
|
485
|
-
});
|
|
486
305
|
|
|
487
|
-
|
|
488
|
-
initialState: HMSTrackSettingsInitState.MUTED,
|
|
489
|
-
});
|
|
306
|
+
### 🚂 [Example Implementations](https://github.com/100mslive/react-native-hms/tree/main/example)
|
|
490
307
|
|
|
491
|
-
|
|
492
|
-
video: videoSettings,
|
|
493
|
-
audio: audioSettings,
|
|
494
|
-
});
|
|
495
|
-
};
|
|
308
|
+
In the [100ms Example App](https://github.com/100mslive/react-native-hms/tree/main/example) we have shown how to set up the various listeners, what data to store in Redux and what all features you can implement.
|
|
496
309
|
|
|
497
|
-
|
|
498
|
-
const hmsInstance = await HMSSDK.build({
|
|
499
|
-
trackSettings
|
|
500
|
-
});
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
### [Example Implementations](https://github.com/100mslive/react-native-hms/tree/main/example)
|
|
310
|
+
We have also implemented multiple views which are commonly used. Checkout the [videos & relevant code in the Example app](https://github.com/100mslive/react-native-hms/tree/main/example#additional-features).
|
|
505
311
|
|
|
506
|
-
In the [100ms Example App](https://github.com/100mslive/react-native-hms/tree/main/example) we have shown how to setup the various listeners, what data to store in Redux and what all features you can implement.
|
|
507
312
|
|
|
508
|
-
|
|
313
|
+
📖 Read the Complete Documentation here: https://www.100ms.live/docs/react-native/v2/foundation/basics
|
package/android/build.gradle
CHANGED
|
@@ -34,7 +34,7 @@ android {
|
|
|
34
34
|
compileSdkVersion safeExtGet('Hmssdk_compileSdkVersion', 30)
|
|
35
35
|
defaultConfig {
|
|
36
36
|
minSdkVersion safeExtGet('Hmssdk_minSdkVersion', 21)
|
|
37
|
-
targetSdkVersion safeExtGet('Hmssdk_targetSdkVersion',
|
|
37
|
+
targetSdkVersion safeExtGet('Hmssdk_targetSdkVersion', 30)
|
|
38
38
|
versionCode 1
|
|
39
39
|
versionName "1.0"
|
|
40
40
|
}
|