@100mslive/react-native-hms 1.7.2 → 2.0.0-alpha.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.
Files changed (119) hide show
  1. package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
  2. package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
  3. package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
  4. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  5. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  6. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/{6.7.1/fileHashes/fileHashes.bin → 6.9/fileHashes/resourceHashesCache.bin} +0 -0
  8. package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
  9. package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
  10. package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
  11. package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
  12. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  14. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  15. package/android/.gradle/checksums/checksums.lock +0 -0
  16. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  17. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  18. package/android/.idea/compiler.xml +6 -0
  19. package/android/.idea/gradle.xml +18 -0
  20. package/android/.idea/jarRepositories.xml +45 -0
  21. package/android/.idea/misc.xml +10 -0
  22. package/android/.idea/vcs.xml +6 -0
  23. package/android/build.gradle +3 -3
  24. package/android/local.properties +8 -1
  25. package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +1 -0
  26. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +42 -14
  27. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +113 -68
  28. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +17 -4
  29. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +46 -18
  30. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +483 -184
  31. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +551 -151
  32. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +26 -7
  33. package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +32 -12
  34. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +1 -0
  35. package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +10 -6
  36. package/android/src/main/res/layout/player_view.xml +3 -2
  37. package/ios/HMSConstants.swift +1 -0
  38. package/ios/HMSDecoder.swift +18 -7
  39. package/ios/HMSHLSPlayerManager.swift +18 -2
  40. package/ios/HMSManager.m +239 -70
  41. package/ios/HMSManager.swift +24 -3
  42. package/ios/HMSRNSDK.swift +129 -126
  43. package/ios/HMSView.swift +17 -3
  44. package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  45. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  46. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  47. package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  48. package/lib/commonjs/classes/HMSEncoder.js +6 -0
  49. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  50. package/lib/commonjs/classes/HMSPIPListenerActions.js +1 -0
  51. package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
  52. package/lib/commonjs/classes/HMSPeer.js +15 -0
  53. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  54. package/lib/commonjs/classes/HMSPeerListIterator.js +46 -0
  55. package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -0
  56. package/lib/commonjs/classes/HMSPeerListIteratorOptions.js +2 -0
  57. package/lib/commonjs/classes/HMSPeerListIteratorOptions.js.map +1 -0
  58. package/lib/commonjs/classes/HMSPeerUpdate.js +2 -1
  59. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  60. package/lib/commonjs/classes/HMSPeersCache.js +7 -0
  61. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  62. package/lib/commonjs/classes/HMSSDK.js +162 -29
  63. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  64. package/lib/commonjs/classes/HMSUpdateListenerActions.js +1 -0
  65. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  66. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +10 -5
  67. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  68. package/lib/commonjs/index.js.map +1 -1
  69. package/lib/commonjs/types.js +1 -0
  70. package/lib/commonjs/types.js.map +1 -1
  71. package/lib/module/classes/HMSEncoder.js +6 -0
  72. package/lib/module/classes/HMSEncoder.js.map +1 -1
  73. package/lib/module/classes/HMSPIPListenerActions.js +1 -0
  74. package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
  75. package/lib/module/classes/HMSPeer.js +15 -0
  76. package/lib/module/classes/HMSPeer.js.map +1 -1
  77. package/lib/module/classes/HMSPeerListIterator.js +40 -0
  78. package/lib/module/classes/HMSPeerListIterator.js.map +1 -0
  79. package/lib/module/classes/HMSPeerListIteratorOptions.js +2 -0
  80. package/lib/module/classes/HMSPeerListIteratorOptions.js.map +1 -0
  81. package/lib/module/classes/HMSPeerUpdate.js +2 -1
  82. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  83. package/lib/module/classes/HMSPeersCache.js +7 -0
  84. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  85. package/lib/module/classes/HMSSDK.js +162 -30
  86. package/lib/module/classes/HMSSDK.js.map +1 -1
  87. package/lib/module/classes/HMSUpdateListenerActions.js +1 -0
  88. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  89. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +11 -6
  90. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  91. package/lib/module/index.js.map +1 -1
  92. package/lib/module/types.js +1 -0
  93. package/lib/module/types.js.map +1 -1
  94. package/lib/typescript/classes/HMSEncoder.d.ts +1 -0
  95. package/lib/typescript/classes/HMSPIPListenerActions.d.ts +1 -0
  96. package/lib/typescript/classes/HMSPeer.d.ts +3 -0
  97. package/lib/typescript/classes/HMSPeerListIterator.d.ts +7 -0
  98. package/lib/typescript/classes/HMSPeerListIteratorOptions.d.ts +5 -0
  99. package/lib/typescript/classes/HMSPeerUpdate.d.ts +2 -1
  100. package/lib/typescript/classes/HMSPeersCache.d.ts +1 -0
  101. package/lib/typescript/classes/HMSSDK.d.ts +46 -13
  102. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +2 -1
  103. package/lib/typescript/index.d.ts +1 -1
  104. package/lib/typescript/types.d.ts +3 -1
  105. package/package.json +1 -1
  106. package/sdk-versions.json +2 -2
  107. package/src/classes/HMSEncoder.ts +9 -0
  108. package/src/classes/HMSPIPListenerActions.ts +1 -0
  109. package/src/classes/HMSPeer.ts +25 -0
  110. package/src/classes/HMSPeerListIterator.ts +40 -0
  111. package/src/classes/HMSPeerListIteratorOptions.ts +5 -0
  112. package/src/classes/HMSPeerUpdate.ts +2 -0
  113. package/src/classes/HMSPeersCache.ts +7 -0
  114. package/src/classes/HMSSDK.tsx +202 -26
  115. package/src/classes/HMSUpdateListenerActions.ts +1 -0
  116. package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +15 -13
  117. package/src/index.ts +4 -1
  118. package/src/types.ts +2 -0
  119. package/android/.gradle/6.7.1/executionHistory/executionHistory.bin +0 -0
@@ -43,11 +43,14 @@ import {
43
43
  } from './HMSRoomCache';
44
44
  import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
45
45
  import { HMSSessionStore } from './HMSSessionStore';
46
+ // import type { HMSPeerListIteratorOptions } from './HMSPeerListIteratorOptions';
47
+ // import { HMSPeerListIterator } from './HMSPeerListIterator';
46
48
 
47
49
  type HmsViewProps = Omit<HmsComponentProps, 'id'>;
48
50
 
49
51
  // TODO: Rename to HMSPIPConfig & to be moved to a separate file
50
52
  interface PIPConfig {
53
+ autoEnterPipMode?: boolean;
51
54
  aspectRatio?: [number, number];
52
55
  endButton?: boolean;
53
56
  audioButton?: boolean;
@@ -66,6 +69,7 @@ export class HMSSDK {
66
69
  private onJoinDelegate?: any;
67
70
  private onRoomDelegate?: any;
68
71
  private onPeerDelegate?: any;
72
+ private onPeerListUpdatedDelegate?: any;
69
73
  private onTrackDelegate?: any;
70
74
  private onErrorDelegate?: any;
71
75
  private onMessageDelegate?: any;
@@ -83,6 +87,7 @@ export class HMSSDK {
83
87
  private onAudioDeviceChangedDelegate?: any;
84
88
  private onSessionStoreAvailableDelegate?: any;
85
89
  private onPIPRoomLeaveDelegate?: any;
90
+ private onPIPModeChangedDelegate?: any;
86
91
 
87
92
  private emitterSubscriptions: Partial<
88
93
  Record<
@@ -207,30 +212,6 @@ export class HMSSDK {
207
212
  HMSManager.preview({ ...config, id: this.id });
208
213
  };
209
214
 
210
- /**
211
- * - previewForRole can be used when there is role change request for current localPeer and we want
212
- * to show the localPeer how the tracks look before publishing them to room.
213
- *
214
- * - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
215
- *
216
- * checkout {@link https://www.100ms.live/docs/react-native} for more info
217
- *
218
- * @param {HMSRole}
219
- * @memberof HMSSDK
220
- */
221
- previewForRole = async (role: HMSRole) => {
222
- logger?.verbose('#Function previewForRole', {
223
- role,
224
- id: this.id,
225
- });
226
- if (Platform.OS === 'ios') {
227
- return await HMSManager.previewForRole({ role: role?.name, id: this.id });
228
- } else {
229
- console.log('API currently not available for android');
230
- return 'API currently not available for android';
231
- }
232
- };
233
-
234
215
  /**
235
216
  * - HmsView is react component that takes trackId and starts showing that track on a tile.
236
217
  * - The appearance of tile is completely customizable with style prop.
@@ -656,6 +637,54 @@ export class HMSSDK {
656
637
  return await HMSManager.changeName(data);
657
638
  };
658
639
 
640
+ /**
641
+ * -Preview for a specific Role before changing it.
642
+ *
643
+ * By previewing before doing a Role Change, users can see their expected Audio & Video tracks which will be visible to other Peers in Room post changing the Role.
644
+ *
645
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
646
+ *
647
+ * @param {role: string}
648
+ * @memberof HMSSDK
649
+ */
650
+ previewForRole = async (role: string) => {
651
+ logger?.verbose('#Function previewForRole', {
652
+ role,
653
+ id: this.id,
654
+ });
655
+ const data = await HMSManager.previewForRole({
656
+ role,
657
+ id: this.id,
658
+ });
659
+
660
+ const previewTracks = HMSEncoder.encodeHmsPreviewForRoleTracks(
661
+ data.tracks,
662
+ this.id
663
+ );
664
+
665
+ return previewTracks;
666
+ };
667
+
668
+ /**
669
+ * Cancel the Previewing for Role invocation.
670
+ *
671
+ * If a [previewForRole] call was performed previously then calling this method clears the tracks created anticipating a Change of Role
672
+ *
673
+ * checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
674
+ *
675
+ * @memberof HMSSDK
676
+ */
677
+ cancelPreview = async () => {
678
+ logger?.verbose('#Function cancelPreview', {
679
+ id: this.id,
680
+ });
681
+ const data: { data: string } = await HMSManager.cancelPreview({
682
+ id: this.id,
683
+ });
684
+
685
+ return data;
686
+ };
687
+
659
688
  /**
660
689
  * - Calling this function will accept the most recent roleChange request made by anyone in the room
661
690
  *
@@ -1121,6 +1150,68 @@ export class HMSSDK {
1121
1150
  return HMSEncoder.encodeHmsPeer({ peerID: peerId });
1122
1151
  };
1123
1152
 
1153
+ /**
1154
+ * - This function is used to raise hand for the local peer
1155
+ * @memberof HMSSDK
1156
+ */
1157
+ raiseLocalPeerHand = async () => {
1158
+ const data = {
1159
+ id: this.id,
1160
+ };
1161
+ logger?.verbose('#Function raiseLocalPeerHand', data);
1162
+ return HMSManager.raiseLocalPeerHand(data);
1163
+ };
1164
+
1165
+ /**
1166
+ * - This function is used to lower hand for the local peer
1167
+ * @memberof HMSSDK
1168
+ */
1169
+ lowerLocalPeerHand = async () => {
1170
+ const data = {
1171
+ id: this.id,
1172
+ };
1173
+ logger?.verbose('#Function lowerLocalPeerHand', data);
1174
+ return HMSManager.lowerLocalPeerHand(data);
1175
+ };
1176
+
1177
+ /**
1178
+ * - This function is used to lower hand for the remote peer
1179
+ * @param peer
1180
+ */
1181
+ lowerRemotePeerHand = async (peer: HMSPeer) => {
1182
+ const data = {
1183
+ peerId: peer.peerID,
1184
+ id: this.id,
1185
+ };
1186
+ logger?.verbose('#Function lowerRemotePeerHand', data);
1187
+ return HMSManager.lowerRemotePeerHand(data);
1188
+ };
1189
+
1190
+ // getPeerListIterator = (
1191
+ // options?: HMSPeerListIteratorOptions
1192
+ // ): HMSPeerListIterator => {
1193
+ // logger?.verbose('#Function getPeerListIterator', {
1194
+ // id: this.id,
1195
+ // options,
1196
+ // });
1197
+
1198
+ // const uniqueId = Date.now();
1199
+
1200
+ // const data: null | { sucess: boolean; uniqueId: number } =
1201
+ // HMSManager.getPeerListIterator({
1202
+ // id: this.id,
1203
+ // ...options,
1204
+ // limit: options?.limit ?? 10,
1205
+ // uniqueId: uniqueId,
1206
+ // });
1207
+
1208
+ // if (!data) {
1209
+ // throw new Error('Unable to create PeerListIterator');
1210
+ // }
1211
+
1212
+ // return new HMSPeerListIterator(data.uniqueId);
1213
+ // };
1214
+
1124
1215
  /**
1125
1216
  * - This is a prototype event listener that takes action and listens for updates related to that particular action
1126
1217
  *
@@ -1205,6 +1296,28 @@ export class HMSSDK {
1205
1296
  this.onPeerDelegate = callback;
1206
1297
  break;
1207
1298
  }
1299
+ case HMSUpdateListenerActions.ON_PEER_LIST_UPDATED: {
1300
+ // Checking if we already have ON_PEER_LIST_UPDATED subscription
1301
+ if (
1302
+ !this.emitterSubscriptions[
1303
+ HMSUpdateListenerActions.ON_PEER_LIST_UPDATED
1304
+ ]
1305
+ ) {
1306
+ // Adding ON_PEER_LIST_UPDATED native listener
1307
+ const peerListUpdatedSubscription =
1308
+ HMSNativeEventListener.addListener(
1309
+ this.id,
1310
+ HMSUpdateListenerActions.ON_PEER_LIST_UPDATED,
1311
+ this.onPeerListUpdatedListener
1312
+ );
1313
+ this.emitterSubscriptions[
1314
+ HMSUpdateListenerActions.ON_PEER_LIST_UPDATED
1315
+ ] = peerListUpdatedSubscription;
1316
+ }
1317
+ // Adding App Delegate listener
1318
+ this.onPeerListUpdatedDelegate = callback;
1319
+ break;
1320
+ }
1208
1321
  case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
1209
1322
  // Checking if we already have ON_TRACK_UPDATE subscription
1210
1323
  if (
@@ -1530,6 +1643,25 @@ export class HMSSDK {
1530
1643
  }
1531
1644
  break;
1532
1645
  }
1646
+ case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
1647
+ if (Platform.OS === 'android') {
1648
+ // Checking if we already have ON_PIP_MODE_CHANGED subscription
1649
+ if (
1650
+ !this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED]
1651
+ ) {
1652
+ const pipModeChangedSubscription = HMSNativeEventListener.addListener(
1653
+ this.id,
1654
+ HMSPIPListenerActions.ON_PIP_MODE_CHANGED,
1655
+ this.onPIPModeChangedListener
1656
+ );
1657
+ this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
1658
+ pipModeChangedSubscription;
1659
+ }
1660
+ // Adding PIP mode changed Delegate listener
1661
+ this.onPIPModeChangedDelegate = callback;
1662
+ }
1663
+ break;
1664
+ }
1533
1665
  default:
1534
1666
  }
1535
1667
  };
@@ -1869,6 +2001,22 @@ export class HMSSDK {
1869
2001
  }
1870
2002
  break;
1871
2003
  }
2004
+ case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
2005
+ if (Platform.OS === 'android') {
2006
+ const subscription =
2007
+ this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED];
2008
+ // Removing ON_PIP_MODE_CHANGED native listener
2009
+ if (subscription) {
2010
+ subscription.remove();
2011
+
2012
+ this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
2013
+ undefined;
2014
+ }
2015
+ // Removing App Delegate listener
2016
+ this.onPIPModeChangedDelegate = null;
2017
+ }
2018
+ break;
2019
+ }
1872
2020
  default:
1873
2021
  }
1874
2022
  };
@@ -2002,6 +2150,26 @@ export class HMSSDK {
2002
2150
  }
2003
2151
  };
2004
2152
 
2153
+ onPeerListUpdatedListener = (data: any) => {
2154
+ if (data.id !== this.id) {
2155
+ return;
2156
+ }
2157
+ const addedPeers = HMSEncoder.encodeHmsPeers(data.addedPeers);
2158
+ const removedPeers = HMSEncoder.encodeHmsPeers(data.removedPeers);
2159
+
2160
+ if (this.onPeerListUpdatedDelegate) {
2161
+ logger?.verbose('#Listener ON_PEER_LIST_UPDATED_LISTENER_CALL', {
2162
+ totalAddedPeers: addedPeers.length,
2163
+ totalRemovedPeers: removedPeers.length,
2164
+ });
2165
+
2166
+ this.onPeerListUpdatedDelegate({
2167
+ addedPeers,
2168
+ removedPeers,
2169
+ });
2170
+ }
2171
+ };
2172
+
2005
2173
  onTrackListener = (data: any) => {
2006
2174
  if (data.id !== this.id) {
2007
2175
  return;
@@ -2300,12 +2468,20 @@ export class HMSSDK {
2300
2468
  }
2301
2469
  };
2302
2470
 
2471
+ onPIPModeChangedListener = (data: { isInPictureInPictureMode: boolean }) => {
2472
+ if (this.onPIPModeChangedDelegate) {
2473
+ logger?.verbose('#Listener onPIPModeChanged_CALL', data);
2474
+
2475
+ this.onPIPModeChangedDelegate(data);
2476
+ }
2477
+ }
2478
+
2303
2479
  async isPipModeSupported(): Promise<undefined | boolean> {
2304
2480
  return HMSManager.handlePipActions('isPipModeSupported', { id: this.id });
2305
2481
  }
2306
2482
 
2307
- async enablePipMode(data?: PIPConfig): Promise<undefined | boolean> {
2308
- return HMSManager.handlePipActions('enablePipMode', {
2483
+ async enterPipMode(data?: PIPConfig): Promise<undefined | boolean> {
2484
+ return HMSManager.handlePipActions('enterPipMode', {
2309
2485
  ...data,
2310
2486
  id: this.id,
2311
2487
  });
@@ -26,4 +26,5 @@ export enum HMSUpdateListenerActions {
26
26
  ON_AUDIO_DEVICE_CHANGED = 'ON_AUDIO_DEVICE_CHANGED',
27
27
  ON_SESSION_STORE_AVAILABLE = 'ON_SESSION_STORE_AVAILABLE',
28
28
  ON_SESSION_STORE_CHANGED = 'ON_SESSION_STORE_CHANGED',
29
+ ON_PEER_LIST_UPDATED = 'ON_PEER_LIST_UPDATED',
29
30
  }
@@ -1,4 +1,4 @@
1
- import React, { useImperativeHandle, useRef } from 'react';
1
+ import React, { useImperativeHandle, useRef, useState } from 'react';
2
2
  import { View, StyleSheet, UIManager, findNodeHandle } from 'react-native';
3
3
  import type { StyleProp, ViewStyle } from 'react-native';
4
4
 
@@ -50,18 +50,13 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
50
50
  HMSHLSPlayerRefProperties,
51
51
  HMSHLSPlayerProps
52
52
  > = (
53
- {
54
- url = '',
55
- style,
56
- containerStyle,
57
- aspectRatio = 9 / 16,
58
- enableStats,
59
- enableControls = false,
60
- },
53
+ { url = '', style, containerStyle, enableStats, enableControls = false },
61
54
  ref
62
55
  ) => {
63
56
  const hmsHlsPlayerRef = useRef<RCTHMSHLSPlayerRef | null>(null);
64
57
 
58
+ const [aspectRatio, setAspectRatio] = useState(16 / 9);
59
+
65
60
  useImperativeHandle(
66
61
  ref,
67
62
  () => ({
@@ -205,6 +200,11 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
205
200
  setHMSHLSPlayerPlaybackError(data.error);
206
201
  } else {
207
202
  setHMSHLSPlayerPlaybackState(data.state);
203
+ if (data.state === 'onVideoSizeChanged') {
204
+ if (typeof data.aspectRatio === 'number') {
205
+ setAspectRatio(data.aspectRatio);
206
+ }
207
+ }
208
208
  }
209
209
  };
210
210
 
@@ -225,7 +225,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
225
225
  <RCTHMSHLSPlayer
226
226
  ref={hmsHlsPlayerRef}
227
227
  url={url}
228
- style={[styles.player, { aspectRatio }]}
228
+ style={[
229
+ styles.player,
230
+ { aspectRatio: aspectRatio, flex: aspectRatio < 1 ? 1 : undefined },
231
+ ]}
229
232
  enableStats={enableStats}
230
233
  enableControls={enableControls}
231
234
  onHmsHlsPlaybackEvent={handleHLSPlaybackEvent}
@@ -254,8 +257,7 @@ const styles = StyleSheet.create({
254
257
  },
255
258
  player: {
256
259
  width: '100%',
257
- maxHeight: '100%',
258
- maxWidth: '100%',
259
- aspectRatio: 9 / 16,
260
+ aspectRatio: 16 / 9,
261
+ flex: 1,
260
262
  },
261
263
  });
package/src/index.ts CHANGED
@@ -84,7 +84,10 @@ export type {
84
84
  HMSSessionStore,
85
85
  HMSSessionStoreValue,
86
86
  } from './classes/HMSSessionStore';
87
- export type { HmsViewComponent as HMSView } from './classes/HmsView';
87
+ export type {
88
+ HmsViewComponent as HMSView,
89
+ HmsComponentProps as HMSViewProps,
90
+ } from './classes/HmsView';
88
91
 
89
92
  import { HMSSDK as HmsManager } from './classes/HMSSDK';
90
93
 
package/src/types.ts CHANGED
@@ -34,10 +34,12 @@ export enum HMSHLSPlayerPlaybackState {
34
34
  PLAYING = 'playing',
35
35
  STOPPED = 'stopped',
36
36
  UNKNOWN = 'unknown',
37
+ onVideoSizeChanged = 'onVideoSizeChanged',
37
38
  }
38
39
 
39
40
  export type HMSHLSPlayerPlaybackStateChangeEventData = {
40
41
  state: HMSHLSPlayerPlaybackState;
42
+ aspectRatio: number | undefined;
41
43
  };
42
44
 
43
45
  type HMSHLSPlayerPlaybackCueEvent = HMSHLSPlayerEvent<