@100mslive/react-native-hms 0.9.4 → 0.9.5

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 (181) hide show
  1. package/README.md +1 -2
  2. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  3. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  5. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  6. package/android/.gradle/checksums/checksums.lock +0 -0
  7. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  8. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  9. package/android/build.gradle +1 -1
  10. package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +80 -73
  11. package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +1 -1
  12. package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +9 -9
  13. package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +29 -8
  14. package/ios/HmsView.swift +2 -14
  15. package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
  16. package/lib/commonjs/classes/HMSAudioSettings.js.map +1 -1
  17. package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
  18. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  19. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  20. package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
  21. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
  22. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  23. package/lib/commonjs/classes/HMSEncoder.js +15 -7
  24. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  25. package/lib/commonjs/classes/HMSException.js.map +1 -1
  26. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
  27. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  28. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -1
  29. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -1
  30. package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
  31. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
  32. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  33. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -1
  34. package/lib/commonjs/classes/HMSLocalAudioTrack.js +3 -5
  35. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  36. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  37. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
  38. package/lib/commonjs/classes/HMSLocalVideoTrack.js +3 -5
  39. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  40. package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
  41. package/lib/commonjs/classes/HMSLogger.js +19 -1
  42. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  43. package/lib/commonjs/classes/HMSMessage.js +1 -1
  44. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  45. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
  46. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
  47. package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
  48. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  49. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  50. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  51. package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
  52. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -1
  53. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -1
  54. package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
  55. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -1
  56. package/lib/commonjs/classes/HMSRemoteAudioTrack.js +3 -5
  57. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  58. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  59. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -1
  60. package/lib/commonjs/classes/HMSRemoteVideoTrack.js +3 -5
  61. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  62. package/lib/commonjs/classes/HMSRole.js.map +1 -1
  63. package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
  64. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  65. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  66. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  67. package/lib/commonjs/classes/HMSSDK.js +77 -202
  68. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  69. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  70. package/lib/commonjs/classes/HMSSimulcastLayerSettings.js.map +1 -1
  71. package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
  72. package/lib/commonjs/classes/HMSSpeaker.js.map +1 -1
  73. package/lib/commonjs/classes/HMSSpeakerUpdate.js.map +1 -1
  74. package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
  75. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  76. package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
  77. package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
  78. package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
  79. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  80. package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
  81. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
  82. package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
  83. package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
  84. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  85. package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
  86. package/lib/commonjs/classes/HmsView.js +64 -16
  87. package/lib/commonjs/classes/HmsView.js.map +1 -1
  88. package/lib/commonjs/index.js +0 -14
  89. package/lib/commonjs/index.js.map +1 -1
  90. package/lib/module/classes/HMSAudioCodec.js.map +1 -1
  91. package/lib/module/classes/HMSAudioSettings.js.map +1 -1
  92. package/lib/module/classes/HMSAudioTrack.js.map +1 -1
  93. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  94. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  95. package/lib/module/classes/HMSCameraFacing.js.map +1 -1
  96. package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
  97. package/lib/module/classes/HMSConfig.js.map +1 -1
  98. package/lib/module/classes/HMSEncoder.js +5 -1
  99. package/lib/module/classes/HMSEncoder.js.map +1 -1
  100. package/lib/module/classes/HMSException.js.map +1 -1
  101. package/lib/module/classes/HMSHLSConfig.js.map +1 -1
  102. package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  103. package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -1
  104. package/lib/module/classes/HMSHLSRecordingState.js.map +1 -1
  105. package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
  106. package/lib/module/classes/HMSHLSVariant.js.map +1 -1
  107. package/lib/module/classes/HMSHelper.js.map +1 -1
  108. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -1
  109. package/lib/module/classes/HMSLocalAudioTrack.js +3 -3
  110. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  111. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  112. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
  113. package/lib/module/classes/HMSLocalVideoTrack.js +3 -3
  114. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  115. package/lib/module/classes/HMSLogLevel.js.map +1 -1
  116. package/lib/module/classes/HMSLogger.js +10 -0
  117. package/lib/module/classes/HMSLogger.js.map +1 -1
  118. package/lib/module/classes/HMSMessage.js +1 -1
  119. package/lib/module/classes/HMSMessage.js.map +1 -1
  120. package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
  121. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -1
  122. package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
  123. package/lib/module/classes/HMSPeer.js.map +1 -1
  124. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  125. package/lib/module/classes/HMSPermissions.js.map +1 -1
  126. package/lib/module/classes/HMSPublishSettings.js.map +1 -1
  127. package/lib/module/classes/HMSRTCStats.js.map +1 -1
  128. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -1
  129. package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
  130. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -1
  131. package/lib/module/classes/HMSRemoteAudioTrack.js +3 -3
  132. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  133. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  134. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -1
  135. package/lib/module/classes/HMSRemoteVideoTrack.js +3 -3
  136. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  137. package/lib/module/classes/HMSRole.js.map +1 -1
  138. package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
  139. package/lib/module/classes/HMSRoom.js.map +1 -1
  140. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  141. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  142. package/lib/module/classes/HMSSDK.js +77 -203
  143. package/lib/module/classes/HMSSDK.js.map +1 -1
  144. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  145. package/lib/module/classes/HMSSimulcastLayerSettings.js.map +1 -1
  146. package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
  147. package/lib/module/classes/HMSSpeaker.js.map +1 -1
  148. package/lib/module/classes/HMSSpeakerUpdate.js.map +1 -1
  149. package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
  150. package/lib/module/classes/HMSTrack.js.map +1 -1
  151. package/lib/module/classes/HMSTrackSettings.js.map +1 -1
  152. package/lib/module/classes/HMSTrackType.js.map +1 -1
  153. package/lib/module/classes/HMSTrackUpdate.js.map +1 -1
  154. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  155. package/lib/module/classes/HMSVideoCodec.js.map +1 -1
  156. package/lib/module/classes/HMSVideoResolution.js.map +1 -1
  157. package/lib/module/classes/HMSVideoSettings.js.map +1 -1
  158. package/lib/module/classes/HMSVideoTrack.js.map +1 -1
  159. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  160. package/lib/module/classes/HMSVideoViewMode.js.map +1 -1
  161. package/lib/module/classes/HmsView.js +62 -16
  162. package/lib/module/classes/HmsView.js.map +1 -1
  163. package/lib/module/index.js +0 -1
  164. package/lib/module/index.js.map +1 -1
  165. package/lib/typescript/classes/HMSEncoder.d.ts +5 -1
  166. package/lib/typescript/classes/HMSLogger.d.ts +3 -0
  167. package/lib/typescript/classes/HMSSDK.d.ts +4 -8
  168. package/lib/typescript/classes/HmsView.d.ts +5 -7
  169. package/lib/typescript/index.d.ts +0 -1
  170. package/package.json +2 -2
  171. package/react-native-hms.podspec +1 -1
  172. package/src/classes/HMSEncoder.ts +5 -9
  173. package/src/classes/HMSLocalAudioTrack.ts +3 -3
  174. package/src/classes/HMSLocalVideoTrack.ts +3 -3
  175. package/src/classes/HMSLogger.ts +11 -0
  176. package/src/classes/HMSMessage.ts +1 -1
  177. package/src/classes/HMSRemoteAudioTrack.ts +3 -3
  178. package/src/classes/HMSRemoteVideoTrack.ts +3 -3
  179. package/src/classes/HMSSDK.tsx +18 -32
  180. package/src/classes/HmsView.tsx +98 -48
  181. package/src/index.ts +0 -1
@@ -1,22 +1,24 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { requireNativeComponent, StyleSheet } from 'react-native';
3
- import { HMSVideoViewMode } from '../classes/HMSVideoViewMode';
4
- const HmsViewComponent = requireNativeComponent('HmsView');
5
- export const HmsView = _ref => {
6
- let {
7
- sink,
1
+ import React, { useState, useEffect, useImperativeHandle, useRef } from 'react';
2
+ import { findNodeHandle, requireNativeComponent, StyleSheet, UIManager } from 'react-native';
3
+ import { HMSVideoViewMode } from './HMSVideoViewMode';
4
+ const HmsView = requireNativeComponent('HmsView');
5
+ let _nextRequestId = 1;
6
+
7
+ let _requestMap = new Map();
8
+
9
+ export const HmsViewComponent = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const {
8
11
  trackId,
9
- style,
10
- id = null,
12
+ style = temporaryStyles.customStyle,
13
+ id = '12345',
11
14
  mirror = false,
12
15
  setZOrderMediaOverlay = false,
13
- scaleType = HMSVideoViewMode.ASPECT_FILL,
14
- screenshot = false
15
- } = _ref;
16
+ scaleType = HMSVideoViewMode.ASPECT_FILL
17
+ } = props;
18
+ const hmsViewRef = useRef();
16
19
  const [tempVal, setTempVal] = useState(0);
17
20
  const data = {
18
21
  trackId,
19
- sink,
20
22
  id,
21
23
  mirror
22
24
  };
@@ -28,18 +30,62 @@ export const HmsView = _ref => {
28
30
  }, 2000);
29
31
  };
30
32
 
33
+ const _onDataReturned = event => {
34
+ // We grab the relevant data out of our event.
35
+ let {
36
+ requestId,
37
+ result,
38
+ error
39
+ } = event.nativeEvent; // Then we get the promise we saved earlier for the given request ID.
40
+
41
+ let promise = _requestMap.get(requestId);
42
+
43
+ if (result) {
44
+ // If it was successful, we resolve the promise.
45
+ promise.resolve(result);
46
+ } else {
47
+ // Otherwise, we reject it.
48
+ promise.reject(error);
49
+ } // Finally, we clean up our request map.
50
+
51
+
52
+ _requestMap.delete(requestId);
53
+ };
54
+
55
+ const capture = async () => {
56
+ let requestId = _nextRequestId++;
57
+ let requestMap = _requestMap; // We create a promise here that will be resolved once `_onRequestDone` is
58
+ // called.
59
+
60
+ let promise = new Promise(function (resolve, reject) {
61
+ requestMap.set(requestId, {
62
+ resolve,
63
+ reject
64
+ });
65
+ });
66
+ const viewManagerConfig = UIManager.getViewManagerConfig('HmsView');
67
+ UIManager.dispatchViewManagerCommand(findNodeHandle(hmsViewRef.current), viewManagerConfig.Commands.capture, [requestId]);
68
+ return promise;
69
+ };
70
+
71
+ useImperativeHandle(ref, () => {
72
+ return {
73
+ capture
74
+ };
75
+ });
31
76
  useEffect(() => {
32
77
  setTempVal(0);
33
78
  }, [tempVal]);
34
- return /*#__PURE__*/React.createElement(HmsViewComponent, {
79
+ return /*#__PURE__*/React.createElement(HmsView, {
80
+ ref: hmsViewRef,
35
81
  onChange: onChange,
36
82
  data: data,
37
83
  style: tempVal === 0 ? style : temporaryStyles.customStyle,
38
84
  scaleType: scaleType,
39
85
  setZOrderMediaOverlay: setZOrderMediaOverlay,
40
- screenshot: screenshot
86
+ onDataReturned: _onDataReturned
41
87
  });
42
- };
88
+ });
43
89
  const temporaryStyles = StyleSheet.create({
44
90
  customStyle: {
45
91
  width: '100%',
@@ -1 +1 @@
1
- {"version":3,"sources":["HmsView.tsx"],"names":["React","useState","useEffect","requireNativeComponent","StyleSheet","HMSVideoViewMode","HmsViewComponent","HmsView","sink","trackId","style","id","mirror","setZOrderMediaOverlay","scaleType","ASPECT_FILL","screenshot","tempVal","setTempVal","data","onChange","values","console","log","setTimeout","temporaryStyles","customStyle","create","width","height"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,sBAAT,EAAiCC,UAAjC,QAA8D,cAA9D;AACA,SAASC,gBAAT,QAAiC,6BAAjC;AAgBA,MAAMC,gBAAgB,GAAGH,sBAAsB,CAAe,SAAf,CAA/C;AAaA,OAAO,MAAMI,OAAO,GAAG,QASE;AAAA,MATD;AACtBC,IAAAA,IADsB;AAEtBC,IAAAA,OAFsB;AAGtBC,IAAAA,KAHsB;AAItBC,IAAAA,EAAE,GAAG,IAJiB;AAKtBC,IAAAA,MAAM,GAAG,KALa;AAMtBC,IAAAA,qBAAqB,GAAG,KANF;AAOtBC,IAAAA,SAAS,GAAGT,gBAAgB,CAACU,WAPP;AAQtBC,IAAAA,UAAU,GAAG;AARS,GASC;AACvB,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBjB,QAAQ,CAAC,CAAD,CAAtC;AACA,QAAMkB,IAAI,GAAG;AACXV,IAAAA,OADW;AAEXD,IAAAA,IAFW;AAGXG,IAAAA,EAHW;AAIXC,IAAAA;AAJW,GAAb;;AAOA,QAAMQ,QAAQ,GAAIC,MAAD,IAAiB;AAChCC,IAAAA,OAAO,CAACC,GAAR,CAAYF,MAAZ,EAAoB,QAApB;AACAG,IAAAA,UAAU,CAAC,MAAM;AACfN,MAAAA,UAAU,CAAC,CAAD,CAAV;AACD,KAFS,EAEP,IAFO,CAAV;AAGD,GALD;;AAOAhB,EAAAA,SAAS,CAAC,MAAM;AACdgB,IAAAA,UAAU,CAAC,CAAD,CAAV;AACD,GAFQ,EAEN,CAACD,OAAD,CAFM,CAAT;AAIA,sBACE,oBAAC,gBAAD;AACE,IAAA,QAAQ,EAAEG,QADZ;AAEE,IAAA,IAAI,EAAED,IAFR;AAGE,IAAA,KAAK,EAAEF,OAAO,KAAK,CAAZ,GAAgBP,KAAhB,GAAwBe,eAAe,CAACC,WAHjD;AAIE,IAAA,SAAS,EAAEZ,SAJb;AAKE,IAAA,qBAAqB,EAAED,qBALzB;AAME,IAAA,UAAU,EAAEG;AANd,IADF;AAUD,CAvCM;AAyCP,MAAMS,eAAe,GAAGrB,UAAU,CAACuB,MAAX,CAAkB;AACxCD,EAAAA,WAAW,EAAE;AACXE,IAAAA,KAAK,EAAE,MADI;AAEXC,IAAAA,MAAM,EAAE;AAFG;AAD2B,CAAlB,CAAxB","sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { requireNativeComponent, StyleSheet, ViewStyle } from 'react-native';\nimport { HMSVideoViewMode } from '../classes/HMSVideoViewMode';\n\ninterface HmsViewProps {\n data: {\n trackId: string;\n sink: boolean;\n id?: string | null;\n mirror: boolean;\n };\n setZOrderMediaOverlay: boolean;\n scaleType: HMSVideoViewMode;\n screenshot: boolean;\n style: ViewStyle;\n onChange: Function;\n}\n\nconst HmsViewComponent = requireNativeComponent<HmsViewProps>('HmsView');\n\ninterface HmsComponentProps {\n trackId: string;\n sink: boolean;\n style: ViewStyle;\n mirror?: boolean;\n scaleType?: HMSVideoViewMode;\n setZOrderMediaOverlay?: boolean;\n screenshot?: boolean;\n id?: string | null;\n}\n\nexport const HmsView = ({\n sink,\n trackId,\n style,\n id = null,\n mirror = false,\n setZOrderMediaOverlay = false,\n scaleType = HMSVideoViewMode.ASPECT_FILL,\n screenshot = false,\n}: HmsComponentProps) => {\n const [tempVal, setTempVal] = useState(0);\n const data = {\n trackId,\n sink,\n id,\n mirror,\n };\n\n const onChange = (values: any) => {\n console.log(values, 'values');\n setTimeout(() => {\n setTempVal(1);\n }, 2000);\n };\n\n useEffect(() => {\n setTempVal(0);\n }, [tempVal]);\n\n return (\n <HmsViewComponent\n onChange={onChange}\n data={data}\n style={tempVal === 0 ? style : temporaryStyles.customStyle}\n scaleType={scaleType}\n setZOrderMediaOverlay={setZOrderMediaOverlay}\n screenshot={screenshot}\n />\n );\n};\n\nconst temporaryStyles = StyleSheet.create({\n customStyle: {\n width: '100%',\n height: '50%',\n },\n});\n"]}
1
+ {"version":3,"names":["React","useState","useEffect","useImperativeHandle","useRef","findNodeHandle","requireNativeComponent","StyleSheet","UIManager","HMSVideoViewMode","HmsView","_nextRequestId","_requestMap","Map","HmsViewComponent","forwardRef","props","ref","trackId","style","temporaryStyles","customStyle","id","mirror","setZOrderMediaOverlay","scaleType","ASPECT_FILL","hmsViewRef","tempVal","setTempVal","data","onChange","values","console","log","setTimeout","_onDataReturned","event","requestId","result","error","nativeEvent","promise","get","resolve","reject","delete","capture","requestMap","Promise","set","viewManagerConfig","getViewManagerConfig","dispatchViewManagerCommand","current","Commands","create","width","height"],"sources":["HmsView.tsx"],"sourcesContent":["import React, { useState, useEffect, useImperativeHandle, useRef } from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n StyleSheet,\n UIManager,\n ViewStyle,\n} from 'react-native';\nimport { HMSVideoViewMode } from './HMSVideoViewMode';\n\ninterface HmsViewProps {\n data: {\n trackId: string;\n id: string;\n mirror: boolean;\n };\n setZOrderMediaOverlay: boolean;\n scaleType: HMSVideoViewMode;\n style: ViewStyle;\n onChange: Function;\n onDataReturned: Function;\n}\n\nconst HmsView = requireNativeComponent<HmsViewProps>('HmsView');\nlet _nextRequestId = 1;\nlet _requestMap = new Map();\n\ninterface HmsComponentProps {\n trackId: string;\n style?: ViewStyle;\n mirror?: boolean;\n scaleType?: HMSVideoViewMode;\n setZOrderMediaOverlay?: boolean;\n id: string;\n}\n\nexport const HmsViewComponent = React.forwardRef<any, HmsComponentProps>(\n (props, ref) => {\n const {\n trackId,\n style = temporaryStyles.customStyle,\n id = '12345',\n mirror = false,\n setZOrderMediaOverlay = false,\n scaleType = HMSVideoViewMode.ASPECT_FILL,\n } = props;\n\n const hmsViewRef: any = useRef();\n const [tempVal, setTempVal] = useState(0);\n const data = {\n trackId,\n id,\n mirror,\n };\n\n const onChange = (values: any) => {\n console.log(values, 'values');\n setTimeout(() => {\n setTempVal(1);\n }, 2000);\n };\n\n const _onDataReturned = (event: {\n nativeEvent: { requestId: any; result: any; error: any };\n }) => {\n // We grab the relevant data out of our event.\n let { requestId, result, error } = event.nativeEvent;\n // Then we get the promise we saved earlier for the given request ID.\n let promise = _requestMap.get(requestId);\n if (result) {\n // If it was successful, we resolve the promise.\n promise.resolve(result);\n } else {\n // Otherwise, we reject it.\n promise.reject(error);\n }\n // Finally, we clean up our request map.\n _requestMap.delete(requestId);\n };\n\n const capture = async () => {\n let requestId = _nextRequestId++;\n let requestMap = _requestMap;\n\n // We create a promise here that will be resolved once `_onRequestDone` is\n // called.\n let promise = new Promise(function (resolve, reject) {\n requestMap.set(requestId, { resolve, reject });\n });\n const viewManagerConfig = UIManager.getViewManagerConfig('HmsView');\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(hmsViewRef.current),\n viewManagerConfig.Commands.capture,\n [requestId]\n );\n return promise;\n };\n\n useImperativeHandle(ref, () => {\n return {\n capture,\n };\n });\n\n useEffect(() => {\n setTempVal(0);\n }, [tempVal]);\n\n return (\n <HmsView\n ref={hmsViewRef}\n onChange={onChange}\n data={data}\n style={tempVal === 0 ? style : temporaryStyles.customStyle}\n scaleType={scaleType}\n setZOrderMediaOverlay={setZOrderMediaOverlay}\n onDataReturned={_onDataReturned}\n />\n );\n }\n);\n\nconst temporaryStyles = StyleSheet.create({\n customStyle: {\n width: '100%',\n height: '50%',\n },\n});\n"],"mappings":"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"}
@@ -1,7 +1,6 @@
1
1
  export * from './classes/HMSConfig';
2
2
  export * from './classes/HMSUpdateListenerActions';
3
3
  export * from './classes/HMSMessage';
4
- export * from './classes/HmsView';
5
4
  export * from './classes/HMSVideoTrackSettings';
6
5
  export * from './classes/HMSVideoTrack';
7
6
  export * from './classes/HMSVideoSettings';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["HMSSDK","HmsManager"],"mappings":"AAAA,cAAc,qBAAd;AACA,cAAc,oCAAd;AACA,cAAc,sBAAd;AACA,cAAc,mBAAd;AACA,cAAc,iCAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd;AACA,cAAc,oBAAd;AACA,cAAc,wBAAd;AACA,cAAc,gCAAd;AACA,cAAc,gCAAd;AACA,cAAc,qCAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,gCAAd;AACA,cAAc,mBAAd;AACA,cAAc,+BAAd;AACA,cAAc,yBAAd;AACA,cAAc,+BAAd;AACA,cAAc,8BAAd;AACA,cAAc,0BAAd;AACA,cAAc,mBAAd;AACA,cAAc,8BAAd;AACA,cAAc,wBAAd;AACA,cAAc,8BAAd;AACA,cAAc,qBAAd;AACA,cAAc,sBAAd;AACA,cAAc,iCAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd;AACA,cAAc,yBAAd;AACA,cAAc,yBAAd;AACA,cAAc,yBAAd;AACA,cAAc,0BAAd;AACA,cAAc,qBAAd;AACA,cAAc,uBAAd;AACA,cAAc,4BAAd;AACA,cAAc,sCAAd;AACA,cAAc,sBAAd;AACA,cAAc,4BAAd;AACA,cAAc,2BAAd;AACA,cAAc,wBAAd;AACA,cAAc,iCAAd;AACA,cAAc,mCAAd;AACA,cAAc,oCAAd;AACA,cAAc,yBAAd;AACA,cAAc,wBAAd;AACA,cAAc,mCAAd;AACA,cAAc,yBAAd;AACA,cAAc,gCAAd;AACA,cAAc,8BAAd;AACA,cAAc,8BAAd;AACA,cAAc,8BAAd;AACA,cAAc,uBAAd;AACA,cAAc,6BAAd;AACA,cAAc,+BAAd;AACA,cAAc,+BAAd;AACA,cAAc,iCAAd;AACA,cAAc,gCAAd;AACA,cAAc,+BAAd;AACA,cAAc,mCAAd;AACA,cAAc,6BAAd;AAEA,SAASA,MAAM,IAAIC,UAAnB,QAAqC,kBAArC;AACA,eAAeA,UAAf","sourcesContent":["export * from './classes/HMSConfig';\nexport * from './classes/HMSUpdateListenerActions';\nexport * from './classes/HMSMessage';\nexport * from './classes/HmsView';\nexport * from './classes/HMSVideoTrackSettings';\nexport * from './classes/HMSVideoTrack';\nexport * from './classes/HMSVideoSettings';\nexport * from './classes/HMSVideoCodec';\nexport * from './classes/HMSTrackSettings';\nexport * from './classes/HMSTrack';\nexport * from './classes/HMSTrackType';\nexport * from './classes/HMSSubscribeSettings';\nexport * from './classes/HMSSimulcastSettings';\nexport * from './classes/HMSSimulcastLayerSettings';\nexport * from './classes/HMSSDK';\nexport * from './classes/HMSRoom';\nexport * from './classes/HMSRoleChangeRequest';\nexport * from './classes/HMSRole';\nexport * from './classes/HMSRemoteVideoTrack';\nexport * from './classes/HMSRemotePeer';\nexport * from './classes/HMSRemoteAudioTrack';\nexport * from './classes/HMSPublishSettings';\nexport * from './classes/HMSPermissions';\nexport * from './classes/HMSPeer';\nexport * from './classes/HMSLocalVideoTrack';\nexport * from './classes/HMSLocalPeer';\nexport * from './classes/HMSLocalAudioTrack';\nexport * from './classes/HMSHelper';\nexport * from './classes/HMSEncoder';\nexport * from './classes/HMSAudioTrackSettings';\nexport * from './classes/HMSAudioTrack';\nexport * from './classes/HMSAudioSettings';\nexport * from './classes/HMSAudioCodec';\nexport * from './classes/HMSPeerUpdate';\nexport * from './classes/HMSRoomUpdate';\nexport * from './classes/HMSTrackUpdate';\nexport * from './classes/HMSLogger';\nexport * from './classes/HMSLogLevel';\nexport * from './classes/HMSVideoViewMode';\nexport * from './classes/HMSChangeTrackStateRequest';\nexport * from './classes/HMSSpeaker';\nexport * from './classes/HMSSpeakerUpdate';\nexport * from './classes/HMSCameraFacing';\nexport * from './classes/HMSException';\nexport * from './classes/HMSRtmpStreamingState';\nexport * from './classes/HMSServerRecordingState';\nexport * from './classes/HMSBrowserRecordingState';\nexport * from './classes/HMSRTMPConfig';\nexport * from './classes/HMSHLSConfig';\nexport * from './classes/HMSHLSMeetingURLVariant';\nexport * from './classes/HMSHLSVariant';\nexport * from './classes/HMSHLSStreamingState';\nexport * from './classes/HMSVideoResolution';\nexport * from './classes/HMSLocalAudioStats';\nexport * from './classes/HMSLocalVideoStats';\nexport * from './classes/HMSRTCStats';\nexport * from './classes/HMSRTCStatsReport';\nexport * from './classes/HMSRemoteAudioStats';\nexport * from './classes/HMSRemoteVideoStats';\nexport * from './classes/HMSHLSRecordingConfig';\nexport * from './classes/HMSHLSRecordingState';\nexport * from './classes/HMSMessageRecipient';\nexport * from './classes/HMSMessageRecipientType';\nexport * from './classes/HMSNetworkQuality';\n\nimport { HMSSDK as HmsManager } from './classes/HMSSDK';\nexport default HmsManager;\n"]}
1
+ {"version":3,"names":["HMSSDK","HmsManager"],"sources":["index.ts"],"sourcesContent":["export * from './classes/HMSConfig';\nexport * from './classes/HMSUpdateListenerActions';\nexport * from './classes/HMSMessage';\nexport * from './classes/HMSVideoTrackSettings';\nexport * from './classes/HMSVideoTrack';\nexport * from './classes/HMSVideoSettings';\nexport * from './classes/HMSVideoCodec';\nexport * from './classes/HMSTrackSettings';\nexport * from './classes/HMSTrack';\nexport * from './classes/HMSTrackType';\nexport * from './classes/HMSSubscribeSettings';\nexport * from './classes/HMSSimulcastSettings';\nexport * from './classes/HMSSimulcastLayerSettings';\nexport * from './classes/HMSSDK';\nexport * from './classes/HMSRoom';\nexport * from './classes/HMSRoleChangeRequest';\nexport * from './classes/HMSRole';\nexport * from './classes/HMSRemoteVideoTrack';\nexport * from './classes/HMSRemotePeer';\nexport * from './classes/HMSRemoteAudioTrack';\nexport * from './classes/HMSPublishSettings';\nexport * from './classes/HMSPermissions';\nexport * from './classes/HMSPeer';\nexport * from './classes/HMSLocalVideoTrack';\nexport * from './classes/HMSLocalPeer';\nexport * from './classes/HMSLocalAudioTrack';\nexport * from './classes/HMSHelper';\nexport * from './classes/HMSEncoder';\nexport * from './classes/HMSAudioTrackSettings';\nexport * from './classes/HMSAudioTrack';\nexport * from './classes/HMSAudioSettings';\nexport * from './classes/HMSAudioCodec';\nexport * from './classes/HMSPeerUpdate';\nexport * from './classes/HMSRoomUpdate';\nexport * from './classes/HMSTrackUpdate';\nexport * from './classes/HMSLogger';\nexport * from './classes/HMSLogLevel';\nexport * from './classes/HMSVideoViewMode';\nexport * from './classes/HMSChangeTrackStateRequest';\nexport * from './classes/HMSSpeaker';\nexport * from './classes/HMSSpeakerUpdate';\nexport * from './classes/HMSCameraFacing';\nexport * from './classes/HMSException';\nexport * from './classes/HMSRtmpStreamingState';\nexport * from './classes/HMSServerRecordingState';\nexport * from './classes/HMSBrowserRecordingState';\nexport * from './classes/HMSRTMPConfig';\nexport * from './classes/HMSHLSConfig';\nexport * from './classes/HMSHLSMeetingURLVariant';\nexport * from './classes/HMSHLSVariant';\nexport * from './classes/HMSHLSStreamingState';\nexport * from './classes/HMSVideoResolution';\nexport * from './classes/HMSLocalAudioStats';\nexport * from './classes/HMSLocalVideoStats';\nexport * from './classes/HMSRTCStats';\nexport * from './classes/HMSRTCStatsReport';\nexport * from './classes/HMSRemoteAudioStats';\nexport * from './classes/HMSRemoteVideoStats';\nexport * from './classes/HMSHLSRecordingConfig';\nexport * from './classes/HMSHLSRecordingState';\nexport * from './classes/HMSMessageRecipient';\nexport * from './classes/HMSMessageRecipientType';\nexport * from './classes/HMSNetworkQuality';\n\nimport { HMSSDK as HmsManager } from './classes/HMSSDK';\nexport default HmsManager;\n"],"mappings":"AAAA,cAAc,qBAAd;AACA,cAAc,oCAAd;AACA,cAAc,sBAAd;AACA,cAAc,iCAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd;AACA,cAAc,oBAAd;AACA,cAAc,wBAAd;AACA,cAAc,gCAAd;AACA,cAAc,gCAAd;AACA,cAAc,qCAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,gCAAd;AACA,cAAc,mBAAd;AACA,cAAc,+BAAd;AACA,cAAc,yBAAd;AACA,cAAc,+BAAd;AACA,cAAc,8BAAd;AACA,cAAc,0BAAd;AACA,cAAc,mBAAd;AACA,cAAc,8BAAd;AACA,cAAc,wBAAd;AACA,cAAc,8BAAd;AACA,cAAc,qBAAd;AACA,cAAc,sBAAd;AACA,cAAc,iCAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd;AACA,cAAc,yBAAd;AACA,cAAc,yBAAd;AACA,cAAc,yBAAd;AACA,cAAc,0BAAd;AACA,cAAc,qBAAd;AACA,cAAc,uBAAd;AACA,cAAc,4BAAd;AACA,cAAc,sCAAd;AACA,cAAc,sBAAd;AACA,cAAc,4BAAd;AACA,cAAc,2BAAd;AACA,cAAc,wBAAd;AACA,cAAc,iCAAd;AACA,cAAc,mCAAd;AACA,cAAc,oCAAd;AACA,cAAc,yBAAd;AACA,cAAc,wBAAd;AACA,cAAc,mCAAd;AACA,cAAc,yBAAd;AACA,cAAc,gCAAd;AACA,cAAc,8BAAd;AACA,cAAc,8BAAd;AACA,cAAc,8BAAd;AACA,cAAc,uBAAd;AACA,cAAc,6BAAd;AACA,cAAc,+BAAd;AACA,cAAc,+BAAd;AACA,cAAc,iCAAd;AACA,cAAc,gCAAd;AACA,cAAc,+BAAd;AACA,cAAc,mCAAd;AACA,cAAc,6BAAd;AAEA,SAASA,MAAM,IAAIC,UAAnB,QAAqC,kBAArC;AACA,eAAeA,UAAf"}
@@ -19,9 +19,13 @@ import { HMSRemoteAudioTrack } from './HMSRemoteAudioTrack';
19
19
  import { HMSRemoteVideoTrack } from './HMSRemoteVideoTrack';
20
20
  import { HMSSpeaker } from './HMSSpeaker';
21
21
  import { HMSSpeakerUpdate } from './HMSSpeakerUpdate';
22
- import { HMSBrowserRecordingState, HMSHLSStreamingState, HMSHLSVariant, HMSRtmpStreamingState, HMSServerRecordingState } from '..';
23
22
  import { HMSHLSRecordingState } from './HMSHLSRecordingState';
24
23
  import { HMSNetworkQuality } from './HMSNetworkQuality';
24
+ import { HMSBrowserRecordingState } from './HMSBrowserRecordingState';
25
+ import { HMSHLSStreamingState } from './HMSHLSStreamingState';
26
+ import { HMSHLSVariant } from './HMSHLSVariant';
27
+ import { HMSRtmpStreamingState } from './HMSRtmpStreamingState';
28
+ import { HMSServerRecordingState } from './HMSServerRecordingState';
25
29
  export declare class HMSEncoder {
26
30
  static encodeHmsRoom(room: HMSRoom, id: string): HMSRoom;
27
31
  static encodeHmsPeers(peers: any, id: string): HMSPeer[];
@@ -1,4 +1,7 @@
1
1
  import { HMSLogLevel } from './HMSLogLevel';
2
+ export declare let logger: HMSLogger | undefined;
3
+ export declare const getLogger: () => HMSLogger | undefined;
4
+ export declare const setLogger: (hmsLogger: HMSLogger, id: string) => void;
2
5
  export declare class HMSLogger {
3
6
  private _verbose;
4
7
  private _warning;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ViewStyle } from 'react-native';
3
3
  import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
4
4
  import type { HMSConfig } from './HMSConfig';
@@ -14,14 +14,11 @@ import type { HMSVideoViewMode } from './HMSVideoViewMode';
14
14
  import type { HMSTrackSettings } from './HMSTrackSettings';
15
15
  import type { HMSRTMPConfig } from './HMSRTMPConfig';
16
16
  import type { HMSHLSConfig } from './HMSHLSConfig';
17
- interface HmsComponentProps {
17
+ interface HmsViewProps {
18
18
  trackId: string;
19
- sink: boolean;
20
- style: ViewStyle;
19
+ style?: ViewStyle;
21
20
  mirror?: boolean;
22
21
  scaleType?: HMSVideoViewMode;
23
- screenshot?: boolean;
24
- id?: string | null;
25
22
  setZOrderMediaOverlay?: boolean;
26
23
  }
27
24
  export declare class HMSSDK {
@@ -134,7 +131,6 @@ export declare class HMSSDK {
134
131
  /**
135
132
  * - HmsView is react component that takes one track and starts showing that track on a tile.
136
133
  * - The appearance of tile is completely customizable with style prop.
137
- * - setting sink true or false for a video tile will add or remove sink for a video.
138
134
  * - scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
139
135
  *
140
136
  * checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
@@ -142,7 +138,7 @@ export declare class HMSSDK {
142
138
  * @param {HmsComponentProps}
143
139
  * @memberof HMSSDK
144
140
  */
145
- HmsView: ({ sink, trackId, style, mirror, scaleType, screenshot, setZOrderMediaOverlay, }: HmsComponentProps) => JSX.Element;
141
+ HmsView: React.ForwardRefExoticComponent<HmsViewProps & React.RefAttributes<any>>;
146
142
  /**
147
143
  * Calls leave function of native sdk and session of current user is invalidated.
148
144
  *
@@ -1,15 +1,13 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ViewStyle } from 'react-native';
3
- import { HMSVideoViewMode } from '../classes/HMSVideoViewMode';
3
+ import { HMSVideoViewMode } from './HMSVideoViewMode';
4
4
  interface HmsComponentProps {
5
5
  trackId: string;
6
- sink: boolean;
7
- style: ViewStyle;
6
+ style?: ViewStyle;
8
7
  mirror?: boolean;
9
8
  scaleType?: HMSVideoViewMode;
10
9
  setZOrderMediaOverlay?: boolean;
11
- screenshot?: boolean;
12
- id?: string | null;
10
+ id: string;
13
11
  }
14
- export declare const HmsView: ({ sink, trackId, style, id, mirror, setZOrderMediaOverlay, scaleType, screenshot, }: HmsComponentProps) => JSX.Element;
12
+ export declare const HmsViewComponent: React.ForwardRefExoticComponent<HmsComponentProps & React.RefAttributes<any>>;
15
13
  export {};
@@ -1,7 +1,6 @@
1
1
  export * from './classes/HMSConfig';
2
2
  export * from './classes/HMSUpdateListenerActions';
3
3
  export * from './classes/HMSMessage';
4
- export * from './classes/HmsView';
5
4
  export * from './classes/HMSVideoTrackSettings';
6
5
  export * from './classes/HMSVideoTrack';
7
6
  export * from './classes/HMSVideoSettings';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@100mslive/react-native-hms",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "The React Native package for 100ms SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -95,7 +95,7 @@
95
95
  "prettier": "^2.0.5",
96
96
  "react-native-builder-bob": "^0.18.0",
97
97
  "release-it": "^14.2.2",
98
- "typescript": "^4.1.3"
98
+ "typescript": "^4.6.3"
99
99
  },
100
100
  "peerDependencies": {
101
101
  "react": "*",
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "HMSSDK", "0.2.9"
19
+ s.dependency "HMSSDK", "0.2.11"
20
20
  end
@@ -3,10 +3,8 @@ import { HMSAudioTrack } from './HMSAudioTrack';
3
3
  import { HMSVideoTrack } from './HMSVideoTrack';
4
4
  import { HMSRoom } from './HMSRoom';
5
5
  import { HMSPeer } from './HMSPeer';
6
-
7
6
  import { HMSLocalPeer } from './HMSLocalPeer';
8
7
  import { HMSRemotePeer } from './HMSRemotePeer';
9
-
10
8
  import { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
11
9
  import { HMSVideoTrackSettings } from './HMSVideoTrackSettings';
12
10
  import { HMSLocalVideoTrack } from './HMSLocalVideoTrack';
@@ -21,15 +19,13 @@ import { HMSRemoteAudioTrack } from './HMSRemoteAudioTrack';
21
19
  import { HMSRemoteVideoTrack } from './HMSRemoteVideoTrack';
22
20
  import { HMSSpeaker } from './HMSSpeaker';
23
21
  import { HMSSpeakerUpdate } from './HMSSpeakerUpdate';
24
- import {
25
- HMSBrowserRecordingState,
26
- HMSHLSStreamingState,
27
- HMSHLSVariant,
28
- HMSRtmpStreamingState,
29
- HMSServerRecordingState,
30
- } from '..';
31
22
  import { HMSHLSRecordingState } from './HMSHLSRecordingState';
32
23
  import { HMSNetworkQuality } from './HMSNetworkQuality';
24
+ import { HMSBrowserRecordingState } from './HMSBrowserRecordingState';
25
+ import { HMSHLSStreamingState } from './HMSHLSStreamingState';
26
+ import { HMSHLSVariant } from './HMSHLSVariant';
27
+ import { HMSRtmpStreamingState } from './HMSRtmpStreamingState';
28
+ import { HMSServerRecordingState } from './HMSServerRecordingState';
33
29
 
34
30
  export class HMSEncoder {
35
31
  static encodeHmsRoom(room: HMSRoom, id: string) {
@@ -1,6 +1,6 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
2
  import { HMSAudioTrack } from './HMSAudioTrack';
3
- import { HMSSDK } from './HMSSDK';
3
+ import { getLogger } from './HMSLogger';
4
4
  import type { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
5
5
  import type { HMSTrackType } from './HMSTrackType';
6
6
 
@@ -22,7 +22,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
22
22
  * @memberof HMSLocalAudioTrack
23
23
  */
24
24
  setMute(isMute: boolean) {
25
- const logger = HMSSDK.getLogger();
25
+ const logger = getLogger();
26
26
  logger?.verbose('#Function setMute', {
27
27
  trackId: this.trackId,
28
28
  id: this.id,
@@ -34,7 +34,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
34
34
  }
35
35
 
36
36
  getVolume = async () => {
37
- const logger = HMSSDK.getLogger();
37
+ const logger = getLogger();
38
38
  logger?.verbose('#Function getVolume', {
39
39
  trackId: this.trackId,
40
40
  id: this.id,
@@ -1,6 +1,6 @@
1
1
  import { NativeModules } from 'react-native';
2
2
  import { HMSVideoTrack } from './HMSVideoTrack';
3
- import { HMSSDK } from './HMSSDK';
3
+ import { getLogger } from './HMSLogger';
4
4
  import type { HMSVideoTrackSettings } from './HMSVideoTrackSettings';
5
5
  import type { HMSTrackType } from './HMSTrackType';
6
6
 
@@ -23,7 +23,7 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
23
23
  * @memberof HMSSDK
24
24
  */
25
25
  switchCamera = () => {
26
- const logger = HMSSDK.getLogger();
26
+ const logger = getLogger();
27
27
  logger?.verbose('#Function switchCamera', {
28
28
  trackId: this.trackId,
29
29
  source: this.source,
@@ -40,7 +40,7 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
40
40
  * @memberof HMSLocalVideoTrack
41
41
  */
42
42
  setMute(isMute: boolean) {
43
- const logger = HMSSDK.getLogger();
43
+ const logger = getLogger();
44
44
  logger?.verbose('#Function setMute', {
45
45
  trackId: this.trackId,
46
46
  source: this.source,
@@ -1,5 +1,16 @@
1
1
  import { HMSLogLevel } from './HMSLogLevel';
2
2
 
3
+ export let logger: HMSLogger | undefined;
4
+
5
+ export const getLogger = () => {
6
+ return logger;
7
+ };
8
+
9
+ export const setLogger = (hmsLogger: HMSLogger, id: string) => {
10
+ logger = hmsLogger;
11
+ hmsLogger.verbose('#Function setLogger', { id });
12
+ };
13
+
3
14
  export class HMSLogger {
4
15
  private _verbose: boolean = false;
5
16
  private _warning: boolean = false;
@@ -18,7 +18,7 @@ export class HMSMessage {
18
18
  }) {
19
19
  this.message = params.message;
20
20
  this.type = params.type;
21
- this.time = new Date(params.time);
21
+ this.time = new Date(parseInt(params.time));
22
22
  this.sender = params.sender;
23
23
  this.recipient = params.recipient;
24
24
  }
@@ -1,5 +1,5 @@
1
1
  import { NativeModules } from 'react-native';
2
- import { HMSSDK } from './HMSSDK';
2
+ import { getLogger } from './HMSLogger';
3
3
  import type { HMSTrackType } from './HMSTrackType';
4
4
  import { HMSAudioTrack } from './HMSAudioTrack';
5
5
 
@@ -18,7 +18,7 @@ export class HMSRemoteAudioTrack extends HMSAudioTrack {
18
18
  * @memberof HMSRemoteAudioTrack
19
19
  */
20
20
  setPlaybackAllowed(playbackAllowed: boolean) {
21
- const logger = HMSSDK.getLogger();
21
+ const logger = getLogger();
22
22
  logger?.verbose('#Function setPlaybackAllowed', {
23
23
  trackId: this.trackId,
24
24
  id: this.id,
@@ -35,7 +35,7 @@ export class HMSRemoteAudioTrack extends HMSAudioTrack {
35
35
 
36
36
  isPlaybackAllowed = async () => {
37
37
  try {
38
- const logger = HMSSDK.getLogger();
38
+ const logger = getLogger();
39
39
  logger?.verbose('#Function isPlaybackAllowed', {
40
40
  trackId: this.trackId,
41
41
  id: this.id,
@@ -1,5 +1,5 @@
1
1
  import { NativeModules } from 'react-native';
2
- import { HMSSDK } from './HMSSDK';
2
+ import { getLogger } from './HMSLogger';
3
3
  import { HMSVideoTrack } from './HMSVideoTrack';
4
4
  import type { HMSTrackType } from './HMSTrackType';
5
5
 
@@ -20,7 +20,7 @@ export class HMSRemoteVideoTrack extends HMSVideoTrack {
20
20
  * @memberof HMSRemoteVideoTrack
21
21
  */
22
22
  setPlaybackAllowed(playbackAllowed: boolean) {
23
- const logger = HMSSDK.getLogger();
23
+ const logger = getLogger();
24
24
  logger?.verbose('#Function setPlaybackAllowed', {
25
25
  trackId: this.trackId,
26
26
  id: this.id,
@@ -37,7 +37,7 @@ export class HMSRemoteVideoTrack extends HMSVideoTrack {
37
37
 
38
38
  isPlaybackAllowed = async () => {
39
39
  try {
40
- const logger = HMSSDK.getLogger();
40
+ const logger = getLogger();
41
41
  logger?.verbose('#Function isPlaybackAllowed', {
42
42
  trackId: this.trackId,
43
43
  id: this.id,
@@ -7,36 +7,34 @@ import {
7
7
  AppState,
8
8
  } from 'react-native';
9
9
  import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
10
+ import { HMSEncoder } from './HMSEncoder';
11
+ import { HMSMessage } from './HMSMessage';
12
+ import { HMSHelper } from './HMSHelper';
13
+ import { HmsViewComponent } from './HmsView';
14
+ import { HMSLocalAudioStats } from './HMSLocalAudioStats';
15
+ import { HMSLocalVideoStats } from './HMSLocalVideoStats';
16
+ import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
17
+ import { HMSRemoteAudioStats } from './HMSRemoteAudioStats';
18
+ import { logger, getLogger, setLogger } from './HMSLogger';
10
19
  import type { HMSConfig } from './HMSConfig';
11
20
  import type { HMSLocalPeer } from './HMSLocalPeer';
12
21
  import type { HMSRemotePeer } from './HMSRemotePeer';
13
22
  import type { HMSRoom } from './HMSRoom';
14
23
  import type { HMSRole } from './HMSRole';
15
- import { HMSEncoder } from './HMSEncoder';
16
- import { HMSMessage } from './HMSMessage';
17
- import { HMSHelper } from './HMSHelper';
18
24
  import type { HMSTrack } from './HMSTrack';
19
25
  import type { HMSTrackType } from './HMSTrackType';
20
26
  import type { HMSLogger } from './HMSLogger';
21
27
  import type { HMSPeer } from './HMSPeer';
22
- import { HmsView as HMSViewComponent } from './HmsView';
23
28
  import type { HMSVideoViewMode } from './HMSVideoViewMode';
24
29
  import type { HMSTrackSettings } from './HMSTrackSettings';
25
30
  import type { HMSRTMPConfig } from './HMSRTMPConfig';
26
31
  import type { HMSHLSConfig } from './HMSHLSConfig';
27
- import { HMSLocalAudioStats } from './HMSLocalAudioStats';
28
- import { HMSLocalVideoStats } from './HMSLocalVideoStats';
29
- import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
30
- import { HMSRemoteAudioStats } from './HMSRemoteAudioStats';
31
32
 
32
- interface HmsComponentProps {
33
+ interface HmsViewProps {
33
34
  trackId: string;
34
- sink: boolean;
35
- style: ViewStyle;
35
+ style?: ViewStyle;
36
36
  mirror?: boolean;
37
37
  scaleType?: HMSVideoViewMode;
38
- screenshot?: boolean;
39
- id?: string | null;
40
38
  setZOrderMediaOverlay?: boolean;
41
39
  }
42
40
 
@@ -51,8 +49,6 @@ const HmsEventEmitter = new NativeEventEmitter(HmsManager);
51
49
 
52
50
  let HmsSdk: HMSSDK | undefined;
53
51
 
54
- let logger: HMSLogger | undefined;
55
-
56
52
  export class HMSSDK {
57
53
  room?: HMSRoom;
58
54
  localPeer?: HMSLocalPeer;
@@ -107,7 +103,7 @@ export class HMSSDK {
107
103
  * @memberof HMSSDK
108
104
  */
109
105
  static getLogger() {
110
- return logger;
106
+ return getLogger();
111
107
  }
112
108
 
113
109
  /**
@@ -116,8 +112,7 @@ export class HMSSDK {
116
112
  * @memberof HMSSDK
117
113
  */
118
114
  setLogger = (hmsLogger: HMSLogger) => {
119
- logger = hmsLogger;
120
- hmsLogger.verbose('#Function setLogger', { id: this.id });
115
+ setLogger(hmsLogger, this.id);
121
116
  };
122
117
 
123
118
  /**
@@ -382,7 +377,6 @@ export class HMSSDK {
382
377
  /**
383
378
  * - HmsView is react component that takes one track and starts showing that track on a tile.
384
379
  * - The appearance of tile is completely customizable with style prop.
385
- * - setting sink true or false for a video tile will add or remove sink for a video.
386
380
  * - scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
387
381
  *
388
382
  * checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
@@ -390,28 +384,20 @@ export class HMSSDK {
390
384
  * @param {HmsComponentProps}
391
385
  * @memberof HMSSDK
392
386
  */
393
- HmsView = ({
394
- sink,
395
- trackId,
396
- style,
397
- mirror,
398
- scaleType,
399
- screenshot,
400
- setZOrderMediaOverlay,
401
- }: HmsComponentProps) => {
387
+ HmsView = React.forwardRef<any, HmsViewProps>((props, ref) => {
388
+ const { trackId, style, mirror, scaleType, setZOrderMediaOverlay } = props;
402
389
  return (
403
- <HMSViewComponent
404
- sink={sink}
390
+ <HmsViewComponent
391
+ ref={ref}
405
392
  trackId={trackId}
406
393
  style={style}
407
394
  setZOrderMediaOverlay={setZOrderMediaOverlay}
408
395
  mirror={mirror}
409
396
  scaleType={scaleType}
410
397
  id={this.id}
411
- screenshot={screenshot}
412
398
  />
413
399
  );
414
- };
400
+ });
415
401
 
416
402
  /**
417
403
  * Calls leave function of native sdk and session of current user is invalidated.