@100mslive/react-native-hms 1.9.9 → 1.9.10

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 (205) hide show
  1. package/android/local.properties +8 -1
  2. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +2 -0
  3. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +61 -2
  4. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +10 -3
  5. package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSInteractivityDecoder.kt +328 -0
  6. package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSInteractivityHelper.kt +352 -0
  7. package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSRNInteractivityCenter.kt +184 -0
  8. package/ios/HMSConstants.swift +1 -0
  9. package/ios/HMSDecoder.swift +3 -1
  10. package/ios/HMSInteractivityDecoder.swift +223 -0
  11. package/ios/HMSInteractivityHelper.swift +169 -0
  12. package/ios/HMSManager.m +17 -0
  13. package/ios/HMSManager.swift +30 -1
  14. package/ios/HMSRNInteractivityCenter.swift +89 -0
  15. package/ios/HMSRNSDK.swift +10 -4
  16. package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  17. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  18. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  19. package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  20. package/lib/commonjs/classes/HMSInteractivityCenter.js +93 -0
  21. package/lib/commonjs/classes/HMSInteractivityCenter.js.map +1 -0
  22. package/lib/commonjs/classes/HMSInteractivityEncoder.js +33 -0
  23. package/lib/commonjs/classes/HMSInteractivityEncoder.js.map +1 -0
  24. package/lib/commonjs/classes/HMSPermissions.js +4 -0
  25. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  26. package/lib/commonjs/classes/HMSPollsListenerActions.js +11 -0
  27. package/lib/commonjs/classes/HMSPollsListenerActions.js.map +1 -0
  28. package/lib/commonjs/classes/HMSSDK.js +8 -0
  29. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  30. package/lib/commonjs/classes/polls/HMSPoll.js +6 -0
  31. package/lib/commonjs/classes/polls/HMSPoll.js.map +1 -0
  32. package/lib/commonjs/classes/polls/HMSPollCategory.js +12 -0
  33. package/lib/commonjs/classes/polls/HMSPollCategory.js.map +1 -0
  34. package/lib/commonjs/classes/polls/HMSPollCreateParams.js +6 -0
  35. package/lib/commonjs/classes/polls/HMSPollCreateParams.js.map +1 -0
  36. package/lib/commonjs/classes/polls/HMSPollQuestion.js +6 -0
  37. package/lib/commonjs/classes/polls/HMSPollQuestion.js.map +1 -0
  38. package/lib/commonjs/classes/polls/HMSPollQuestionAnswer.js +2 -0
  39. package/lib/commonjs/classes/polls/HMSPollQuestionAnswer.js.map +1 -0
  40. package/lib/commonjs/classes/polls/HMSPollQuestionCreateParams.js +6 -0
  41. package/lib/commonjs/classes/polls/HMSPollQuestionCreateParams.js.map +1 -0
  42. package/lib/commonjs/classes/polls/HMSPollQuestionOption.js +2 -0
  43. package/lib/commonjs/classes/polls/HMSPollQuestionOption.js.map +1 -0
  44. package/lib/commonjs/classes/polls/HMSPollQuestionOptionCreateParams.js +6 -0
  45. package/lib/commonjs/classes/polls/HMSPollQuestionOptionCreateParams.js.map +1 -0
  46. package/lib/commonjs/classes/polls/HMSPollQuestionQuizOptionCreateParams.js +6 -0
  47. package/lib/commonjs/classes/polls/HMSPollQuestionQuizOptionCreateParams.js.map +1 -0
  48. package/lib/commonjs/classes/polls/HMSPollQuestionResponse.js +6 -0
  49. package/lib/commonjs/classes/polls/HMSPollQuestionResponse.js.map +1 -0
  50. package/lib/commonjs/classes/polls/HMSPollQuestionResponseCreateParams.js +6 -0
  51. package/lib/commonjs/classes/polls/HMSPollQuestionResponseCreateParams.js.map +1 -0
  52. package/lib/commonjs/classes/polls/HMSPollQuestionResponseResult.js +2 -0
  53. package/lib/commonjs/classes/polls/HMSPollQuestionResponseResult.js.map +1 -0
  54. package/lib/commonjs/classes/polls/HMSPollQuestionResult.js +2 -0
  55. package/lib/commonjs/classes/polls/HMSPollQuestionResult.js.map +1 -0
  56. package/lib/commonjs/classes/polls/HMSPollQuestionType.js +14 -0
  57. package/lib/commonjs/classes/polls/HMSPollQuestionType.js.map +1 -0
  58. package/lib/commonjs/classes/polls/HMSPollResponsePeerInfo.js +2 -0
  59. package/lib/commonjs/classes/polls/HMSPollResponsePeerInfo.js.map +1 -0
  60. package/lib/commonjs/classes/polls/HMSPollResult.js +6 -0
  61. package/lib/commonjs/classes/polls/HMSPollResult.js.map +1 -0
  62. package/lib/commonjs/classes/polls/HMSPollState.js +13 -0
  63. package/lib/commonjs/classes/polls/HMSPollState.js.map +1 -0
  64. package/lib/commonjs/classes/polls/HMSPollType.js +12 -0
  65. package/lib/commonjs/classes/polls/HMSPollType.js.map +1 -0
  66. package/lib/commonjs/classes/polls/HMSPollUpdateType.js +13 -0
  67. package/lib/commonjs/classes/polls/HMSPollUpdateType.js.map +1 -0
  68. package/lib/commonjs/classes/polls/HMSPollUserTrackingMode.js +13 -0
  69. package/lib/commonjs/classes/polls/HMSPollUserTrackingMode.js.map +1 -0
  70. package/lib/commonjs/hooks/polls.js +17 -0
  71. package/lib/commonjs/hooks/polls.js.map +1 -0
  72. package/lib/commonjs/index.js +56 -0
  73. package/lib/commonjs/index.js.map +1 -1
  74. package/lib/commonjs/stores/hms-interactivity-store.js +21 -0
  75. package/lib/commonjs/stores/hms-interactivity-store.js.map +1 -0
  76. package/lib/commonjs/stores/hms-polls-slice.js +19 -0
  77. package/lib/commonjs/stores/hms-polls-slice.js.map +1 -0
  78. package/lib/commonjs/stores/types.js.map +1 -1
  79. package/lib/commonjs/utils/emitter/EventEmitter.js +19 -0
  80. package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -1
  81. package/lib/module/classes/HMSInteractivityCenter.js +85 -0
  82. package/lib/module/classes/HMSInteractivityCenter.js.map +1 -0
  83. package/lib/module/classes/HMSInteractivityEncoder.js +26 -0
  84. package/lib/module/classes/HMSInteractivityEncoder.js.map +1 -0
  85. package/lib/module/classes/HMSPermissions.js +4 -0
  86. package/lib/module/classes/HMSPermissions.js.map +1 -1
  87. package/lib/module/classes/HMSPollsListenerActions.js +5 -0
  88. package/lib/module/classes/HMSPollsListenerActions.js.map +1 -0
  89. package/lib/module/classes/HMSSDK.js +8 -0
  90. package/lib/module/classes/HMSSDK.js.map +1 -1
  91. package/lib/module/classes/polls/HMSPoll.js +2 -0
  92. package/lib/module/classes/polls/HMSPoll.js.map +1 -0
  93. package/lib/module/classes/polls/HMSPollCategory.js +6 -0
  94. package/lib/module/classes/polls/HMSPollCategory.js.map +1 -0
  95. package/lib/module/classes/polls/HMSPollCreateParams.js +2 -0
  96. package/lib/module/classes/polls/HMSPollCreateParams.js.map +1 -0
  97. package/lib/module/classes/polls/HMSPollQuestion.js +2 -0
  98. package/lib/module/classes/polls/HMSPollQuestion.js.map +1 -0
  99. package/lib/module/classes/polls/HMSPollQuestionAnswer.js +2 -0
  100. package/lib/module/classes/polls/HMSPollQuestionAnswer.js.map +1 -0
  101. package/lib/module/classes/polls/HMSPollQuestionCreateParams.js +2 -0
  102. package/lib/module/classes/polls/HMSPollQuestionCreateParams.js.map +1 -0
  103. package/lib/module/classes/polls/HMSPollQuestionOption.js +2 -0
  104. package/lib/module/classes/polls/HMSPollQuestionOption.js.map +1 -0
  105. package/lib/module/classes/polls/HMSPollQuestionOptionCreateParams.js +2 -0
  106. package/lib/module/classes/polls/HMSPollQuestionOptionCreateParams.js.map +1 -0
  107. package/lib/module/classes/polls/HMSPollQuestionQuizOptionCreateParams.js +2 -0
  108. package/lib/module/classes/polls/HMSPollQuestionQuizOptionCreateParams.js.map +1 -0
  109. package/lib/module/classes/polls/HMSPollQuestionResponse.js +2 -0
  110. package/lib/module/classes/polls/HMSPollQuestionResponse.js.map +1 -0
  111. package/lib/module/classes/polls/HMSPollQuestionResponseCreateParams.js +2 -0
  112. package/lib/module/classes/polls/HMSPollQuestionResponseCreateParams.js.map +1 -0
  113. package/lib/module/classes/polls/HMSPollQuestionResponseResult.js +2 -0
  114. package/lib/module/classes/polls/HMSPollQuestionResponseResult.js.map +1 -0
  115. package/lib/module/classes/polls/HMSPollQuestionResult.js +2 -0
  116. package/lib/module/classes/polls/HMSPollQuestionResult.js.map +1 -0
  117. package/lib/module/classes/polls/HMSPollQuestionType.js +8 -0
  118. package/lib/module/classes/polls/HMSPollQuestionType.js.map +1 -0
  119. package/lib/module/classes/polls/HMSPollResponsePeerInfo.js +2 -0
  120. package/lib/module/classes/polls/HMSPollResponsePeerInfo.js.map +1 -0
  121. package/lib/module/classes/polls/HMSPollResult.js +2 -0
  122. package/lib/module/classes/polls/HMSPollResult.js.map +1 -0
  123. package/lib/module/classes/polls/HMSPollState.js +7 -0
  124. package/lib/module/classes/polls/HMSPollState.js.map +1 -0
  125. package/lib/module/classes/polls/HMSPollType.js +6 -0
  126. package/lib/module/classes/polls/HMSPollType.js.map +1 -0
  127. package/lib/module/classes/polls/HMSPollUpdateType.js +7 -0
  128. package/lib/module/classes/polls/HMSPollUpdateType.js.map +1 -0
  129. package/lib/module/classes/polls/HMSPollUserTrackingMode.js +7 -0
  130. package/lib/module/classes/polls/HMSPollUserTrackingMode.js.map +1 -0
  131. package/lib/module/hooks/polls.js +12 -0
  132. package/lib/module/hooks/polls.js.map +1 -0
  133. package/lib/module/index.js +7 -0
  134. package/lib/module/index.js.map +1 -1
  135. package/lib/module/stores/hms-interactivity-store.js +15 -0
  136. package/lib/module/stores/hms-interactivity-store.js.map +1 -0
  137. package/lib/module/stores/hms-polls-slice.js +12 -0
  138. package/lib/module/stores/hms-polls-slice.js.map +1 -0
  139. package/lib/module/stores/types.js.map +1 -1
  140. package/lib/module/utils/emitter/EventEmitter.js +19 -0
  141. package/lib/module/utils/emitter/EventEmitter.js.map +1 -1
  142. package/lib/typescript/classes/HMSInteractivityCenter.d.ts +35 -0
  143. package/lib/typescript/classes/HMSInteractivityEncoder.d.ts +4 -0
  144. package/lib/typescript/classes/HMSPermissions.d.ts +4 -0
  145. package/lib/typescript/classes/HMSPollsListenerActions.d.ts +3 -0
  146. package/lib/typescript/classes/HMSSDK.d.ts +3 -0
  147. package/lib/typescript/classes/polls/HMSPoll.d.ts +81 -0
  148. package/lib/typescript/classes/polls/HMSPollCategory.d.ts +10 -0
  149. package/lib/typescript/classes/polls/HMSPollCreateParams.d.ts +6 -0
  150. package/lib/typescript/classes/polls/HMSPollQuestion.d.ts +61 -0
  151. package/lib/typescript/classes/polls/HMSPollQuestionAnswer.d.ts +17 -0
  152. package/lib/typescript/classes/polls/HMSPollQuestionCreateParams.d.ts +25 -0
  153. package/lib/typescript/classes/polls/HMSPollQuestionOption.d.ts +21 -0
  154. package/lib/typescript/classes/polls/HMSPollQuestionOptionCreateParams.d.ts +3 -0
  155. package/lib/typescript/classes/polls/HMSPollQuestionQuizOptionCreateParams.d.ts +4 -0
  156. package/lib/typescript/classes/polls/HMSPollQuestionResponse.d.ts +47 -0
  157. package/lib/typescript/classes/polls/HMSPollQuestionResponseCreateParams.d.ts +2 -0
  158. package/lib/typescript/classes/polls/HMSPollQuestionResponseResult.d.ts +17 -0
  159. package/lib/typescript/classes/polls/HMSPollQuestionResult.d.ts +29 -0
  160. package/lib/typescript/classes/polls/HMSPollQuestionType.d.ts +18 -0
  161. package/lib/typescript/classes/polls/HMSPollResponsePeerInfo.d.ts +21 -0
  162. package/lib/typescript/classes/polls/HMSPollResult.d.ts +22 -0
  163. package/lib/typescript/classes/polls/HMSPollState.d.ts +14 -0
  164. package/lib/typescript/classes/polls/HMSPollType.d.ts +4 -0
  165. package/lib/typescript/classes/polls/HMSPollUpdateType.d.ts +5 -0
  166. package/lib/typescript/classes/polls/HMSPollUserTrackingMode.d.ts +14 -0
  167. package/lib/typescript/hooks/polls.d.ts +3 -0
  168. package/lib/typescript/index.d.ts +8 -0
  169. package/lib/typescript/stores/hms-interactivity-store.d.ts +9 -0
  170. package/lib/typescript/stores/hms-polls-slice.d.ts +5 -0
  171. package/lib/typescript/stores/types.d.ts +6 -0
  172. package/lib/typescript/utils/emitter/EventEmitter.d.ts +7 -0
  173. package/package.json +1 -1
  174. package/sdk-versions.json +2 -2
  175. package/src/classes/HMSInteractivityCenter.ts +126 -0
  176. package/src/classes/HMSInteractivityEncoder.ts +29 -0
  177. package/src/classes/HMSPermissions.ts +6 -0
  178. package/src/classes/HMSPollsListenerActions.ts +3 -0
  179. package/src/classes/HMSSDK.tsx +10 -0
  180. package/src/classes/polls/HMSPoll.ts +108 -0
  181. package/src/classes/polls/HMSPollCategory.ts +11 -0
  182. package/src/classes/polls/HMSPollCreateParams.ts +19 -0
  183. package/src/classes/polls/HMSPollQuestion.ts +92 -0
  184. package/src/classes/polls/HMSPollQuestionAnswer.ts +29 -0
  185. package/src/classes/polls/HMSPollQuestionCreateParams.ts +36 -0
  186. package/src/classes/polls/HMSPollQuestionOption.ts +24 -0
  187. package/src/classes/polls/HMSPollQuestionOptionCreateParams.ts +8 -0
  188. package/src/classes/polls/HMSPollQuestionQuizOptionCreateParams.ts +6 -0
  189. package/src/classes/polls/HMSPollQuestionResponse.ts +72 -0
  190. package/src/classes/polls/HMSPollQuestionResponseCreateParams.ts +6 -0
  191. package/src/classes/polls/HMSPollQuestionResponseResult.ts +19 -0
  192. package/src/classes/polls/HMSPollQuestionResult.ts +41 -0
  193. package/src/classes/polls/HMSPollQuestionType.ts +21 -0
  194. package/src/classes/polls/HMSPollResponsePeerInfo.ts +24 -0
  195. package/src/classes/polls/HMSPollResult.ts +26 -0
  196. package/src/classes/polls/HMSPollState.ts +16 -0
  197. package/src/classes/polls/HMSPollType.ts +4 -0
  198. package/src/classes/polls/HMSPollUpdateType.ts +5 -0
  199. package/src/classes/polls/HMSPollUserTrackingMode.ts +16 -0
  200. package/src/hooks/polls.ts +14 -0
  201. package/src/index.ts +9 -0
  202. package/src/stores/hms-interactivity-store.ts +18 -0
  203. package/src/stores/hms-polls-slice.ts +20 -0
  204. package/src/stores/types.ts +20 -3
  205. package/src/utils/emitter/EventEmitter.ts +26 -0
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useHMSInteractivityStore = void 0;
7
+ var _zustand = require("zustand");
8
+ var _middleware = require("zustand/middleware");
9
+ var _hmsPollsSlice = require("./hms-polls-slice");
10
+ // import { immer } from 'zustand/middleware/immer';
11
+
12
+ const useHMSInteractivityStore = exports.useHMSInteractivityStore = (0, _zustand.create)()(
13
+ // [['zustand/subscribeWithSelector', never], ['zustand/immer', never]]
14
+ (0, _middleware.subscribeWithSelector)(
15
+ // immer((...a) => ({
16
+ // ...createHMSPollsSlice(...a),
17
+ // }))
18
+ (...a) => ({
19
+ ...(0, _hmsPollsSlice.createHMSPollsSlice)(...a)
20
+ })));
21
+ //# sourceMappingURL=hms-interactivity-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_zustand","require","_middleware","_hmsPollsSlice","useHMSInteractivityStore","exports","create","subscribeWithSelector","a","createHMSPollsSlice"],"sources":["hms-interactivity-store.ts"],"sourcesContent":["import { create } from 'zustand';\nimport { subscribeWithSelector } from 'zustand/middleware';\n// import { immer } from 'zustand/middleware/immer';\n\nimport { createHMSPollsSlice } from './hms-polls-slice';\nimport type { HMSInteractivityStore } from './types';\n\nexport const useHMSInteractivityStore = create<HMSInteractivityStore>()(\n // [['zustand/subscribeWithSelector', never], ['zustand/immer', never]]\n subscribeWithSelector(\n // immer((...a) => ({\n // ...createHMSPollsSlice(...a),\n // }))\n (...a) => ({\n ...createHMSPollsSlice(...a),\n })\n )\n);\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA,IAAAE,cAAA,GAAAF,OAAA;AAFA;;AAKO,MAAMG,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,IAAAE,eAAM,EAAwB,CAAC;AACrE;AACA,IAAAC,iCAAqB;AACnB;AACA;AACA;AACA,CAAC,GAAGC,CAAC,MAAM;EACT,GAAG,IAAAC,kCAAmB,EAAC,GAAGD,CAAC;AAC7B,CAAC,CACH,CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createHMSPollsSlice = void 0;
7
+ const createHMSPollsSlice = set => ({
8
+ polls: {},
9
+ setPolls: poll => {
10
+ set(state => {
11
+ state.polls[poll.pollId] = poll;
12
+ return state; // TODO: remove when use immer
13
+ });
14
+ }
15
+ // cue: undefined,
16
+ // setCue: (cue: HMSHLSPlayerPlaybackCue) => set({ cue }),
17
+ });
18
+ exports.createHMSPollsSlice = createHMSPollsSlice;
19
+ //# sourceMappingURL=hms-polls-slice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createHMSPollsSlice","set","polls","setPolls","poll","state","pollId","exports"],"sources":["hms-polls-slice.ts"],"sourcesContent":["import type { StateCreator } from 'zustand';\nimport type { HMSInteractivityStore, HMSPollsSlice } from './types';\nimport type { HMSPoll } from '../classes/polls/HMSPoll';\n\nexport const createHMSPollsSlice: StateCreator<\n HMSInteractivityStore,\n [],\n [],\n HMSPollsSlice\n> = (set) => ({\n polls: {},\n setPolls: (poll: HMSPoll) => {\n set((state) => {\n state.polls[poll.pollId] = poll;\n return state; // TODO: remove when use immer\n });\n },\n // cue: undefined,\n // setCue: (cue: HMSHLSPlayerPlaybackCue) => set({ cue }),\n});\n"],"mappings":";;;;;;AAIO,MAAMA,mBAKZ,GAAIC,GAAG,KAAM;EACZC,KAAK,EAAE,CAAC,CAAC;EACTC,QAAQ,EAAGC,IAAa,IAAK;IAC3BH,GAAG,CAAEI,KAAK,IAAK;MACbA,KAAK,CAACH,KAAK,CAACE,IAAI,CAACE,MAAM,CAAC,GAAGF,IAAI;MAC/B,OAAOC,KAAK,CAAC,CAAC;IAChB,CAAC,CAAC;EACJ;EACA;EACA;AACF,CAAC,CAAC;AAACE,OAAA,CAAAP,mBAAA,GAAAA,mBAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["// Stores\n\nimport type {\n HMSHLSPlayerPlaybackState,\n HMSHLSPlayerPlaybackCueEventData,\n HMSHLSPlayerPlaybackFailureEventData,\n HMSHLSPlayerPlaybackResolutionChangeEventData,\n HMSHLSPlayerStatsErrorEventData,\n HMSHLSPlayerStatsUpdateEventData,\n} from '../types';\n\nexport type HMSStore = HMSHLSPlayerPlaybackSlice & HMSViewsSlice;\nexport type HMSHLSPlayerStatsStore = HMSHLSPlayerStatsSlice;\n\n// HMSViews Slice\n\nexport type TrackId = string;\n\nexport type Resolution = {\n width: number;\n height: number;\n};\n\nexport interface HMSViewsSlice {\n hmsviewsResolutions: Record<TrackId, Resolution | undefined>;\n setHmsviewsResolutions(trackId: TrackId, resolution: Resolution): void;\n}\n\n// HLS Player Playback Slice\n\nexport interface HMSHLSPlayerPlaybackCue\n extends Omit<HMSHLSPlayerPlaybackCueEventData, 'endDate' | 'startDate'> {\n endDate?: Date;\n startDate: Date;\n}\n\nexport type HMSHLSPlayerCue = HMSHLSPlayerPlaybackCue | undefined;\n\nexport type HMSHLSPlayerPlaybackError =\n | HMSHLSPlayerPlaybackFailureEventData['error']\n | undefined;\n\nexport type HMSHLSPlayerResolution =\n | HMSHLSPlayerPlaybackResolutionChangeEventData\n | undefined;\n\nexport interface HMSHLSPlayerPlaybackSlice {\n cue: HMSHLSPlayerCue;\n playbackState: HMSHLSPlayerPlaybackState;\n resolution: HMSHLSPlayerResolution;\n error: HMSHLSPlayerPlaybackError;\n setCue(cue: HMSHLSPlayerPlaybackCue): void;\n setPlaybackState(playbackState: HMSHLSPlayerPlaybackState): void;\n setResolution(resolution: HMSHLSPlayerResolution): void;\n setPlaybackError(error: HMSHLSPlayerPlaybackError): void;\n}\n\n// HLS Player Stats Slice\n\nexport type HMSHLSPlayerStats = HMSHLSPlayerStatsUpdateEventData;\nexport type HMSHLSPlayerStatsError =\n | HMSHLSPlayerStatsErrorEventData\n | undefined;\n\nexport interface HMSHLSPlayerStatsSlice {\n stats: HMSHLSPlayerStats;\n error: HMSHLSPlayerStatsError | undefined;\n changeStats(stats: HMSHLSPlayerStats): void;\n setError(error: HMSHLSPlayerStatsError): void;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["// Stores\n\nimport type { HMSPoll } from '../classes/polls/HMSPoll';\nimport type {\n HMSHLSPlayerPlaybackState,\n HMSHLSPlayerPlaybackCueEventData,\n HMSHLSPlayerPlaybackFailureEventData,\n HMSHLSPlayerPlaybackResolutionChangeEventData,\n HMSHLSPlayerStatsErrorEventData,\n HMSHLSPlayerStatsUpdateEventData,\n} from '../types';\n\nexport type HMSStore = HMSHLSPlayerPlaybackSlice & HMSViewsSlice;\nexport type HMSHLSPlayerStatsStore = HMSHLSPlayerStatsSlice;\nexport type HMSInteractivityStore = HMSPollsSlice;\n\n//#region HMSViews Slice\n\nexport type TrackId = string;\n\nexport type Resolution = {\n width: number;\n height: number;\n};\n\nexport interface HMSViewsSlice {\n hmsviewsResolutions: Record<TrackId, Resolution | undefined>;\n setHmsviewsResolutions(trackId: TrackId, resolution: Resolution): void;\n}\n\n//#endregion HMSViews Slice\n\n//#region HLS Player Playback Slice\n\nexport interface HMSHLSPlayerPlaybackCue\n extends Omit<HMSHLSPlayerPlaybackCueEventData, 'endDate' | 'startDate'> {\n endDate?: Date;\n startDate: Date;\n}\n\nexport type HMSHLSPlayerCue = HMSHLSPlayerPlaybackCue | undefined;\n\nexport type HMSHLSPlayerPlaybackError =\n | HMSHLSPlayerPlaybackFailureEventData['error']\n | undefined;\n\nexport type HMSHLSPlayerResolution =\n | HMSHLSPlayerPlaybackResolutionChangeEventData\n | undefined;\n\nexport interface HMSHLSPlayerPlaybackSlice {\n cue: HMSHLSPlayerCue;\n playbackState: HMSHLSPlayerPlaybackState;\n resolution: HMSHLSPlayerResolution;\n error: HMSHLSPlayerPlaybackError;\n setCue(cue: HMSHLSPlayerPlaybackCue): void;\n setPlaybackState(playbackState: HMSHLSPlayerPlaybackState): void;\n setResolution(resolution: HMSHLSPlayerResolution): void;\n setPlaybackError(error: HMSHLSPlayerPlaybackError): void;\n}\n\n//#endregion HLS Player Playback Slice\n\n//#region HLS Player Stats Slice\n\nexport type HMSHLSPlayerStats = HMSHLSPlayerStatsUpdateEventData;\nexport type HMSHLSPlayerStatsError =\n | HMSHLSPlayerStatsErrorEventData\n | undefined;\n\nexport interface HMSHLSPlayerStatsSlice {\n stats: HMSHLSPlayerStats;\n error: HMSHLSPlayerStatsError | undefined;\n changeStats(stats: HMSHLSPlayerStats): void;\n setError(error: HMSHLSPlayerStatsError): void;\n}\n\n//#endregion HLS Player Stats Slice\n\n//#region Polls Slice\n\nexport type HMSPollsSlice = {\n polls: Record<string, HMSPoll>;\n setPolls(poll: HMSPoll): void;\n};\n\n//#endregion Polls Slice\n"],"mappings":""}
@@ -38,9 +38,19 @@ class EventEmitter {
38
38
  */
39
39
  constructor(subscriber) {
40
40
  _defineProperty(this, "_subscriber", void 0);
41
+ _defineProperty(this, "_onAllListenersRemoved", void 0);
41
42
  this._subscriber = subscriber || new _EventSubscriptionVendor.EventSubscriptionVendor();
42
43
  }
43
44
 
45
+ /**
46
+ * Registers a listener to be invoked when all event listeners have been removed
47
+ * Given listener is invoked with event type or `all` when all listeners are removed
48
+ * @param onAllListenersRemoved
49
+ */
50
+ registerOnAllListenersRemoved(onAllListenersRemoved) {
51
+ this._onAllListenersRemoved = onAllListenersRemoved;
52
+ }
53
+
44
54
  /**
45
55
  * Adds a listener to be invoked when events of the specified type are
46
56
  * emitted. An optional calling context may be provided. The data arguments
@@ -67,7 +77,9 @@ class EventEmitter {
67
77
  * listeners to remove
68
78
  */
69
79
  removeAllListeners(eventType) {
80
+ var _this$_onAllListeners;
70
81
  this._subscriber.removeAllSubscriptions(eventType);
82
+ (_this$_onAllListeners = this._onAllListenersRemoved) === null || _this$_onAllListeners === void 0 || _this$_onAllListeners.call(this, eventType || 'all');
71
83
  }
72
84
 
73
85
  /**
@@ -79,7 +91,14 @@ class EventEmitter {
79
91
  console.warn('Subscription does not belong to this emitter.'); // TODO: use HMSLogger here
80
92
  return;
81
93
  }
94
+ const eventType = subscription.eventType;
82
95
  this._subscriber.removeSubscription(subscription);
96
+
97
+ // check if all subscriptions are removed for the event type
98
+ if (typeof this._onAllListenersRemoved === 'function' && this.listenerCount(eventType) === 0) {
99
+ // invoke passed cleanup function if any for the event type
100
+ this._onAllListenersRemoved(eventType);
101
+ }
83
102
  }
84
103
 
85
104
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_EmitterSubscription","require","_EventSubscriptionVendor","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","sparseFilterPredicate","EventEmitter","constructor","subscriber","_subscriber","EventSubscriptionVendor","addListener","eventType","listener","context","addSubscription","EmitterSubscription","removeAllListeners","removeAllSubscriptions","removeSubscription","subscription","emitter","console","warn","listenerCount","subscriptions","getSubscriptionsForType","filter","length","emit","args","l","apply","removeListener","remove","exports"],"sources":["EventEmitter.ts"],"sourcesContent":["import { EmitterSubscription } from './_EmitterSubscription';\nimport { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\nconst sparseFilterPredicate = () => true;\n\nexport { EmitterSubscription } from './_EmitterSubscription';\n\n/**\n * @class EventEmitter\n * @description\n * An EventEmitter is responsible for managing a set of listeners and publishing\n * events to them when it is told that such events happened. In addition to the\n * data for the given event it also sends a event control object which allows\n * the listeners/handlers to prevent the default behavior of the given event.\n *\n * The emitter is designed to be generic enough to support all the different\n * contexts in which one might want to emit events. It is a simple multicast\n * mechanism on top of which extra functionality can be composed. For example, a\n * more advanced emitter may use an EventHolder and EventFactory.\n */\nexport class EventEmitter {\n _subscriber: EventSubscriptionVendor;\n\n /**\n * @constructor\n *\n * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance\n * to use. If omitted, a new subscriber will be created for the emitter.\n */\n constructor(subscriber?: EventSubscriptionVendor | null) {\n this._subscriber = subscriber || new EventSubscriptionVendor();\n }\n\n /**\n * Adds a listener to be invoked when events of the specified type are\n * emitted. An optional calling context may be provided. The data arguments\n * emitted will be passed to the listener function.\n *\n * TODO: Annotate the listener arg's type. This is tricky because listeners\n * can be invoked with varargs.\n *\n * @param {string} eventType - Name of the event to listen to\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n * @param {*} context - Optional context object to use when invoking the\n * listener\n */\n addListener(\n eventType: string,\n listener: Function,\n context: Object | null | undefined\n ): EmitterSubscription {\n return this._subscriber.addSubscription(\n eventType,\n new EmitterSubscription(this, this._subscriber, listener, context)\n ) as EmitterSubscription;\n }\n\n /**\n * Removes all of the registered listeners, including those registered as\n * listener maps.\n *\n * @param {?string} eventType - Optional name of the event whose registered\n * listeners to remove\n */\n removeAllListeners(eventType: string | undefined | null) {\n this._subscriber.removeAllSubscriptions(eventType);\n }\n\n /**\n * Removes a specific subscription. Called by the `remove()` method of the\n * subscription itself to ensure any necessary cleanup is performed.\n */\n removeSubscription(subscription: EmitterSubscription) {\n if (subscription.emitter !== this) {\n console.warn('Subscription does not belong to this emitter.'); // TODO: use HMSLogger here\n return;\n }\n\n this._subscriber.removeSubscription(subscription);\n }\n\n /**\n * Returns the number of listeners that are currently registered for the given\n * event.\n *\n * @param {string} eventType - Name of the event to query\n * @returns {number}\n */\n listenerCount(eventType: string): number {\n const subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n return subscriptions\n ? // We filter out missing entries because the array is sparse.\n // \"callbackfn is called only for elements of the array which actually\n // exist; it is not called for missing elements of the array.\"\n // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter\n subscriptions.filter(sparseFilterPredicate).length\n : 0;\n }\n\n /**\n * Emits an event of the given type with the given data. All handlers of that\n * particular type will be notified.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {...*} Arbitrary arguments to be passed to each registered listener\n *\n * @example\n * emitter.addListener('someEvent', function(message) {\n * console.log(message);\n * });\n *\n * emitter.emit('someEvent', 'abc'); // logs 'abc'\n */\n emit(eventType: string, ...args: any[]) {\n const subscriptions = this._subscriber.getSubscriptionsForType(\n eventType\n ) as EmitterSubscription[] | null | undefined;\n if (subscriptions) {\n for (let i = 0, l = subscriptions.length; i < l; i++) {\n const subscription = subscriptions[i];\n\n // The subscription may have been removed during this event loop.\n if (subscription && subscription.listener) {\n subscription.listener.apply(subscription.context, args);\n }\n }\n }\n }\n\n /**\n * Removes the given listener for event of specific type.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n *\n * @example\n * emitter.removeListener('someEvent', function(message) {\n * console.log(message);\n * }); // removes the listener if already registered\n *\n */\n removeListener(eventType: string, listener: Function) {\n const subscriptions = this._subscriber.getSubscriptionsForType(\n eventType\n ) as EmitterSubscription[] | null | undefined;\n if (subscriptions) {\n for (let i = 0, l = subscriptions.length; i < l; i++) {\n const subscription = subscriptions[i];\n\n // The subscription may have been removed during this event loop.\n // its listener matches the listener in method parameters\n if (subscription && subscription.listener === listener) {\n subscription.remove();\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AAAqE,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,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AW,CAACiB,uBAAuB,CAC5Dd,SACF,CAA6C;IAC7C,IAAIa,aAAa,EAAE;MACjB,KAAK,IAAI9B,CAAC,GAAG,CAAC,EAAEoC,CAAC,GAAGN,aAAa,CAACG,MAAM,EAAEjC,CAAC,GAAGoC,CAAC,EAAEpC,CAAC,EAAE,EAAE;QACpD,MAAMyB,YAAY,GAAGK,aAAa,CAAC9B,CAAC,CAAC;;QAErC;QACA;QACA,IAAIyB,YAAY,IAAIA,YAAY,CAACP,QAAQ,KAAKA,QAAQ,EAAE;UACtDO,YAAY,CAACc,MAAM,CAAC,CAAC;QACvB;MACF;IACF;EACF;AACF;AAACC,OAAA,CAAA7B,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["_EmitterSubscription","require","_EventSubscriptionVendor","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","sparseFilterPredicate","EventEmitter","constructor","subscriber","_subscriber","EventSubscriptionVendor","registerOnAllListenersRemoved","onAllListenersRemoved","_onAllListenersRemoved","addListener","eventType","listener","context","addSubscription","EmitterSubscription","removeAllListeners","_this$_onAllListeners","removeAllSubscriptions","removeSubscription","subscription","emitter","console","warn","listenerCount","subscriptions","getSubscriptionsForType","filter","length","emit","args","l","apply","removeListener","remove","exports"],"sources":["EventEmitter.ts"],"sourcesContent":["import { EmitterSubscription } from './_EmitterSubscription';\nimport { EventSubscriptionVendor } from './_EventSubscriptionVendor';\n\nconst sparseFilterPredicate = () => true;\n\nexport { EmitterSubscription } from './_EmitterSubscription';\n\n/**\n * @class EventEmitter\n * @description\n * An EventEmitter is responsible for managing a set of listeners and publishing\n * events to them when it is told that such events happened. In addition to the\n * data for the given event it also sends a event control object which allows\n * the listeners/handlers to prevent the default behavior of the given event.\n *\n * The emitter is designed to be generic enough to support all the different\n * contexts in which one might want to emit events. It is a simple multicast\n * mechanism on top of which extra functionality can be composed. For example, a\n * more advanced emitter may use an EventHolder and EventFactory.\n */\nexport class EventEmitter {\n _subscriber: EventSubscriptionVendor;\n _onAllListenersRemoved:\n | ((eventType: string | 'all') => void)\n | null\n | undefined;\n\n /**\n * @constructor\n *\n * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance\n * to use. If omitted, a new subscriber will be created for the emitter.\n */\n constructor(subscriber?: EventSubscriptionVendor | null) {\n this._subscriber = subscriber || new EventSubscriptionVendor();\n }\n\n /**\n * Registers a listener to be invoked when all event listeners have been removed\n * Given listener is invoked with event type or `all` when all listeners are removed\n * @param onAllListenersRemoved\n */\n registerOnAllListenersRemoved(\n onAllListenersRemoved: (eventType: string | 'all') => void\n ) {\n this._onAllListenersRemoved = onAllListenersRemoved;\n }\n\n /**\n * Adds a listener to be invoked when events of the specified type are\n * emitted. An optional calling context may be provided. The data arguments\n * emitted will be passed to the listener function.\n *\n * TODO: Annotate the listener arg's type. This is tricky because listeners\n * can be invoked with varargs.\n *\n * @param {string} eventType - Name of the event to listen to\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n * @param {*} context - Optional context object to use when invoking the\n * listener\n */\n addListener(\n eventType: string,\n listener: Function,\n context: Object | null | undefined\n ): EmitterSubscription {\n return this._subscriber.addSubscription(\n eventType,\n new EmitterSubscription(this, this._subscriber, listener, context)\n ) as EmitterSubscription;\n }\n\n /**\n * Removes all of the registered listeners, including those registered as\n * listener maps.\n *\n * @param {?string} eventType - Optional name of the event whose registered\n * listeners to remove\n */\n removeAllListeners(eventType: string | undefined | null) {\n this._subscriber.removeAllSubscriptions(eventType);\n this._onAllListenersRemoved?.(eventType || 'all');\n }\n\n /**\n * Removes a specific subscription. Called by the `remove()` method of the\n * subscription itself to ensure any necessary cleanup is performed.\n */\n removeSubscription(subscription: EmitterSubscription) {\n if (subscription.emitter !== this) {\n console.warn('Subscription does not belong to this emitter.'); // TODO: use HMSLogger here\n return;\n }\n\n const eventType = subscription.eventType;\n this._subscriber.removeSubscription(subscription);\n\n // check if all subscriptions are removed for the event type\n if (\n typeof this._onAllListenersRemoved === 'function' &&\n this.listenerCount(eventType) === 0\n ) {\n // invoke passed cleanup function if any for the event type\n this._onAllListenersRemoved(eventType);\n }\n }\n\n /**\n * Returns the number of listeners that are currently registered for the given\n * event.\n *\n * @param {string} eventType - Name of the event to query\n * @returns {number}\n */\n listenerCount(eventType: string): number {\n const subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n return subscriptions\n ? // We filter out missing entries because the array is sparse.\n // \"callbackfn is called only for elements of the array which actually\n // exist; it is not called for missing elements of the array.\"\n // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter\n subscriptions.filter(sparseFilterPredicate).length\n : 0;\n }\n\n /**\n * Emits an event of the given type with the given data. All handlers of that\n * particular type will be notified.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {...*} Arbitrary arguments to be passed to each registered listener\n *\n * @example\n * emitter.addListener('someEvent', function(message) {\n * console.log(message);\n * });\n *\n * emitter.emit('someEvent', 'abc'); // logs 'abc'\n */\n emit(eventType: string, ...args: any[]) {\n const subscriptions = this._subscriber.getSubscriptionsForType(\n eventType\n ) as EmitterSubscription[] | null | undefined;\n if (subscriptions) {\n for (let i = 0, l = subscriptions.length; i < l; i++) {\n const subscription = subscriptions[i];\n\n // The subscription may have been removed during this event loop.\n if (subscription && subscription.listener) {\n subscription.listener.apply(subscription.context, args);\n }\n }\n }\n }\n\n /**\n * Removes the given listener for event of specific type.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n *\n * @example\n * emitter.removeListener('someEvent', function(message) {\n * console.log(message);\n * }); // removes the listener if already registered\n *\n */\n removeListener(eventType: string, listener: Function) {\n const subscriptions = this._subscriber.getSubscriptionsForType(\n eventType\n ) as EmitterSubscription[] | null | undefined;\n if (subscriptions) {\n for (let i = 0, l = subscriptions.length; i < l; i++) {\n const subscription = subscriptions[i];\n\n // The subscription may have been removed during this event loop.\n // its listener matches the listener in method parameters\n if (subscription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ACC,OAAA,CAAAjC,YAAA,GAAAA,YAAA"}
@@ -0,0 +1,85 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { EventEmitter } from '../utils';
5
+ import HMSManager from '../modules/HMSManagerModule';
6
+ import { HMSConstants } from './HMSConstants';
7
+ import { logger } from './HMSLogger';
8
+ import { HMSPollsListenerActions } from './HMSPollsListenerActions';
9
+ import HMSNativeEventListener from './HMSNativeEventListener';
10
+ import { HMSInteractivityEncoder } from './HMSInteractivityEncoder';
11
+ let pollUpdateSubscription = null;
12
+ function registerPollUpdateListener(listener) {
13
+ if (pollUpdateSubscription !== null) {
14
+ return;
15
+ }
16
+ pollUpdateSubscription = HMSNativeEventListener.addListener(HMSConstants.DEFAULT_SDK_ID, HMSPollsListenerActions.ON_POLL_UPDATE, listener);
17
+ }
18
+ function unregisterPollUpdateListener() {
19
+ if (pollUpdateSubscription === null) {
20
+ return;
21
+ }
22
+ pollUpdateSubscription.remove();
23
+ pollUpdateSubscription = null;
24
+ }
25
+ export class HMSInteractivityCenter {
26
+ constructor() {
27
+ _defineProperty(this, "_eventEmitter", new EventEmitter());
28
+ _defineProperty(this, "_pollUpdateListener", (...args) => {
29
+ const {
30
+ updatedPoll,
31
+ update
32
+ } = args[0];
33
+ logger === null || logger === void 0 || logger.verbose('#Listener ON_POLL_UPDATE', {
34
+ update,
35
+ updatedPoll
36
+ });
37
+ this._eventEmitter.emit(HMSPollsListenerActions.ON_POLL_UPDATE, HMSInteractivityEncoder.transformPoll(updatedPoll), update);
38
+ });
39
+ _defineProperty(this, "_onAllPollUpdateListenerRemoved", () => {
40
+ unregisterPollUpdateListener();
41
+ });
42
+ this._eventEmitter.registerOnAllListenersRemoved(this._onAllPollUpdateListenerRemoved);
43
+ }
44
+
45
+ /**
46
+ * Adds a listener for poll updates
47
+ * @param listener - Callback to be called when a poll is updated
48
+ * @returns HMSEventSubscription
49
+ */
50
+ addPollUpdateListener(listener) {
51
+ registerPollUpdateListener(this._pollUpdateListener);
52
+ return this._eventEmitter.addListener(HMSPollsListenerActions.ON_POLL_UPDATE, listener, null);
53
+ }
54
+
55
+ /**
56
+ * Starts a poll
57
+ *
58
+ * @param pollParams
59
+ */
60
+ async startPoll(pollParams) {
61
+ const data = {
62
+ ...pollParams,
63
+ id: HMSConstants.DEFAULT_SDK_ID
64
+ };
65
+ logger === null || logger === void 0 || logger.verbose('#Function startPoll', JSON.stringify(data));
66
+ return HMSManager.quickStartPoll(data);
67
+ }
68
+ async add(pollQuestionResponseParams) {
69
+ const data = {
70
+ ...pollQuestionResponseParams,
71
+ id: HMSConstants.DEFAULT_SDK_ID
72
+ };
73
+ logger === null || logger === void 0 || logger.verbose('#Function add', JSON.stringify(data));
74
+ return HMSManager.addResponseOnPollQuestion(data);
75
+ }
76
+ async stop(pollId) {
77
+ const data = {
78
+ id: HMSConstants.DEFAULT_SDK_ID,
79
+ pollId
80
+ };
81
+ logger === null || logger === void 0 || logger.verbose('#Function stop', JSON.stringify(data));
82
+ return HMSManager.stopPoll(data);
83
+ }
84
+ }
85
+ //# sourceMappingURL=HMSInteractivityCenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventEmitter","HMSManager","HMSConstants","logger","HMSPollsListenerActions","HMSNativeEventListener","HMSInteractivityEncoder","pollUpdateSubscription","registerPollUpdateListener","listener","addListener","DEFAULT_SDK_ID","ON_POLL_UPDATE","unregisterPollUpdateListener","remove","HMSInteractivityCenter","constructor","_defineProperty","args","updatedPoll","update","verbose","_eventEmitter","emit","transformPoll","registerOnAllListenersRemoved","_onAllPollUpdateListenerRemoved","addPollUpdateListener","_pollUpdateListener","startPoll","pollParams","data","id","JSON","stringify","quickStartPoll","add","pollQuestionResponseParams","addResponseOnPollQuestion","stop","pollId","stopPoll"],"sources":["HMSInteractivityCenter.ts"],"sourcesContent":["import { EventEmitter } from '../utils';\nimport HMSManager from '../modules/HMSManagerModule';\nimport { HMSConstants } from './HMSConstants';\nimport { logger } from './HMSLogger';\nimport type { HMSPoll } from './polls/HMSPoll';\nimport type { HMSPollCreateParams } from './polls/HMSPollCreateParams';\nimport type { HMSPollUpdateType } from './polls/HMSPollUpdateType';\nimport { HMSPollsListenerActions } from './HMSPollsListenerActions';\nimport HMSNativeEventListener from './HMSNativeEventListener';\nimport type { HMSEventSubscription } from './HMSNativeEventEmitter';\nimport { HMSInteractivityEncoder } from './HMSInteractivityEncoder';\n\ntype PollUpdateListener = (data: {\n updatedPoll: HMSPoll;\n update: HMSPollUpdateType;\n}) => void;\n\ntype PollQuestionResponseCreateParams = {\n pollId: string;\n pollQuestionIndex: number;\n responses:\n | {\n text: string;\n duration?: number;\n }\n | {\n options: number[];\n duration?: number;\n };\n};\n\nlet pollUpdateSubscription: null | HMSEventSubscription = null;\n\nfunction registerPollUpdateListener(listener: PollUpdateListener) {\n if (pollUpdateSubscription !== null) {\n return;\n }\n pollUpdateSubscription = HMSNativeEventListener.addListener(\n HMSConstants.DEFAULT_SDK_ID,\n HMSPollsListenerActions.ON_POLL_UPDATE,\n listener\n );\n}\n\nfunction unregisterPollUpdateListener() {\n if (pollUpdateSubscription === null) {\n return;\n }\n pollUpdateSubscription.remove();\n pollUpdateSubscription = null;\n}\n\nexport class HMSInteractivityCenter {\n private _eventEmitter = new EventEmitter();\n\n private _pollUpdateListener = (...args: Parameters<PollUpdateListener>) => {\n const { updatedPoll, update } = args[0];\n logger?.verbose('#Listener ON_POLL_UPDATE', {\n update,\n updatedPoll,\n });\n this._eventEmitter.emit(\n HMSPollsListenerActions.ON_POLL_UPDATE,\n HMSInteractivityEncoder.transformPoll(updatedPoll),\n update\n );\n };\n\n private _onAllPollUpdateListenerRemoved = () => {\n unregisterPollUpdateListener();\n };\n\n constructor() {\n this._eventEmitter.registerOnAllListenersRemoved(\n this._onAllPollUpdateListenerRemoved\n );\n }\n\n /**\n * Adds a listener for poll updates\n * @param listener - Callback to be called when a poll is updated\n * @returns HMSEventSubscription\n */\n addPollUpdateListener(\n listener: (updatedPoll: HMSPoll, update: HMSPollUpdateType) => void\n ) {\n registerPollUpdateListener(this._pollUpdateListener);\n return this._eventEmitter.addListener(\n HMSPollsListenerActions.ON_POLL_UPDATE,\n listener,\n null\n );\n }\n\n /**\n * Starts a poll\n *\n * @param pollParams\n */\n async startPoll(pollParams: HMSPollCreateParams) {\n const data = {\n ...pollParams,\n id: HMSConstants.DEFAULT_SDK_ID,\n };\n logger?.verbose('#Function startPoll', JSON.stringify(data));\n return HMSManager.quickStartPoll(data);\n }\n\n async add(pollQuestionResponseParams: PollQuestionResponseCreateParams) {\n const data = {\n ...pollQuestionResponseParams,\n id: HMSConstants.DEFAULT_SDK_ID,\n };\n logger?.verbose('#Function add', JSON.stringify(data));\n return HMSManager.addResponseOnPollQuestion(data);\n }\n\n async stop(pollId: string) {\n const data = {\n id: HMSConstants.DEFAULT_SDK_ID,\n pollId,\n };\n logger?.verbose('#Function stop', JSON.stringify(data));\n return HMSManager.stopPoll(data);\n }\n}\n"],"mappings":";;;AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,OAAOC,UAAU,MAAM,6BAA6B;AACpD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,MAAM,QAAQ,aAAa;AAIpC,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAqBnE,IAAIC,sBAAmD,GAAG,IAAI;AAE9D,SAASC,0BAA0BA,CAACC,QAA4B,EAAE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UAA+B,EAAE;IAC/C,MAAMC,IAAI,GAAG;MACX,GAAGD,UAAU;MACbE,EAAE,EAAE9B,YAAY,CAACS;IACnB,CAAC;IACDR,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEkB,OAAO,CAAC,qBAAqB,EAAEY,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,CAAC;IAC5D,OAAO9B,UAAU,CAACkC,cAAc,CAACJ,IAAI,CAAC;EACxC;EAEA,MAAMK,GAAGA,CAACC,0BAA4D,EAAE;IACtE,MAAMN,IAAI,GAAG;MACX,GAAGM,0BAA0B;MAC7BL,EAAE,EAAE9B,YAAY,CAACS;IACnB,CAAC;IACDR,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEkB,OAAO,CAAC,eAAe,EAAEY,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,CAAC;IACtD,OAAO9B,UAAU,CAACqC,yBAAyB,CAACP,IAAI,CAAC;EACnD;EAEA,MAAMQ,IAAIA,CAACC,MAAc,EAAE;IACzB,MAAMT,IAAI,GAAG;MACXC,EAAE,EAAE9B,YAAY,CAACS,cAAc;MAC/B6B;IACF,CAAC;IACDrC,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEkB,OAAO,CAAC,gBAAgB,EAAEY,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,CAAC;IACvD,OAAO9B,UAAU,CAACwC,QAAQ,CAACV,IAAI,CAAC;EAClC;AACF"}
@@ -0,0 +1,26 @@
1
+ export class HMSInteractivityEncoder {
2
+ static transformPoll(poll) {
3
+ if (poll.startedAt) {
4
+ const dateNum = parseInt(poll.startedAt);
5
+ if (isNaN(dateNum)) {
6
+ poll.startedAt = undefined;
7
+ } else {
8
+ poll.startedAt = new Date(dateNum);
9
+ }
10
+ }
11
+ if (poll.stoppedAt) {
12
+ const dateNum = parseInt(poll.stoppedAt);
13
+ if (isNaN(dateNum)) {
14
+ poll.stoppedAt = undefined;
15
+ } else {
16
+ poll.stoppedAt = new Date(dateNum);
17
+ }
18
+ }
19
+ // poll.rolesThatCanVote: HMSRole[];
20
+ // poll.rolesThatCanViewResponses: HMSRole[];
21
+ // --- poll.questions: HMSPollQuestion[]
22
+ // --- poll.result: HMSPollResult
23
+ return poll;
24
+ }
25
+ }
26
+ //# sourceMappingURL=HMSInteractivityEncoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HMSInteractivityEncoder","transformPoll","poll","startedAt","dateNum","parseInt","isNaN","undefined","Date","stoppedAt"],"sources":["HMSInteractivityEncoder.ts"],"sourcesContent":["import type { HMSPoll } from './polls/HMSPoll';\n\nexport class HMSInteractivityEncoder {\n static transformPoll(poll: HMSPoll): HMSPoll {\n if (poll.startedAt) {\n const dateNum = parseInt(poll.startedAt as unknown as string);\n\n if (isNaN(dateNum)) {\n poll.startedAt = undefined;\n } else {\n poll.startedAt = new Date(dateNum);\n }\n }\n if (poll.stoppedAt) {\n const dateNum = parseInt(poll.stoppedAt as unknown as string);\n\n if (isNaN(dateNum)) {\n poll.stoppedAt = undefined;\n } else {\n poll.stoppedAt = new Date(dateNum);\n }\n }\n // poll.rolesThatCanVote: HMSRole[];\n // poll.rolesThatCanViewResponses: HMSRole[];\n // --- poll.questions: HMSPollQuestion[]\n // --- poll.result: HMSPollResult\n return poll;\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,uBAAuB,CAAC;EACnC,OAAOC,aAAaA,CAACC,IAAa,EAAW;IAC3C,IAAIA,IAAI,CAACC,SAAS,EAAE;MAClB,MAAMC,OAAO,GAAGC,QAAQ,CAACH,IAAI,CAACC,SAA8B,CAAC;MAE7D,IAAIG,KAAK,CAACF,OAAO,CAAC,EAAE;QAClBF,IAAI,CAACC,SAAS,GAAGI,SAAS;MAC5B,CAAC,MAAM;QACLL,IAAI,CAACC,SAAS,GAAG,IAAIK,IAAI,CAACJ,OAAO,CAAC;MACpC;IACF;IACA,IAAIF,IAAI,CAACO,SAAS,EAAE;MAClB,MAAML,OAAO,GAAGC,QAAQ,CAACH,IAAI,CAACO,SAA8B,CAAC;MAE7D,IAAIH,KAAK,CAACF,OAAO,CAAC,EAAE;QAClBF,IAAI,CAACO,SAAS,GAAGF,SAAS;MAC5B,CAAC,MAAM;QACLL,IAAI,CAACO,SAAS,GAAG,IAAID,IAAI,CAACJ,OAAO,CAAC;MACpC;IACF;IACA;IACA;IACA;IACA;IACA,OAAOF,IAAI;EACb;AACF"}
@@ -11,6 +11,8 @@ export class HMSPermissions {
11
11
  _defineProperty(this, "browserRecording", void 0);
12
12
  _defineProperty(this, "hlsStreaming", void 0);
13
13
  _defineProperty(this, "rtmpStreaming", void 0);
14
+ _defineProperty(this, "pollRead", void 0);
15
+ _defineProperty(this, "pollWrite", void 0);
14
16
  if (params) {
15
17
  this.endRoom = params.endRoom;
16
18
  this.removeOthers = params.removeOthers;
@@ -20,6 +22,8 @@ export class HMSPermissions {
20
22
  this.browserRecording = params.browserRecording;
21
23
  this.hlsStreaming = params.hlsStreaming;
22
24
  this.rtmpStreaming = params.rtmpStreaming;
25
+ this.pollRead = params.pollRead;
26
+ this.pollWrite = params.pollWrite;
23
27
  }
24
28
  }
25
29
  }
@@ -1 +1 @@
1
- {"version":3,"names":["HMSPermissions","constructor","params","_defineProperty","endRoom","removeOthers","unmute","mute","changeRole","browserRecording","hlsStreaming","rtmpStreaming"],"sources":["HMSPermissions.ts"],"sourcesContent":["export class HMSPermissions {\n endRoom?: boolean;\n removeOthers?: boolean;\n unmute?: boolean;\n mute?: boolean;\n changeRole?: boolean;\n browserRecording?: boolean;\n hlsStreaming?: boolean;\n rtmpStreaming?: boolean;\n\n constructor(params?: {\n endRoom?: boolean;\n removeOthers?: boolean;\n unmute?: boolean;\n mute?: boolean;\n changeRole?: boolean;\n browserRecording?: boolean;\n hlsStreaming?: boolean;\n rtmpStreaming?: boolean;\n }) {\n if (params) {\n this.endRoom = params.endRoom;\n this.removeOthers = params.removeOthers;\n this.unmute = params.unmute;\n this.mute = params.mute;\n this.changeRole = params.changeRole;\n this.browserRecording = params.browserRecording;\n this.hlsStreaming = params.hlsStreaming;\n this.rtmpStreaming = params.rtmpStreaming;\n }\n }\n}\n"],"mappings":";;;AAAA,OAAO,MAAMA,cAAc,CAAC;EAU1BC,WAAWA,CAACC,MASX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAID,MAAM,EAAE;MACV,IAAI,CAACE,OAAO,GAAGF,MAAM,CAACE,OAAO;MAC7B,IAAI,CAACC,YAAY,GAAGH,MAAM,CAACG,YAAY;MACvC,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;MAC3B,IAAI,CAACC,IAAI,GAAGL,MAAM,CAACK,IAAI;MACvB,IAAI,CAACC,UAAU,GAAGN,MAAM,CAACM,UAAU;MACnC,IAAI,CAACC,gBAAgB,GAAGP,MAAM,CAACO,gBAAgB;MAC/C,IAAI,CAACC,YAAY,GAAGR,MAAM,CAACQ,YAAY;MACvC,IAAI,CAACC,aAAa,GAAGT,MAAM,CAACS,aAAa;IAC3C;EACF;AACF"}
1
+ {"version":3,"names":["HMSPermissions","constructor","params","_defineProperty","endRoom","removeOthers","unmute","mute","changeRole","browserRecording","hlsStreaming","rtmpStreaming","pollRead","pollWrite"],"sources":["HMSPermissions.ts"],"sourcesContent":["export class HMSPermissions {\n endRoom?: boolean;\n removeOthers?: boolean;\n unmute?: boolean;\n mute?: boolean;\n changeRole?: boolean;\n browserRecording?: boolean;\n hlsStreaming?: boolean;\n rtmpStreaming?: boolean;\n pollRead?: boolean;\n pollWrite?: boolean;\n\n constructor(params?: {\n endRoom?: boolean;\n removeOthers?: boolean;\n unmute?: boolean;\n mute?: boolean;\n changeRole?: boolean;\n browserRecording?: boolean;\n hlsStreaming?: boolean;\n rtmpStreaming?: boolean;\n pollRead?: boolean;\n pollWrite?: boolean;\n }) {\n if (params) {\n this.endRoom = params.endRoom;\n this.removeOthers = params.removeOthers;\n this.unmute = params.unmute;\n this.mute = params.mute;\n this.changeRole = params.changeRole;\n this.browserRecording = params.browserRecording;\n this.hlsStreaming = params.hlsStreaming;\n this.rtmpStreaming = params.rtmpStreaming;\n this.pollRead = params.pollRead;\n this.pollWrite = params.pollWrite;\n }\n }\n}\n"],"mappings":";;;AAAA,OAAO,MAAMA,cAAc,CAAC;EAY1BC,WAAWA,CAACC,MAWX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAID,MAAM,EAAE;MACV,IAAI,CAACE,OAAO,GAAGF,MAAM,CAACE,OAAO;MAC7B,IAAI,CAACC,YAAY,GAAGH,MAAM,CAACG,YAAY;MACvC,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;MAC3B,IAAI,CAACC,IAAI,GAAGL,MAAM,CAACK,IAAI;MACvB,IAAI,CAACC,UAAU,GAAGN,MAAM,CAACM,UAAU;MACnC,IAAI,CAACC,gBAAgB,GAAGP,MAAM,CAACO,gBAAgB;MAC/C,IAAI,CAACC,YAAY,GAAGR,MAAM,CAACQ,YAAY;MACvC,IAAI,CAACC,aAAa,GAAGT,MAAM,CAACS,aAAa;MACzC,IAAI,CAACC,QAAQ,GAAGV,MAAM,CAACU,QAAQ;MAC/B,IAAI,CAACC,SAAS,GAAGX,MAAM,CAACW,SAAS;IACnC;EACF;AACF"}
@@ -0,0 +1,5 @@
1
+ export let HMSPollsListenerActions = /*#__PURE__*/function (HMSPollsListenerActions) {
2
+ HMSPollsListenerActions["ON_POLL_UPDATE"] = "ON_POLL_UPDATE";
3
+ return HMSPollsListenerActions;
4
+ }({});
5
+ //# sourceMappingURL=HMSPollsListenerActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HMSPollsListenerActions"],"sources":["HMSPollsListenerActions.ts"],"sourcesContent":["export enum HMSPollsListenerActions {\n ON_POLL_UPDATE = 'ON_POLL_UPDATE',\n}\n"],"mappings":"AAAA,WAAYA,uBAAuB,0BAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA"}
@@ -16,11 +16,13 @@ import { clearHmsRoomCache, getHmsRoomCache, HMSRoomCache, setHmsRoomCache } fro
16
16
  import { HMSPeerUpdate, HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
17
17
  import { HMSSessionStore } from './HMSSessionStore';
18
18
  import { HMSPeerListIterator } from './HMSPeerListIterator';
19
+ import { HMSInteractivityCenter } from './HMSInteractivityCenter';
19
20
  const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
20
21
  let HmsSdk;
21
22
  export class HMSSDK {
22
23
  constructor(id) {
23
24
  _defineProperty(this, "id", void 0);
25
+ _defineProperty(this, "_interactivityCenter", null);
24
26
  _defineProperty(this, "appStateSubscription", void 0);
25
27
  _defineProperty(this, "onPreviewDelegate", void 0);
26
28
  _defineProperty(this, "onJoinDelegate", void 0);
@@ -2158,6 +2160,12 @@ export class HMSSDK {
2158
2160
  id: this.id
2159
2161
  });
2160
2162
  }
2163
+ get interactivityCenter() {
2164
+ if (!this._interactivityCenter) {
2165
+ this._interactivityCenter = new HMSInteractivityCenter();
2166
+ }
2167
+ return this._interactivityCenter;
2168
+ }
2161
2169
 
2162
2170
  /**
2163
2171
  * - Returns the instance of logger which can be used to manipulate log levels.