@100mslive/react-native-hms 1.7.0 → 1.7.1

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.
Files changed (168) hide show
  1. package/README.md +30 -39
  2. package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
  3. package/android/.gradle/6.7.1/fileChanges/last-build.bin +0 -0
  4. package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
  5. package/android/.gradle/6.7.1/gc.properties +0 -0
  6. package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
  7. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  8. package/android/.gradle/6.9/fileChanges/last-build.bin +0 -0
  9. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  10. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  11. package/android/.gradle/6.9/gc.properties +0 -0
  12. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  14. package/android/.gradle/checksums/checksums.lock +0 -0
  15. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  16. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  17. package/android/.gradle/configuration-cache/gc.properties +0 -0
  18. package/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/android/build.gradle +16 -9
  20. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  21. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  22. package/android/gradlew +103 -104
  23. package/android/gradlew.bat +3 -18
  24. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +27 -3
  25. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +2 -1
  26. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +7 -0
  27. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +39 -10
  28. package/ios/HMSDecoder.swift +4 -3
  29. package/ios/HMSHelper.swift +6 -2
  30. package/ios/HMSManager.m +4 -0
  31. package/ios/HMSManager.swift +8 -0
  32. package/ios/HMSRNSDK.swift +54 -24
  33. package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
  34. package/lib/commonjs/classes/HMSBrowserRecordingState.js +2 -0
  35. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  36. package/lib/commonjs/classes/HMSCameraControl.js +3 -5
  37. package/lib/commonjs/classes/HMSCameraControl.js.map +1 -1
  38. package/lib/commonjs/classes/HMSEncoder.js +33 -34
  39. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  40. package/lib/commonjs/classes/HMSEventEmitter.js +10 -0
  41. package/lib/commonjs/classes/HMSEventEmitter.js.map +1 -0
  42. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  43. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  44. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  45. package/lib/commonjs/classes/HMSManagerModule.js +18 -0
  46. package/lib/commonjs/classes/HMSManagerModule.js.map +1 -0
  47. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
  48. package/lib/commonjs/classes/HMSNativeEventListener.js +13 -0
  49. package/lib/commonjs/classes/HMSNativeEventListener.js.map +1 -0
  50. package/lib/commonjs/classes/HMSPeersCache.js +3 -5
  51. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  52. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  53. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  54. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  55. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  56. package/lib/commonjs/classes/HMSRoomCache.js +10 -5
  57. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
  58. package/lib/commonjs/classes/HMSSDK.js +79 -84
  59. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  60. package/lib/commonjs/classes/HMSSessionStore.js +6 -7
  61. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
  62. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  63. package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
  64. package/lib/commonjs/classes/HmsView.js +4 -1
  65. package/lib/commonjs/classes/HmsView.js.map +1 -1
  66. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +8 -8
  67. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  68. package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
  69. package/lib/commonjs/components/HMSHLSPlayer/hooks.js.map +1 -1
  70. package/lib/commonjs/hooks/useHMSPeerUpdates.js +77 -0
  71. package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -0
  72. package/lib/commonjs/index.js +25 -1
  73. package/lib/commonjs/index.js.map +1 -1
  74. package/lib/module/classes/HMSAudioTrack.js.map +1 -1
  75. package/lib/module/classes/HMSBrowserRecordingState.js +2 -0
  76. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  77. package/lib/module/classes/HMSCameraControl.js +1 -4
  78. package/lib/module/classes/HMSCameraControl.js.map +1 -1
  79. package/lib/module/classes/HMSEncoder.js +31 -33
  80. package/lib/module/classes/HMSEncoder.js.map +1 -1
  81. package/lib/module/classes/HMSEventEmitter.js +3 -0
  82. package/lib/module/classes/HMSEventEmitter.js.map +1 -0
  83. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  84. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  85. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  86. package/lib/module/classes/HMSManagerModule.js +11 -0
  87. package/lib/module/classes/HMSManagerModule.js.map +1 -0
  88. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
  89. package/lib/module/classes/HMSNativeEventListener.js +5 -0
  90. package/lib/module/classes/HMSNativeEventListener.js.map +1 -0
  91. package/lib/module/classes/HMSPeersCache.js +1 -4
  92. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  93. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  94. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  95. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  96. package/lib/module/classes/HMSRoom.js.map +1 -1
  97. package/lib/module/classes/HMSRoomCache.js +8 -4
  98. package/lib/module/classes/HMSRoomCache.js.map +1 -1
  99. package/lib/module/classes/HMSSDK.js +27 -32
  100. package/lib/module/classes/HMSSDK.js.map +1 -1
  101. package/lib/module/classes/HMSSessionStore.js +2 -4
  102. package/lib/module/classes/HMSSessionStore.js.map +1 -1
  103. package/lib/module/classes/HMSTrack.js.map +1 -1
  104. package/lib/module/classes/HMSVideoTrack.js.map +1 -1
  105. package/lib/module/classes/HmsView.js +4 -1
  106. package/lib/module/classes/HmsView.js.map +1 -1
  107. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +8 -8
  108. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  109. package/lib/module/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
  110. package/lib/module/components/HMSHLSPlayer/hooks.js.map +1 -1
  111. package/lib/module/hooks/useHMSPeerUpdates.js +67 -0
  112. package/lib/module/hooks/useHMSPeerUpdates.js.map +1 -0
  113. package/lib/module/index.js +6 -0
  114. package/lib/module/index.js.map +1 -1
  115. package/lib/typescript/classes/HMSAudioTrack.d.ts +2 -1
  116. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +2 -0
  117. package/lib/typescript/classes/HMSEventEmitter.d.ts +2 -0
  118. package/lib/typescript/classes/HMSLocalAudioTrack.d.ts +2 -1
  119. package/lib/typescript/classes/HMSLocalPeer.d.ts +3 -2
  120. package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +2 -1
  121. package/lib/typescript/classes/HMSManagerModule.d.ts +3 -0
  122. package/lib/typescript/classes/HMSNativeEventListener.d.ts +4 -0
  123. package/lib/typescript/classes/HMSRemoteAudioTrack.d.ts +2 -1
  124. package/lib/typescript/classes/HMSRemotePeer.d.ts +3 -2
  125. package/lib/typescript/classes/HMSRemoteVideoTrack.d.ts +2 -1
  126. package/lib/typescript/classes/HMSRoom.d.ts +1 -1
  127. package/lib/typescript/classes/HMSSDK.d.ts +2 -1
  128. package/lib/typescript/classes/HMSTrack.d.ts +3 -2
  129. package/lib/typescript/classes/HMSVideoTrack.d.ts +2 -1
  130. package/lib/typescript/classes/HmsView.d.ts +1 -1
  131. package/lib/typescript/components/HMSHLSPlayer/RCTHMSHLSPlayer.d.ts +1 -1
  132. package/lib/typescript/components/HMSHLSPlayer/hooks.d.ts +1 -1
  133. package/lib/typescript/hooks/useHMSPeerUpdates.d.ts +7 -0
  134. package/lib/typescript/index.d.ts +2 -0
  135. package/package.json +1 -1
  136. package/sdk-versions.json +2 -2
  137. package/src/classes/HMSAudioTrack.ts +2 -1
  138. package/src/classes/HMSBrowserRecordingState.ts +3 -0
  139. package/src/classes/HMSCameraControl.ts +1 -2
  140. package/src/classes/HMSEncoder.ts +4 -5
  141. package/src/classes/HMSEventEmitter.ts +3 -0
  142. package/src/classes/HMSLocalAudioTrack.ts +2 -1
  143. package/src/classes/HMSLocalPeer.ts +3 -2
  144. package/src/classes/HMSLocalVideoTrack.ts +2 -1
  145. package/src/classes/HMSManagerModule.ts +18 -0
  146. package/src/classes/HMSNativeEventEmitter.ts +2 -1
  147. package/src/classes/HMSNativeEventListener.ts +8 -0
  148. package/src/classes/HMSPeersCache.ts +2 -3
  149. package/src/classes/HMSRemoteAudioTrack.ts +2 -1
  150. package/src/classes/HMSRemotePeer.ts +3 -2
  151. package/src/classes/HMSRemoteVideoTrack.ts +2 -1
  152. package/src/classes/HMSRoom.ts +1 -1
  153. package/src/classes/HMSRoomCache.ts +11 -3
  154. package/src/classes/HMSSDK.tsx +41 -43
  155. package/src/classes/HMSSessionStore.ts +6 -8
  156. package/src/classes/HMSTrack.ts +3 -2
  157. package/src/classes/HMSVideoTrack.ts +2 -1
  158. package/src/classes/HmsView.tsx +8 -2
  159. package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +36 -10
  160. package/src/components/HMSHLSPlayer/RCTHMSHLSPlayer.ts +2 -3
  161. package/src/components/HMSHLSPlayer/hooks.ts +3 -2
  162. package/src/hooks/useHMSPeerUpdates.ts +85 -0
  163. package/src/index.ts +6 -0
  164. package/android/local.properties +0 -8
  165. package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  166. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  167. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  168. package/ios/Hmssdk.xcodeproj/xcuserdata/yogesh.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -2,6 +2,7 @@ import { HMSVideoTrack } from './HMSVideoTrack';
2
2
  import type { HMSTrackType } from './HMSTrackType';
3
3
  import type { HMSLayer } from './HMSLayer';
4
4
  import type { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
5
+ import type { HMSTrackSource } from './HMSTrackSource';
5
6
  export declare class HMSRemoteVideoTrack extends HMSVideoTrack {
6
7
  /**
7
8
  * Switches Video of remote user on/off depending upon the value of playbackAllowed
@@ -16,7 +17,7 @@ export declare class HMSRemoteVideoTrack extends HMSVideoTrack {
16
17
  setLayer(layer: HMSLayer): Promise<any>;
17
18
  constructor(params: {
18
19
  trackId: string;
19
- source?: number | string;
20
+ source?: HMSTrackSource;
20
21
  trackDescription?: string;
21
22
  isMute?: boolean;
22
23
  playbackAllowed?: boolean;
@@ -19,6 +19,6 @@ export declare class HMSRoom {
19
19
  get serverRecordingState(): HMSServerRecordingState;
20
20
  get hlsStreamingState(): HMSHLSStreamingState;
21
21
  get hlsRecordingState(): HMSHLSRecordingState | undefined;
22
- get peerCount(): number;
22
+ get peerCount(): number | null;
23
23
  get localPeer(): HMSLocalPeer;
24
24
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { HMSTrackType } from './HMSTrackType';
3
3
  import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
4
- import { HmsComponentProps } from './HmsView';
4
+ import type { HmsComponentProps } from './HmsView';
5
5
  import type { HMSConfig } from './HMSConfig';
6
6
  import type { HMSLocalPeer } from './HMSLocalPeer';
7
7
  import type { HMSRemotePeer } from './HMSRemotePeer';
@@ -75,6 +75,7 @@ export declare class HMSSDK {
75
75
  appGroup?: String;
76
76
  preferredExtension?: String;
77
77
  logSettings?: HMSLogSettings;
78
+ isPrebuilt?: boolean;
78
79
  }): Promise<HMSSDK>;
79
80
  /**
80
81
  * - Calls removeListeners that in turn breaks all connections with native listeners.
@@ -1,7 +1,8 @@
1
+ import type { HMSTrackSource } from './HMSTrackSource';
1
2
  import type { HMSTrackType } from './HMSTrackType';
2
3
  export declare class HMSTrack {
3
4
  trackId: string;
4
- source?: number | string;
5
+ source?: HMSTrackSource;
5
6
  trackDescription?: string;
6
7
  mute?: boolean;
7
8
  id: string;
@@ -9,7 +10,7 @@ export declare class HMSTrack {
9
10
  isMute: () => boolean | undefined;
10
11
  constructor(params: {
11
12
  trackId: string;
12
- source?: number | string;
13
+ source?: HMSTrackSource;
13
14
  trackDescription?: string;
14
15
  isMute?: boolean;
15
16
  id: string;
@@ -1,10 +1,11 @@
1
1
  import { HMSTrack } from './HMSTrack';
2
+ import type { HMSTrackSource } from './HMSTrackSource';
2
3
  import type { HMSTrackType } from './HMSTrackType';
3
4
  export declare class HMSVideoTrack extends HMSTrack {
4
5
  isDegraded?: boolean;
5
6
  constructor(params: {
6
7
  trackId: string;
7
- source?: number | string;
8
+ source?: HMSTrackSource;
8
9
  trackDescription?: string;
9
10
  isMute?: boolean;
10
11
  id: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ViewStyle } from 'react-native';
2
+ import type { ViewStyle } from 'react-native';
3
3
  import { HMSVideoViewMode } from './HMSVideoViewMode';
4
4
  export interface HmsComponentProps {
5
5
  trackId: string;
@@ -1,4 +1,4 @@
1
- import { StyleProp, NativeSyntheticEvent, ViewStyle, NativeMethods } from 'react-native';
1
+ import type { StyleProp, NativeSyntheticEvent, ViewStyle, NativeMethods } from 'react-native';
2
2
  import type { HMSHLSPlayerPlaybackEvent, HMSHLSPlayerStatsEvent } from '../../types';
3
3
  export type HmsHlsPlaybackEventHandler = (event: NativeSyntheticEvent<HMSHLSPlayerPlaybackEvent>) => void;
4
4
  export type HmsHlsStatsEventHandler = (event: NativeSyntheticEvent<HMSHLSPlayerStatsEvent>) => void;
@@ -1,4 +1,4 @@
1
- import { DependencyList } from 'react';
1
+ import type { DependencyList } from 'react';
2
2
  import type { HMSHLSPlayerStatsUpdateEventData } from '../../types';
3
3
  import type { HMSHLSPlayerCue, HMSHLSPlayerPlaybackError, HMSHLSPlayerStatsError } from '../../stores/types';
4
4
  export declare const useHMSHLSPlayerPlaybackState: () => import("../../types").HMSHLSPlayerPlaybackState;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import type { HMSPeer } from '../classes/HMSPeer';
3
+ import { HMSPeerUpdate } from '../classes/HMSPeerUpdate';
4
+ export declare const useHMSPeerUpdates: (effect: (data: {
5
+ peer: HMSPeer;
6
+ type: HMSPeerUpdate;
7
+ }) => void, deps?: React.DependencyList | undefined) => void;
@@ -84,7 +84,9 @@ export * from './classes/HMSIOSAudioMode';
84
84
  export type { HMSSessionStore, HMSSessionStoreValue, } from './classes/HMSSessionStore';
85
85
  export type { HmsViewComponent as HMSView } from './classes/HmsView';
86
86
  import { HMSSDK as HmsManager } from './classes/HMSSDK';
87
+ export { default as HMSManagerModule } from './classes/HMSManagerModule';
87
88
  export * from './components/HMSHLSPlayer';
89
+ export * from './hooks/useHMSPeerUpdates';
88
90
  export * from './types';
89
91
  export * from './stores/types';
90
92
  export default HmsManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@100mslive/react-native-hms",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Integrate Real Time Audio and Video conferencing, Interactive Live Streaming, and Chat in your apps with 100ms React Native SDK. With support for HLS and RTMP Live Streaming and Recording, Picture-in-Picture (PiP), one-to-one Video Call Modes, Audio Rooms, Video Player and much more, add immersive real-time communications to your apps.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/sdk-versions.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "ios": "0.9.5",
2
+ "ios": "0.9.9",
3
3
  "iOSBroadcastExtension": "0.0.9",
4
4
  "iOSHMSHLSPlayer": "0.0.2",
5
- "android": "2.6.7"
5
+ "android": "2.7.3"
6
6
  }
@@ -1,10 +1,11 @@
1
1
  import { HMSTrack } from './HMSTrack';
2
+ import type { HMSTrackSource } from './HMSTrackSource';
2
3
  import type { HMSTrackType } from './HMSTrackType';
3
4
 
4
5
  export class HMSAudioTrack extends HMSTrack {
5
6
  constructor(params?: {
6
7
  trackId: string;
7
- source?: number | string;
8
+ source?: HMSTrackSource;
8
9
  trackDescription?: string;
9
10
  isMute?: boolean;
10
11
  id: string;
@@ -1,17 +1,20 @@
1
1
  import type { HMSException } from './HMSException';
2
2
 
3
3
  export class HMSBrowserRecordingState {
4
+ initialising: boolean;
4
5
  running: boolean;
5
6
  error?: HMSException;
6
7
  startedAt?: Date;
7
8
  stoppedAt?: Date;
8
9
 
9
10
  constructor(params: {
11
+ initialising: boolean;
10
12
  running: boolean;
11
13
  error?: HMSException;
12
14
  startedAt?: Date;
13
15
  stoppedAt?: Date;
14
16
  }) {
17
+ this.initialising = params.initialising;
15
18
  this.running = params.running;
16
19
  this.error = params.error;
17
20
  this.startedAt = params.startedAt;
@@ -1,7 +1,6 @@
1
- import { NativeModules } from 'react-native';
2
1
  import { HMSConstants } from './HMSConstants';
3
2
 
4
- const { HMSManager } = NativeModules;
3
+ import HMSManager from './HMSManagerModule';
5
4
 
6
5
  export class HMSCameraControl {
7
6
  /**
@@ -1,4 +1,4 @@
1
- import { NativeModules } from 'react-native';
1
+ import HMSManager from './HMSManagerModule';
2
2
 
3
3
  import { HMSTrack } from './HMSTrack';
4
4
  import { HMSAudioTrack } from './HMSAudioTrack';
@@ -40,8 +40,6 @@ import { HMSLayer } from './HMSLayer';
40
40
  import { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
41
41
  import { HMSQualityLimitationReasons } from './HMSQualityLimitationReasons';
42
42
 
43
- const { HMSManager } = NativeModules;
44
-
45
43
  interface InitialData {
46
44
  roles: Record<string, HMSRole>;
47
45
  }
@@ -335,7 +333,7 @@ export class HMSEncoder {
335
333
  return encodedRoles;
336
334
  }
337
335
 
338
- static encodeHmsRole(role: any) {
336
+ static encodeHmsRole(role: any): HMSRole {
339
337
  if (!role) {
340
338
  return new HMSRole(role);
341
339
  }
@@ -362,7 +360,7 @@ export class HMSEncoder {
362
360
  }
363
361
  }
364
362
 
365
- return rolesCache[role.name];
363
+ return rolesCache[role.name]!;
366
364
  }
367
365
 
368
366
  static encodeHmsRoleChangeRequest(data: any) {
@@ -438,6 +436,7 @@ export class HMSEncoder {
438
436
 
439
437
  static encodeBrowserRecordingState(data: any) {
440
438
  return new HMSBrowserRecordingState({
439
+ initialising: data?.initialising || false,
441
440
  running: data?.running || false,
442
441
  startedAt: HMSEncoder.encodeDate(data?.startedAt),
443
442
  stoppedAt: HMSEncoder.encodeDate(data?.stoppedAt),
@@ -0,0 +1,3 @@
1
+ import { EventEmitter } from '../utils';
2
+
3
+ export const HMSEventEmitter = new EventEmitter();
@@ -3,6 +3,7 @@ import { HMSAudioTrack } from './HMSAudioTrack';
3
3
  import { getLogger } from './HMSLogger';
4
4
  import type { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
5
5
  import type { HMSTrackType } from './HMSTrackType';
6
+ import type { HMSTrackSource } from './HMSTrackSource';
6
7
 
7
8
  const {
8
9
  /**
@@ -55,7 +56,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
55
56
  constructor(params: {
56
57
  id: string;
57
58
  trackId: string;
58
- source?: number | string;
59
+ source?: HMSTrackSource;
59
60
  trackDescription?: string;
60
61
  isMute?: boolean;
61
62
  settings?: HMSAudioTrackSettings;
@@ -4,6 +4,7 @@ import type { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
4
4
  import { HMSLocalAudioTrack } from './HMSLocalAudioTrack';
5
5
  import { HMSLocalVideoTrack } from './HMSLocalVideoTrack';
6
6
  import type { HMSTrackType } from './HMSTrackType';
7
+ import type { HMSTrackSource } from './HMSTrackSource';
7
8
 
8
9
  export class HMSLocalPeer extends HMSPeer {
9
10
  private localAudio?: HMSLocalAudioTrack;
@@ -21,7 +22,7 @@ export class HMSLocalPeer extends HMSPeer {
21
22
  localAudioTrackData?: {
22
23
  id: string;
23
24
  trackId: string;
24
- source?: number | string;
25
+ source?: HMSTrackSource;
25
26
  trackDescription?: string;
26
27
  isMute?: boolean;
27
28
  settings?: HMSAudioTrackSettings;
@@ -30,7 +31,7 @@ export class HMSLocalPeer extends HMSPeer {
30
31
  localVideoTrackData?: {
31
32
  id: string;
32
33
  trackId: string;
33
- source?: number | string;
34
+ source?: HMSTrackSource;
34
35
  trackDescription?: string;
35
36
  isMute?: boolean;
36
37
  settings?: HMSVideoTrackSettings;
@@ -3,6 +3,7 @@ import { HMSVideoTrack } from './HMSVideoTrack';
3
3
  import { getLogger } from './HMSLogger';
4
4
  import type { HMSVideoTrackSettings } from './HMSVideoTrackSettings';
5
5
  import type { HMSTrackType } from './HMSTrackType';
6
+ import type { HMSTrackSource } from './HMSTrackSource';
6
7
 
7
8
  const {
8
9
  /**
@@ -51,7 +52,7 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
51
52
  constructor(params: {
52
53
  id: string;
53
54
  trackId: string;
54
- source?: number | string;
55
+ source?: HMSTrackSource;
55
56
  trackDescription?: string;
56
57
  isMute?: boolean;
57
58
  settings?: HMSVideoTrackSettings;
@@ -0,0 +1,18 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ const { HMSManager } = NativeModules;
4
+
5
+ if (HMSManager == null) {
6
+ console.error(
7
+ `[@100mslive/react-native-hms] react-native-hms module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).
8
+
9
+ For installation instructions, please refer to https://www.100ms.live/docs/react-native/v2/how-to-guides/install-the-sdk/integration`
10
+ .split('\n')
11
+ .map((line) => line.trim())
12
+ .join('\n')
13
+ );
14
+ }
15
+
16
+ export type HMSManagerProps = any;
17
+
18
+ export default HMSManager as HMSManagerProps;
@@ -1,4 +1,5 @@
1
- import { EventSubscription, NativeEventEmitter } from 'react-native';
1
+ import { NativeEventEmitter } from 'react-native';
2
+ import type { EventSubscription } from 'react-native';
2
3
  import { logger } from './HMSLogger';
3
4
 
4
5
  export type HMSEventSubscription = {
@@ -0,0 +1,8 @@
1
+ import HMSManager from './HMSManagerModule';
2
+ import { HMSNativeEventEmitter } from './HMSNativeEventEmitter';
3
+
4
+ export type { HMSEventSubscription as HMSNativeEventSubscription } from './HMSNativeEventEmitter';
5
+
6
+ const HMSNativeEventListener = new HMSNativeEventEmitter(HMSManager);
7
+
8
+ export default HMSNativeEventListener;
@@ -1,4 +1,5 @@
1
- import { NativeModules } from 'react-native';
1
+ import HMSManager from './HMSManagerModule';
2
+
2
3
  import { HMSEncoder } from './HMSEncoder';
3
4
  import { HMSPeerUpdate } from './HMSPeerUpdate';
4
5
  import { HMSTrackUpdate } from './HMSTrackUpdate';
@@ -10,8 +11,6 @@ import type { HMSRole } from './HMSRole';
10
11
  import type { HMSAudioTrack } from './HMSAudioTrack';
11
12
  import type { HMSVideoTrack } from './HMSVideoTrack';
12
13
 
13
- const { HMSManager } = NativeModules;
14
-
15
14
  export let hmsPeersCache: HMSPeersCache | undefined;
16
15
 
17
16
  export const getHmsPeersCache = () => {
@@ -2,6 +2,7 @@ import { NativeModules } from 'react-native';
2
2
  import { getLogger } from './HMSLogger';
3
3
  import type { HMSTrackType } from './HMSTrackType';
4
4
  import { HMSAudioTrack } from './HMSAudioTrack';
5
+ import type { HMSTrackSource } from './HMSTrackSource';
5
6
 
6
7
  const {
7
8
  /**
@@ -54,7 +55,7 @@ export class HMSRemoteAudioTrack extends HMSAudioTrack {
54
55
 
55
56
  constructor(params: {
56
57
  trackId: string;
57
- source?: number | string;
58
+ source?: HMSTrackSource;
58
59
  isMute?: boolean;
59
60
  trackDescription?: string;
60
61
  playbackAllowed?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { HMSPeer } from './HMSPeer';
2
2
  import { HMSRemoteAudioTrack } from './HMSRemoteAudioTrack';
3
3
  import { HMSRemoteVideoTrack } from './HMSRemoteVideoTrack';
4
+ import type { HMSTrackSource } from './HMSTrackSource';
4
5
 
5
6
  export class HMSRemotePeer extends HMSPeer {
6
7
  private remoteAudio?: HMSRemoteAudioTrack;
@@ -18,7 +19,7 @@ export class HMSRemotePeer extends HMSPeer {
18
19
  peerID: string;
19
20
  remoteAudioTrackData?: {
20
21
  trackId: string;
21
- source?: number | string;
22
+ source?: HMSTrackSource;
22
23
  isMute?: boolean;
23
24
  trackDescription?: string;
24
25
  playbackAllowed?: boolean;
@@ -26,7 +27,7 @@ export class HMSRemotePeer extends HMSPeer {
26
27
  };
27
28
  remoteVideoTrackData?: {
28
29
  trackId: string;
29
- source?: number | string;
30
+ source?: HMSTrackSource;
30
31
  trackDescription?: string;
31
32
  isMute?: boolean;
32
33
  playbackAllowed?: boolean;
@@ -5,6 +5,7 @@ import type { HMSTrackType } from './HMSTrackType';
5
5
  import type { HMSLayer } from './HMSLayer';
6
6
  import type { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
7
7
  import { HMSEncoder } from './HMSEncoder';
8
+ import type { HMSTrackSource } from './HMSTrackSource';
8
9
 
9
10
  const {
10
11
  /**
@@ -105,7 +106,7 @@ export class HMSRemoteVideoTrack extends HMSVideoTrack {
105
106
 
106
107
  constructor(params: {
107
108
  trackId: string;
108
- source?: number | string;
109
+ source?: HMSTrackSource;
109
110
  trackDescription?: string;
110
111
  isMute?: boolean;
111
112
  playbackAllowed?: boolean;
@@ -128,7 +128,7 @@ export class HMSRoom {
128
128
  );
129
129
  }
130
130
 
131
- get peerCount(): number {
131
+ get peerCount(): number | null {
132
132
  const hmsRoomCache = getHmsRoomCache();
133
133
 
134
134
  if (hmsRoomCache) {
@@ -1,10 +1,9 @@
1
- import { NativeModules } from 'react-native';
1
+ import HMSManager from './HMSManagerModule';
2
+
2
3
  import type { HMSRoom } from './HMSRoom';
3
4
  import { HMSEncoder } from './HMSEncoder';
4
5
  import { HMSRoomUpdate } from './HMSRoomUpdate';
5
6
 
6
- const { HMSManager } = NativeModules;
7
-
8
7
  export let hmsRoomCache: HMSRoomCache | undefined;
9
8
 
10
9
  export const getHmsRoomCache = () => hmsRoomCache;
@@ -93,6 +92,13 @@ export class HMSRoomCache {
93
92
  );
94
93
  break;
95
94
  }
95
+ case HMSRoomUpdate.ROOM_PEER_COUNT_UPDATED: {
96
+ this._data.set(
97
+ 'peerCount',
98
+ encodeHMSRoomProperty(this.id, 'peerCount', data)
99
+ );
100
+ break;
101
+ }
96
102
  default: {
97
103
  for (const key in data) {
98
104
  const property = key as keyof HMSRoomCacheProps;
@@ -149,6 +155,8 @@ function encodeHMSRoomProperty<T extends keyof HMSRoomCacheProps>(
149
155
  value = HMSEncoder.encodeHLSRecordingState(data.hlsRecordingState);
150
156
  } else if (property === 'localPeer') {
151
157
  value = HMSEncoder.encodeHmsLocalPeer(data.localPeer, id);
158
+ } else if (property === 'peerCount') {
159
+ value = typeof data[property] === 'number' ? data[property] : null;
152
160
  } else {
153
161
  value = data[property];
154
162
  }