@stream-io/video-react-native-sdk 0.0.1-alpha.141

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 (360) hide show
  1. package/CHANGELOG.md +739 -0
  2. package/LICENSE +219 -0
  3. package/README.md +19 -0
  4. package/dist/__tests__/components/ActiveCall.test.d.ts +1 -0
  5. package/dist/__tests__/components/ActiveCall.test.js +89 -0
  6. package/dist/__tests__/components/ActiveCall.test.js.map +1 -0
  7. package/dist/__tests__/components/Avatar.test.d.ts +1 -0
  8. package/dist/__tests__/components/Avatar.test.js +34 -0
  9. package/dist/__tests__/components/Avatar.test.js.map +1 -0
  10. package/dist/__tests__/components/ParticipantView.test.d.ts +1 -0
  11. package/dist/__tests__/components/ParticipantView.test.js +66 -0
  12. package/dist/__tests__/components/ParticipantView.test.js.map +1 -0
  13. package/dist/__tests__/mocks/call.d.ts +2 -0
  14. package/dist/__tests__/mocks/call.js +21 -0
  15. package/dist/__tests__/mocks/call.js.map +1 -0
  16. package/dist/__tests__/mocks/client.d.ts +2 -0
  17. package/dist/__tests__/mocks/client.js +31 -0
  18. package/dist/__tests__/mocks/client.js.map +1 -0
  19. package/dist/__tests__/mocks/participant.d.ts +3 -0
  20. package/dist/__tests__/mocks/participant.js +25 -0
  21. package/dist/__tests__/mocks/participant.js.map +1 -0
  22. package/dist/__tests__/utils/RNTLTools.d.ts +15 -0
  23. package/dist/__tests__/utils/RNTLTools.js +54 -0
  24. package/dist/__tests__/utils/RNTLTools.js.map +1 -0
  25. package/dist/index.d.ts +9 -0
  26. package/dist/index.js +39 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/jest-setup.d.ts +1 -0
  29. package/dist/jest-setup.js +34 -0
  30. package/dist/jest-setup.js.map +1 -0
  31. package/dist/src/components/ActiveCall.d.ts +18 -0
  32. package/dist/src/components/ActiveCall.js +117 -0
  33. package/dist/src/components/ActiveCall.js.map +1 -0
  34. package/dist/src/components/Avatar.d.ts +25 -0
  35. package/dist/src/components/Avatar.js +55 -0
  36. package/dist/src/components/Avatar.js.map +1 -0
  37. package/dist/src/components/CallControlsButton.d.ts +22 -0
  38. package/dist/src/components/CallControlsButton.js +43 -0
  39. package/dist/src/components/CallControlsButton.js.map +1 -0
  40. package/dist/src/components/CallControlsView.d.ts +9 -0
  41. package/dist/src/components/CallControlsView.js +95 -0
  42. package/dist/src/components/CallControlsView.js.map +1 -0
  43. package/dist/src/components/CallParticipantsBadge.d.ts +1 -0
  44. package/dist/src/components/CallParticipantsBadge.js +48 -0
  45. package/dist/src/components/CallParticipantsBadge.js.map +1 -0
  46. package/dist/src/components/CallParticipantsInfoView.d.ts +21 -0
  47. package/dist/src/components/CallParticipantsInfoView.js +213 -0
  48. package/dist/src/components/CallParticipantsInfoView.js.map +1 -0
  49. package/dist/src/components/CallParticipantsList.d.ts +25 -0
  50. package/dist/src/components/CallParticipantsList.js +124 -0
  51. package/dist/src/components/CallParticipantsList.js.map +1 -0
  52. package/dist/src/components/CallParticipantsOptions.d.ts +8 -0
  53. package/dist/src/components/CallParticipantsOptions.js +189 -0
  54. package/dist/src/components/CallParticipantsOptions.js.map +1 -0
  55. package/dist/src/components/CallParticipantsSpotlightView.d.ts +1 -0
  56. package/dist/src/components/CallParticipantsSpotlightView.js +40 -0
  57. package/dist/src/components/CallParticipantsSpotlightView.js.map +1 -0
  58. package/dist/src/components/CallParticipantsView.d.ts +1 -0
  59. package/dist/src/components/CallParticipantsView.js +31 -0
  60. package/dist/src/components/CallParticipantsView.js.map +1 -0
  61. package/dist/src/components/IncomingCallView.d.ts +1 -0
  62. package/dist/src/components/IncomingCallView.js +98 -0
  63. package/dist/src/components/IncomingCallView.js.map +1 -0
  64. package/dist/src/components/LobbyView.d.ts +1 -0
  65. package/dist/src/components/LobbyView.js +215 -0
  66. package/dist/src/components/LobbyView.js.map +1 -0
  67. package/dist/src/components/LocalVideoView.d.ts +34 -0
  68. package/dist/src/components/LocalVideoView.js +100 -0
  69. package/dist/src/components/LocalVideoView.js.map +1 -0
  70. package/dist/src/components/NetworkQualityIndicator.d.ts +8 -0
  71. package/dist/src/components/NetworkQualityIndicator.js +36 -0
  72. package/dist/src/components/NetworkQualityIndicator.js.map +1 -0
  73. package/dist/src/components/OutgoingCallView.d.ts +1 -0
  74. package/dist/src/components/OutgoingCallView.js +103 -0
  75. package/dist/src/components/OutgoingCallView.js.map +1 -0
  76. package/dist/src/components/ParticipantReaction.d.ts +7 -0
  77. package/dist/src/components/ParticipantReaction.js +45 -0
  78. package/dist/src/components/ParticipantReaction.js.map +1 -0
  79. package/dist/src/components/ParticipantView.d.ts +42 -0
  80. package/dist/src/components/ParticipantView.js +256 -0
  81. package/dist/src/components/ParticipantView.js.map +1 -0
  82. package/dist/src/components/ReactionsModal.d.ts +7 -0
  83. package/dist/src/components/ReactionsModal.js +65 -0
  84. package/dist/src/components/ReactionsModal.js.map +1 -0
  85. package/dist/src/components/ToggleAudioButton.d.ts +1 -0
  86. package/dist/src/components/ToggleAudioButton.js +78 -0
  87. package/dist/src/components/ToggleAudioButton.js.map +1 -0
  88. package/dist/src/components/ToggleVideoButton.d.ts +1 -0
  89. package/dist/src/components/ToggleVideoButton.js +78 -0
  90. package/dist/src/components/ToggleVideoButton.js.map +1 -0
  91. package/dist/src/components/UserInfoView.d.ts +13 -0
  92. package/dist/src/components/UserInfoView.js +82 -0
  93. package/dist/src/components/UserInfoView.js.map +1 -0
  94. package/dist/src/components/VideoRenderer.d.ts +65 -0
  95. package/dist/src/components/VideoRenderer.js +18 -0
  96. package/dist/src/components/VideoRenderer.js.map +1 -0
  97. package/dist/src/components/index.d.ts +12 -0
  98. package/dist/src/components/index.js +29 -0
  99. package/dist/src/components/index.js.map +1 -0
  100. package/dist/src/constants/A11yLabels.d.ts +20 -0
  101. package/dist/src/constants/A11yLabels.js +29 -0
  102. package/dist/src/constants/A11yLabels.js.map +1 -0
  103. package/dist/src/constants/index.d.ts +11 -0
  104. package/dist/src/constants/index.js +30 -0
  105. package/dist/src/constants/index.js.map +1 -0
  106. package/dist/src/contexts/StreamVideoContext/createStoreContext.d.ts +14 -0
  107. package/dist/src/contexts/StreamVideoContext/createStoreContext.js +100 -0
  108. package/dist/src/contexts/StreamVideoContext/createStoreContext.js.map +1 -0
  109. package/dist/src/contexts/StreamVideoContext/index.d.ts +30 -0
  110. package/dist/src/contexts/StreamVideoContext/index.js +18 -0
  111. package/dist/src/contexts/StreamVideoContext/index.js.map +1 -0
  112. package/dist/src/contexts/index.d.ts +1 -0
  113. package/dist/src/contexts/index.js +18 -0
  114. package/dist/src/contexts/index.js.map +1 -0
  115. package/dist/src/hooks/index.d.ts +10 -0
  116. package/dist/src/hooks/index.js +27 -0
  117. package/dist/src/hooks/index.js.map +1 -0
  118. package/dist/src/hooks/useCallControls.d.ts +14 -0
  119. package/dist/src/hooks/useCallControls.js +148 -0
  120. package/dist/src/hooks/useCallControls.js.map +1 -0
  121. package/dist/src/hooks/useCallCycleEffect.d.ts +8 -0
  122. package/dist/src/hooks/useCallCycleEffect.js +62 -0
  123. package/dist/src/hooks/useCallCycleEffect.js.map +1 -0
  124. package/dist/src/hooks/useCallKeep.d.ts +11 -0
  125. package/dist/src/hooks/useCallKeep.js +41 -0
  126. package/dist/src/hooks/useCallKeep.js.map +1 -0
  127. package/dist/src/hooks/useCreateStreamVideoClient.d.ts +33 -0
  128. package/dist/src/hooks/useCreateStreamVideoClient.js +40 -0
  129. package/dist/src/hooks/useCreateStreamVideoClient.js.map +1 -0
  130. package/dist/src/hooks/useIncallManager.d.ts +13 -0
  131. package/dist/src/hooks/useIncallManager.js +24 -0
  132. package/dist/src/hooks/useIncallManager.js.map +1 -0
  133. package/dist/src/hooks/useLocalVideoStream.d.ts +7 -0
  134. package/dist/src/hooks/useLocalVideoStream.js +34 -0
  135. package/dist/src/hooks/useLocalVideoStream.js.map +1 -0
  136. package/dist/src/hooks/useMutingState.d.ts +12 -0
  137. package/dist/src/hooks/useMutingState.js +25 -0
  138. package/dist/src/hooks/useMutingState.js.map +1 -0
  139. package/dist/src/hooks/usePermissionNotification.d.ts +18 -0
  140. package/dist/src/hooks/usePermissionNotification.js +33 -0
  141. package/dist/src/hooks/usePermissionNotification.js.map +1 -0
  142. package/dist/src/hooks/usePermissionRequest.d.ts +1 -0
  143. package/dist/src/hooks/usePermissionRequest.js +62 -0
  144. package/dist/src/hooks/usePermissionRequest.js.map +1 -0
  145. package/dist/src/hooks/usePublishMediaStreams.d.ts +6 -0
  146. package/dist/src/hooks/usePublishMediaStreams.js +49 -0
  147. package/dist/src/hooks/usePublishMediaStreams.js.map +1 -0
  148. package/dist/src/icons/ArrowRight.d.ts +5 -0
  149. package/dist/src/icons/ArrowRight.js +9 -0
  150. package/dist/src/icons/ArrowRight.js.map +1 -0
  151. package/dist/src/icons/CameraSwitch.d.ts +5 -0
  152. package/dist/src/icons/CameraSwitch.js +9 -0
  153. package/dist/src/icons/CameraSwitch.js.map +1 -0
  154. package/dist/src/icons/Chat.d.ts +5 -0
  155. package/dist/src/icons/Chat.js +9 -0
  156. package/dist/src/icons/Chat.js.map +1 -0
  157. package/dist/src/icons/Cross.d.ts +5 -0
  158. package/dist/src/icons/Cross.js +9 -0
  159. package/dist/src/icons/Cross.js.map +1 -0
  160. package/dist/src/icons/Mic.d.ts +5 -0
  161. package/dist/src/icons/Mic.js +10 -0
  162. package/dist/src/icons/Mic.js.map +1 -0
  163. package/dist/src/icons/MicOff.d.ts +5 -0
  164. package/dist/src/icons/MicOff.js +9 -0
  165. package/dist/src/icons/MicOff.js.map +1 -0
  166. package/dist/src/icons/Participants.d.ts +5 -0
  167. package/dist/src/icons/Participants.js +9 -0
  168. package/dist/src/icons/Participants.js.map +1 -0
  169. package/dist/src/icons/Phone.d.ts +5 -0
  170. package/dist/src/icons/Phone.js +9 -0
  171. package/dist/src/icons/Phone.js.map +1 -0
  172. package/dist/src/icons/PhoneDown.d.ts +5 -0
  173. package/dist/src/icons/PhoneDown.js +10 -0
  174. package/dist/src/icons/PhoneDown.js.map +1 -0
  175. package/dist/src/icons/Pin.d.ts +5 -0
  176. package/dist/src/icons/Pin.js +9 -0
  177. package/dist/src/icons/Pin.js.map +1 -0
  178. package/dist/src/icons/Reaction.d.ts +5 -0
  179. package/dist/src/icons/Reaction.js +9 -0
  180. package/dist/src/icons/Reaction.js.map +1 -0
  181. package/dist/src/icons/ScreenShare.d.ts +5 -0
  182. package/dist/src/icons/ScreenShare.js +40 -0
  183. package/dist/src/icons/ScreenShare.js.map +1 -0
  184. package/dist/src/icons/Settings.d.ts +5 -0
  185. package/dist/src/icons/Settings.js +34 -0
  186. package/dist/src/icons/Settings.js.map +1 -0
  187. package/dist/src/icons/Spotlight.d.ts +5 -0
  188. package/dist/src/icons/Spotlight.js +9 -0
  189. package/dist/src/icons/Spotlight.js.map +1 -0
  190. package/dist/src/icons/ThreeDots.d.ts +5 -0
  191. package/dist/src/icons/ThreeDots.js +11 -0
  192. package/dist/src/icons/ThreeDots.js.map +1 -0
  193. package/dist/src/icons/Video.d.ts +5 -0
  194. package/dist/src/icons/Video.js +9 -0
  195. package/dist/src/icons/Video.js.map +1 -0
  196. package/dist/src/icons/VideoDisabled.d.ts +5 -0
  197. package/dist/src/icons/VideoDisabled.js +10 -0
  198. package/dist/src/icons/VideoDisabled.js.map +1 -0
  199. package/dist/src/icons/VideoOff.d.ts +5 -0
  200. package/dist/src/icons/VideoOff.js +10 -0
  201. package/dist/src/icons/VideoOff.js.map +1 -0
  202. package/dist/src/icons/VideoSlash.d.ts +5 -0
  203. package/dist/src/icons/VideoSlash.js +10 -0
  204. package/dist/src/icons/VideoSlash.js.map +1 -0
  205. package/dist/src/icons/index.d.ts +19 -0
  206. package/dist/src/icons/index.js +36 -0
  207. package/dist/src/icons/index.js.map +1 -0
  208. package/dist/src/providers/MediaDevices.d.ts +9 -0
  209. package/dist/src/providers/MediaDevices.js +43 -0
  210. package/dist/src/providers/MediaDevices.js.map +1 -0
  211. package/dist/src/providers/StreamCall.d.ts +81 -0
  212. package/dist/src/providers/StreamCall.js +74 -0
  213. package/dist/src/providers/StreamCall.js.map +1 -0
  214. package/dist/src/providers/StreamVideo.d.ts +10 -0
  215. package/dist/src/providers/StreamVideo.js +66 -0
  216. package/dist/src/providers/StreamVideo.js.map +1 -0
  217. package/dist/src/providers/index.d.ts +2 -0
  218. package/dist/src/providers/index.js +19 -0
  219. package/dist/src/providers/index.js.map +1 -0
  220. package/dist/src/theme/avatar.d.ts +2 -0
  221. package/dist/src/theme/avatar.js +11 -0
  222. package/dist/src/theme/avatar.js.map +1 -0
  223. package/dist/src/theme/button.d.ts +2 -0
  224. package/dist/src/theme/button.js +11 -0
  225. package/dist/src/theme/button.js.map +1 -0
  226. package/dist/src/theme/colors.d.ts +3 -0
  227. package/dist/src/theme/colors.js +49 -0
  228. package/dist/src/theme/colors.js.map +1 -0
  229. package/dist/src/theme/constants.d.ts +47 -0
  230. package/dist/src/theme/constants.js +54 -0
  231. package/dist/src/theme/constants.js.map +1 -0
  232. package/dist/src/theme/fonts.d.ts +2 -0
  233. package/dist/src/theme/fonts.js +67 -0
  234. package/dist/src/theme/fonts.js.map +1 -0
  235. package/dist/src/theme/icon.d.ts +2 -0
  236. package/dist/src/theme/icon.js +11 -0
  237. package/dist/src/theme/icon.js.map +1 -0
  238. package/dist/src/theme/index.d.ts +2 -0
  239. package/dist/src/theme/index.js +26 -0
  240. package/dist/src/theme/index.js.map +1 -0
  241. package/dist/src/theme/margin.d.ts +2 -0
  242. package/dist/src/theme/margin.js +11 -0
  243. package/dist/src/theme/margin.js.map +1 -0
  244. package/dist/src/theme/padding.d.ts +2 -0
  245. package/dist/src/theme/padding.js +11 -0
  246. package/dist/src/theme/padding.js.map +1 -0
  247. package/dist/src/theme/rounded.d.ts +2 -0
  248. package/dist/src/theme/rounded.js +11 -0
  249. package/dist/src/theme/rounded.js.map +1 -0
  250. package/dist/src/theme/spacing.d.ts +2 -0
  251. package/dist/src/theme/spacing.js +11 -0
  252. package/dist/src/theme/spacing.js.map +1 -0
  253. package/dist/src/theme/types.d.ts +45 -0
  254. package/dist/src/theme/types.js +3 -0
  255. package/dist/src/theme/types.js.map +1 -0
  256. package/dist/src/utils/StreamVideoRN.d.ts +25 -0
  257. package/dist/src/utils/StreamVideoRN.js +23 -0
  258. package/dist/src/utils/StreamVideoRN.js.map +1 -0
  259. package/dist/src/utils/hooks/index.d.ts +3 -0
  260. package/dist/src/utils/hooks/index.js +20 -0
  261. package/dist/src/utils/hooks/index.js.map +1 -0
  262. package/dist/src/utils/hooks/useAppStateListener.d.ts +1 -0
  263. package/dist/src/utils/hooks/useAppStateListener.js +41 -0
  264. package/dist/src/utils/hooks/useAppStateListener.js.map +1 -0
  265. package/dist/src/utils/hooks/useDebouncedValue.d.ts +7 -0
  266. package/dist/src/utils/hooks/useDebouncedValue.js +22 -0
  267. package/dist/src/utils/hooks/useDebouncedValue.js.map +1 -0
  268. package/dist/src/utils/hooks/usePrevious.d.ts +1 -0
  269. package/dist/src/utils/hooks/usePrevious.js +13 -0
  270. package/dist/src/utils/hooks/usePrevious.js.map +1 -0
  271. package/dist/src/utils/index.d.ts +5 -0
  272. package/dist/src/utils/index.js +53 -0
  273. package/dist/src/utils/index.js.map +1 -0
  274. package/dist/src/utils/verifyAndroidBluetoothPermissions.d.ts +1 -0
  275. package/dist/src/utils/verifyAndroidBluetoothPermissions.js +30 -0
  276. package/dist/src/utils/verifyAndroidBluetoothPermissions.js.map +1 -0
  277. package/index.ts +22 -0
  278. package/package.json +70 -0
  279. package/src/components/ActiveCall.tsx +122 -0
  280. package/src/components/Avatar.tsx +88 -0
  281. package/src/components/CallControlsButton.tsx +72 -0
  282. package/src/components/CallControlsView.tsx +128 -0
  283. package/src/components/CallParticipantsBadge.tsx +57 -0
  284. package/src/components/CallParticipantsInfoView.tsx +287 -0
  285. package/src/components/CallParticipantsList.tsx +172 -0
  286. package/src/components/CallParticipantsOptions.tsx +248 -0
  287. package/src/components/CallParticipantsSpotlightView.tsx +53 -0
  288. package/src/components/CallParticipantsView.tsx +30 -0
  289. package/src/components/IncomingCallView.tsx +133 -0
  290. package/src/components/LobbyView.tsx +236 -0
  291. package/src/components/LocalVideoView.tsx +141 -0
  292. package/src/components/NetworkQualityIndicator.tsx +72 -0
  293. package/src/components/OutgoingCallView.tsx +133 -0
  294. package/src/components/ParticipantReaction.tsx +59 -0
  295. package/src/components/ParticipantView.tsx +315 -0
  296. package/src/components/ReactionsModal.tsx +90 -0
  297. package/src/components/ToggleAudioButton.tsx +103 -0
  298. package/src/components/ToggleVideoButton.tsx +103 -0
  299. package/src/components/UserInfoView.tsx +118 -0
  300. package/src/components/VideoRenderer.tsx +85 -0
  301. package/src/components/index.ts +12 -0
  302. package/src/constants/A11yLabels.ts +24 -0
  303. package/src/constants/index.ts +28 -0
  304. package/src/contexts/StreamVideoContext/createStoreContext.tsx +117 -0
  305. package/src/contexts/StreamVideoContext/index.tsx +37 -0
  306. package/src/contexts/index.ts +1 -0
  307. package/src/hooks/index.ts +10 -0
  308. package/src/hooks/useCallControls.tsx +186 -0
  309. package/src/hooks/useCallCycleEffect.tsx +68 -0
  310. package/src/hooks/useCallKeep.tsx +51 -0
  311. package/src/hooks/useCreateStreamVideoClient.tsx +77 -0
  312. package/src/hooks/useIncallManager.tsx +23 -0
  313. package/src/hooks/useLocalVideoStream.ts +36 -0
  314. package/src/hooks/useMutingState.ts +24 -0
  315. package/src/hooks/usePermissionNotification.tsx +53 -0
  316. package/src/hooks/usePermissionRequest.tsx +67 -0
  317. package/src/hooks/usePublishMediaStreams.ts +59 -0
  318. package/src/icons/ArrowRight.tsx +16 -0
  319. package/src/icons/CameraSwitch.tsx +14 -0
  320. package/src/icons/Chat.tsx +14 -0
  321. package/src/icons/Cross.tsx +14 -0
  322. package/src/icons/Mic.tsx +18 -0
  323. package/src/icons/MicOff.tsx +14 -0
  324. package/src/icons/Participants.tsx +16 -0
  325. package/src/icons/Phone.tsx +14 -0
  326. package/src/icons/PhoneDown.tsx +15 -0
  327. package/src/icons/Pin.tsx +16 -0
  328. package/src/icons/Reaction.tsx +14 -0
  329. package/src/icons/ScreenShare.tsx +32 -0
  330. package/src/icons/Settings.tsx +13 -0
  331. package/src/icons/Spotlight.tsx +16 -0
  332. package/src/icons/ThreeDots.tsx +13 -0
  333. package/src/icons/Video.tsx +14 -0
  334. package/src/icons/VideoDisabled.tsx +22 -0
  335. package/src/icons/VideoOff.tsx +20 -0
  336. package/src/icons/VideoSlash.tsx +15 -0
  337. package/src/icons/index.tsx +19 -0
  338. package/src/providers/MediaDevices.tsx +45 -0
  339. package/src/providers/StreamCall.tsx +136 -0
  340. package/src/providers/StreamVideo.tsx +50 -0
  341. package/src/providers/index.ts +2 -0
  342. package/src/theme/avatar.ts +9 -0
  343. package/src/theme/button.ts +9 -0
  344. package/src/theme/colors.ts +49 -0
  345. package/src/theme/constants.ts +51 -0
  346. package/src/theme/fonts.ts +65 -0
  347. package/src/theme/icon.ts +9 -0
  348. package/src/theme/index.ts +25 -0
  349. package/src/theme/margin.ts +9 -0
  350. package/src/theme/padding.ts +9 -0
  351. package/src/theme/rounded.ts +9 -0
  352. package/src/theme/spacing.ts +9 -0
  353. package/src/theme/types.ts +64 -0
  354. package/src/utils/StreamVideoRN.ts +35 -0
  355. package/src/utils/hooks/index.ts +3 -0
  356. package/src/utils/hooks/useAppStateListener.ts +48 -0
  357. package/src/utils/hooks/useDebouncedValue.ts +21 -0
  358. package/src/utils/hooks/usePrevious.ts +11 -0
  359. package/src/utils/index.ts +45 -0
  360. package/src/utils/verifyAndroidBluetoothPermissions.ts +31 -0
@@ -0,0 +1,53 @@
1
+ import { SfuModels, StreamVideoParticipant } from '@stream-io/video-client';
2
+ import { useParticipants } from '@stream-io/video-react-bindings';
3
+ import { StyleSheet, View } from 'react-native';
4
+ import { ParticipantView } from './ParticipantView';
5
+ import { theme } from '../theme';
6
+ import { useDebouncedValue } from '../utils/hooks/useDebouncedValue';
7
+ import { CallParticipantsList } from './CallParticipantsList';
8
+ import { speakerLayoutSortPreset } from '@stream-io/video-client';
9
+
10
+ const hasScreenShare = (p: StreamVideoParticipant) =>
11
+ p.publishedTracks.includes(SfuModels.TrackType.SCREEN_SHARE);
12
+
13
+ export const CallParticipantsSpotlightView = () => {
14
+ const _allParticipants = useParticipants({
15
+ sortBy: speakerLayoutSortPreset,
16
+ });
17
+ const allParticipants = useDebouncedValue(_allParticipants, 300); // we debounce the participants to avoid unnecessary rerenders that happen when participant tracks are all subscribed simultaneously
18
+ const [participantInSpotlight, ...otherParticipants] = allParticipants;
19
+ const isScreenShareOnSpotlight = hasScreenShare(participantInSpotlight);
20
+
21
+ return (
22
+ <View style={styles.container}>
23
+ {participantInSpotlight && (
24
+ <ParticipantView
25
+ participant={participantInSpotlight}
26
+ containerStyle={styles.participantView}
27
+ kind={isScreenShareOnSpotlight ? 'screen' : 'video'}
28
+ />
29
+ )}
30
+ <View style={styles.participantVideoContainer}>
31
+ <CallParticipantsList
32
+ participants={
33
+ isScreenShareOnSpotlight ? allParticipants : otherParticipants
34
+ }
35
+ horizontal
36
+ />
37
+ </View>
38
+ </View>
39
+ );
40
+ };
41
+
42
+ const styles = StyleSheet.create({
43
+ container: { flex: 1 },
44
+ participantView: {
45
+ flex: 1,
46
+ overflow: 'hidden',
47
+ borderRadius: theme.rounded.sm,
48
+ marginHorizontal: theme.padding.sm,
49
+ },
50
+ participantVideoContainer: {
51
+ paddingVertical: theme.padding.sm,
52
+ },
53
+ });
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { LocalVideoView } from './LocalVideoView';
4
+ import { useRemoteParticipants } from '@stream-io/video-react-bindings';
5
+ import { useDebouncedValue } from '../utils/hooks/useDebouncedValue';
6
+ import { CallParticipantsList } from './CallParticipantsList';
7
+
8
+ export const CallParticipantsView = () => {
9
+ const _remoteParticipants = useRemoteParticipants();
10
+ const remoteParticipants = useDebouncedValue(_remoteParticipants, 300); // we debounce the remote participants to avoid unnecessary rerenders that happen when participant tracks are all subscribed simultaneously
11
+
12
+ const isUserAloneInCall = remoteParticipants?.length === 0;
13
+
14
+ if (isUserAloneInCall) {
15
+ return <LocalVideoView layout={'fullscreen'} />;
16
+ }
17
+
18
+ return (
19
+ <View style={styles.container}>
20
+ <LocalVideoView layout={'floating'} zOrder={2} />
21
+ <CallParticipantsList participants={remoteParticipants} />
22
+ </View>
23
+ );
24
+ };
25
+
26
+ const styles = StyleSheet.create({
27
+ container: {
28
+ flex: 1,
29
+ },
30
+ });
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import { ImageBackground, StyleSheet, Text, View } from 'react-native';
3
+ import { CallControlsButton } from './CallControlsButton';
4
+ import {
5
+ useCall,
6
+ useCallCallingState,
7
+ useCallMembers,
8
+ useConnectedUser,
9
+ } from '@stream-io/video-react-bindings';
10
+ import { UserInfoView } from './UserInfoView';
11
+ import { Phone, PhoneDown, Video, VideoSlash } from '../icons';
12
+ import { theme } from '../theme';
13
+ import { useMutingState } from '../hooks/useMutingState';
14
+ import { CallingState, UserResponse } from '@stream-io/video-client';
15
+
16
+ export const IncomingCallView = () => {
17
+ const { isVideoMuted, toggleVideoState } = useMutingState();
18
+ const call = useCall();
19
+ const callingState = useCallCallingState();
20
+
21
+ const answerCallHandler = async () => {
22
+ try {
23
+ await call?.join();
24
+ } catch (error) {
25
+ console.log('Error joining Call', error);
26
+ }
27
+ };
28
+
29
+ const rejectCallHandler = async () => {
30
+ try {
31
+ if (callingState === CallingState.LEFT) return;
32
+ await call?.leave({ reject: true });
33
+ } catch (error) {
34
+ console.log('Error leaving Call', error);
35
+ }
36
+ };
37
+
38
+ return (
39
+ <Background>
40
+ <View style={styles.content}>
41
+ <UserInfoView />
42
+ <Text style={styles.incomingCallText}>Incoming Call...</Text>
43
+ </View>
44
+
45
+ <View style={styles.buttonGroup}>
46
+ <CallControlsButton
47
+ onPress={rejectCallHandler}
48
+ color={theme.light.error}
49
+ style={[styles.button, theme.button.lg]}
50
+ svgContainerStyle={[styles.svgContainerStyle, theme.icon.lg]}
51
+ >
52
+ <PhoneDown color={theme.light.static_white} />
53
+ </CallControlsButton>
54
+ <CallControlsButton
55
+ onPress={toggleVideoState}
56
+ color={
57
+ !isVideoMuted ? theme.light.static_white : theme.light.overlay_dark
58
+ }
59
+ style={[styles.button, theme.button.lg]}
60
+ svgContainerStyle={[styles.svgContainerStyle, theme.icon.lg]}
61
+ >
62
+ {isVideoMuted ? (
63
+ <VideoSlash color={theme.light.static_white} />
64
+ ) : (
65
+ <Video color={theme.light.static_black} />
66
+ )}
67
+ </CallControlsButton>
68
+ <CallControlsButton
69
+ onPress={answerCallHandler}
70
+ color={theme.light.info}
71
+ style={[styles.button, theme.button.lg]}
72
+ svgContainerStyle={[styles.svgContainerStyle, theme.icon.lg]}
73
+ >
74
+ <Phone color={theme.light.static_white} />
75
+ </CallControlsButton>
76
+ </View>
77
+ </Background>
78
+ );
79
+ };
80
+
81
+ const Background: React.FunctionComponent<{ children: React.ReactNode }> = ({
82
+ children,
83
+ }) => {
84
+ const connectedUser = useConnectedUser();
85
+ const members = useCallMembers();
86
+ const includeSelf = false;
87
+
88
+ // take the first N members to show their avatars
89
+ const membersToShow: UserResponse[] = (members || [])
90
+ .map(({ user }) => user)
91
+ .filter((user) => user.id !== connectedUser?.id || includeSelf);
92
+
93
+ if (members.length) {
94
+ return (
95
+ <ImageBackground
96
+ blurRadius={10}
97
+ source={{
98
+ uri: membersToShow[0].image,
99
+ }}
100
+ style={[StyleSheet.absoluteFill, styles.background]}
101
+ >
102
+ {children}
103
+ </ImageBackground>
104
+ );
105
+ }
106
+ return (
107
+ <View style={[StyleSheet.absoluteFill, styles.background]}>{children}</View>
108
+ );
109
+ };
110
+
111
+ const styles = StyleSheet.create({
112
+ background: {
113
+ backgroundColor: theme.light.static_grey,
114
+ display: 'flex',
115
+ flexDirection: 'column',
116
+ justifyContent: 'space-between',
117
+ paddingVertical: 2 * theme.margin.xl,
118
+ },
119
+ content: {},
120
+ incomingCallText: {
121
+ marginTop: theme.margin.md,
122
+ textAlign: 'center',
123
+ color: theme.light.static_white,
124
+ ...theme.fonts.heading6,
125
+ },
126
+ buttonGroup: {
127
+ flexDirection: 'row',
128
+ justifyContent: 'space-between',
129
+ paddingHorizontal: theme.padding.xl,
130
+ },
131
+ button: {},
132
+ svgContainerStyle: {},
133
+ });
@@ -0,0 +1,236 @@
1
+ import React, { useCallback } from 'react';
2
+ import { Alert, Pressable, StyleSheet, Text, View } from 'react-native';
3
+ import { Mic, MicOff, Video, VideoSlash } from '../icons';
4
+ import {
5
+ useCall,
6
+ useConnectedUser,
7
+ useParticipantCount,
8
+ } from '@stream-io/video-react-bindings';
9
+ import { useStreamVideoStoreValue } from '../contexts/StreamVideoContext';
10
+ import { CallControlsButton } from './CallControlsButton';
11
+ import { theme } from '../theme';
12
+ import { useMutingState } from '../hooks/useMutingState';
13
+ import { useLocalVideoStream } from '../hooks';
14
+ import { VideoRenderer } from './VideoRenderer';
15
+ import { Avatar } from './Avatar';
16
+ import { AxiosError, StreamVideoParticipant } from '@stream-io/video-client';
17
+ import { LOCAL_VIDEO_VIEW_STYLE } from '../constants';
18
+
19
+ const ParticipantStatus = () => {
20
+ const connectedUser = useConnectedUser();
21
+ const { isAudioMuted, isVideoMuted } = useMutingState();
22
+ return (
23
+ <View style={styles.status}>
24
+ <Text style={styles.userNameLabel} numberOfLines={1}>
25
+ {connectedUser?.id}
26
+ </Text>
27
+ {isAudioMuted && (
28
+ <View style={[styles.svgContainerStyle, theme.icon.xs]}>
29
+ <MicOff color={theme.light.error} />
30
+ </View>
31
+ )}
32
+ {isVideoMuted && (
33
+ <View style={[styles.svgContainerStyle, theme.icon.xs]}>
34
+ <VideoSlash color={theme.light.error} />
35
+ </View>
36
+ )}
37
+ </View>
38
+ );
39
+ };
40
+
41
+ export const LobbyView = () => {
42
+ const localVideoStream = useLocalVideoStream();
43
+ const connectedUser = useConnectedUser();
44
+ const { isAudioMuted, isVideoMuted, toggleAudioState, toggleVideoState } =
45
+ useMutingState();
46
+ const isCameraOnFrontFacingMode = useStreamVideoStoreValue(
47
+ (store) => store.isCameraOnFrontFacingMode,
48
+ );
49
+ const isVideoAvailable = !!localVideoStream && !isVideoMuted;
50
+ const count = useParticipantCount();
51
+ const call = useCall();
52
+
53
+ const MicIcon = isAudioMuted ? (
54
+ <MicOff color={theme.light.static_white} />
55
+ ) : (
56
+ <Mic color={theme.light.static_black} />
57
+ );
58
+ const VideoIcon = isVideoMuted ? (
59
+ <VideoSlash color={theme.light.static_white} />
60
+ ) : (
61
+ <Video color={theme.light.static_black} />
62
+ );
63
+
64
+ const onJoinCallHandler = useCallback(async () => {
65
+ try {
66
+ await call?.join({ create: true });
67
+ } catch (error) {
68
+ console.log('Error joining call:', error);
69
+ if (error instanceof AxiosError) {
70
+ Alert.alert(error.response?.data.message);
71
+ }
72
+ }
73
+ }, [call]);
74
+
75
+ const connectedUserAsParticipant = {
76
+ userId: connectedUser?.id,
77
+ image: connectedUser?.image,
78
+ name: connectedUser?.name,
79
+ } as StreamVideoParticipant;
80
+
81
+ const muteStatusColor = (status: boolean) => {
82
+ return !status ? theme.light.static_white : theme.light.static_black;
83
+ };
84
+
85
+ return (
86
+ <View style={styles.container}>
87
+ <View style={styles.content}>
88
+ {connectedUser && (
89
+ <>
90
+ <Text style={styles.heading}>Before Joining</Text>
91
+ <Text style={styles.subHeading}>Setup your audio and video</Text>
92
+ <View style={styles.videoView}>
93
+ <View style={styles.topView} />
94
+ {isVideoAvailable ? (
95
+ <VideoRenderer
96
+ mirror={isCameraOnFrontFacingMode}
97
+ mediaStream={localVideoStream}
98
+ objectFit="cover"
99
+ style={StyleSheet.absoluteFillObject}
100
+ />
101
+ ) : (
102
+ <Avatar participant={connectedUserAsParticipant} />
103
+ )}
104
+ <ParticipantStatus />
105
+ </View>
106
+ <View style={styles.buttonGroup}>
107
+ <CallControlsButton
108
+ onPress={toggleAudioState}
109
+ color={muteStatusColor(isAudioMuted)}
110
+ style={[
111
+ styles.button,
112
+ theme.button.md,
113
+ {
114
+ shadowColor: muteStatusColor(isAudioMuted),
115
+ },
116
+ ]}
117
+ >
118
+ {MicIcon}
119
+ </CallControlsButton>
120
+ <CallControlsButton
121
+ onPress={toggleVideoState}
122
+ color={muteStatusColor(isVideoMuted)}
123
+ style={[
124
+ styles.button,
125
+ theme.button.md,
126
+ {
127
+ shadowColor: muteStatusColor(isVideoMuted),
128
+ },
129
+ ]}
130
+ >
131
+ {VideoIcon}
132
+ </CallControlsButton>
133
+ </View>
134
+ </>
135
+ )}
136
+ <View style={styles.info}>
137
+ <Text style={styles.infoText}>
138
+ You are about to join a call with id {call?.id} at Stream.{' '}
139
+ {count
140
+ ? `${count} more people are in the call now.`
141
+ : 'You are first to Join the call.'}
142
+ </Text>
143
+ <Pressable style={styles.joinButton} onPress={onJoinCallHandler}>
144
+ <Text style={styles.joinButtonText}>Join</Text>
145
+ </Pressable>
146
+ </View>
147
+ </View>
148
+ </View>
149
+ );
150
+ };
151
+
152
+ const styles = StyleSheet.create({
153
+ container: {
154
+ flex: 1,
155
+ backgroundColor: theme.light.static_grey,
156
+ justifyContent: 'center',
157
+ },
158
+ content: {
159
+ alignItems: 'center',
160
+ paddingHorizontal: theme.padding.md,
161
+ },
162
+ heading: {
163
+ color: theme.light.static_white,
164
+ ...theme.fonts.heading4,
165
+ },
166
+ subHeading: {
167
+ color: theme.light.text_low_emphasis,
168
+ ...theme.fonts.subtitle,
169
+ marginBottom: theme.margin.sm,
170
+ },
171
+ videoView: {
172
+ backgroundColor: theme.light.disabled,
173
+ height: LOCAL_VIDEO_VIEW_STYLE.height * 2,
174
+ borderRadius: LOCAL_VIDEO_VIEW_STYLE.borderRadius * 2,
175
+ justifyContent: 'space-between',
176
+ alignItems: 'center',
177
+ overflow: 'hidden',
178
+ marginVertical: theme.margin.md,
179
+ width: '100%',
180
+ padding: theme.padding.sm,
181
+ },
182
+ topView: {},
183
+ buttonGroup: {
184
+ flexDirection: 'row',
185
+ justifyContent: 'center',
186
+ marginBottom: theme.margin.md,
187
+ },
188
+ button: {
189
+ marginHorizontal: theme.margin.sm,
190
+ },
191
+ info: {
192
+ backgroundColor: theme.light.static_overlay,
193
+ padding: theme.padding.md,
194
+ borderRadius: theme.rounded.sm,
195
+ width: '100%',
196
+ },
197
+ infoText: {
198
+ color: theme.light.static_white,
199
+ ...theme.fonts.subtitleBold,
200
+ },
201
+ joinButton: {
202
+ backgroundColor: theme.light.primary,
203
+ borderRadius: theme.rounded.sm,
204
+ marginTop: theme.margin.md,
205
+ justifyContent: 'center',
206
+ paddingVertical: theme.padding.sm,
207
+ },
208
+ joinButtonText: {
209
+ color: theme.light.static_white,
210
+ textAlign: 'center',
211
+ ...theme.fonts.subtitleBold,
212
+ },
213
+ status: {
214
+ alignSelf: 'flex-start',
215
+ flexDirection: 'row',
216
+ alignItems: 'center',
217
+ padding: theme.padding.sm,
218
+ borderRadius: theme.rounded.xs,
219
+ backgroundColor: theme.light.static_overlay,
220
+ zIndex: 10,
221
+ },
222
+ avatar: {
223
+ height: theme.avatar.sm,
224
+ width: theme.avatar.sm,
225
+ borderRadius: theme.avatar.sm / 2,
226
+ alignSelf: 'center',
227
+ },
228
+ userNameLabel: {
229
+ flexShrink: 1,
230
+ color: theme.light.static_white,
231
+ ...theme.fonts.caption,
232
+ },
233
+ svgContainerStyle: {
234
+ marginLeft: theme.margin.sm,
235
+ },
236
+ });
@@ -0,0 +1,141 @@
1
+ import React, { useRef } from 'react';
2
+ import {
3
+ Animated,
4
+ PanResponder,
5
+ StyleProp,
6
+ StyleSheet,
7
+ View,
8
+ ViewStyle,
9
+ } from 'react-native';
10
+ import { VideoRenderer } from './VideoRenderer';
11
+ import { useLocalParticipant } from '@stream-io/video-react-bindings';
12
+ import { SfuModels } from '@stream-io/video-client';
13
+ import { useStreamVideoStoreValue } from '../contexts';
14
+ import { theme } from '../theme';
15
+ import { VideoSlash } from '../icons';
16
+ import { LOCAL_VIDEO_VIEW_STYLE } from '../constants';
17
+ import { A11yComponents } from '../constants/A11yLabels';
18
+
19
+ /**
20
+ * Props to be passed for the LocalVideoView component.
21
+ */
22
+ export interface LocalVideoViewProps {
23
+ /**
24
+ * An optional style object to be applied to the local video view
25
+ * @defaultValue
26
+ * The default is `{
27
+ * position: 'absolute',
28
+ * height: 140,
29
+ * width: 80,
30
+ * right: 2 * theme.spacing.lg,
31
+ * top: 100,
32
+ * borderRadius: theme.rounded.sm,
33
+ * zIndex: 1,
34
+ * }`
35
+ */
36
+ style?: StyleProp<ViewStyle>;
37
+
38
+ /**
39
+ * The layout of the local video view controls weather the local participant's video will be rendered in full screen or floating
40
+ * @defaultValue 'floating'
41
+ */
42
+ layout?: 'floating' | 'fullscreen';
43
+
44
+ zOrder?: number;
45
+ }
46
+
47
+ /**
48
+ * Shows a floating participant UI that can be dragged (to be implemented) within certain bounds.
49
+ *
50
+ * | Local Video | Local Video in relation to active call screen |
51
+ * | :---- | :----: |
52
+ * |![local-video-view-1](https://user-images.githubusercontent.com/25864161/217491433-60848d95-1a14-422e-b4e1-7540f3ba30b4.png)|![local-video-view-2](https://user-images.githubusercontent.com/25864161/217491438-75bad10c-8850-49f5-b3bd-af22995e11c2.png)|
53
+ */
54
+ export const LocalVideoView = (props: LocalVideoViewProps) => {
55
+ const { layout = 'floating', zOrder = 1 } = props;
56
+ const containerStyle =
57
+ layout === 'floating'
58
+ ? styles.floatingContainer
59
+ : styles.fullScreenContainer;
60
+ const { style = containerStyle } = props;
61
+ const localParticipant = useLocalParticipant();
62
+ const isCameraOnFrontFacingMode = useStreamVideoStoreValue(
63
+ (store) => store.isCameraOnFrontFacingMode,
64
+ );
65
+ const pan = useRef(new Animated.ValueXY()).current;
66
+ const panResponder = useRef(
67
+ PanResponder.create({
68
+ onMoveShouldSetPanResponder: () => true,
69
+ onPanResponderMove: Animated.event([null, { dx: pan.x, dy: pan.y }], {
70
+ useNativeDriver: false,
71
+ }),
72
+ onPanResponderRelease: () => {
73
+ pan.extractOffset();
74
+ },
75
+ }),
76
+ ).current;
77
+
78
+ if (!localParticipant) return null;
79
+
80
+ const isVideoMuted = !localParticipant.publishedTracks.includes(
81
+ SfuModels.TrackType.VIDEO,
82
+ );
83
+
84
+ if (layout === 'fullscreen') {
85
+ return (
86
+ <VideoRenderer
87
+ mirror={isCameraOnFrontFacingMode}
88
+ mediaStream={localParticipant.videoStream}
89
+ style={style}
90
+ zOrder={zOrder}
91
+ />
92
+ );
93
+ }
94
+
95
+ return (
96
+ <Animated.View
97
+ accessibilityLabel={A11yComponents.LOCAL_PARTICIPANT}
98
+ style={{
99
+ zIndex: 5,
100
+ transform: [{ translateX: pan.x }, { translateY: pan.y }],
101
+ }}
102
+ {...panResponder.panHandlers}
103
+ >
104
+ {isVideoMuted ? (
105
+ <View style={style}>
106
+ <View style={theme.icon.md}>
107
+ <VideoSlash color={theme.light.static_white} />
108
+ </View>
109
+ </View>
110
+ ) : (
111
+ <VideoRenderer
112
+ mirror={isCameraOnFrontFacingMode}
113
+ mediaStream={localParticipant.videoStream}
114
+ style={style}
115
+ zOrder={zOrder}
116
+ />
117
+ )}
118
+ </Animated.View>
119
+ );
120
+ };
121
+
122
+ const styles = StyleSheet.create({
123
+ floatingContainer: {
124
+ position: 'absolute',
125
+ height: LOCAL_VIDEO_VIEW_STYLE.height,
126
+ width: LOCAL_VIDEO_VIEW_STYLE.width,
127
+ right: theme.spacing.lg * 2,
128
+ top: theme.margin.md,
129
+ borderRadius: LOCAL_VIDEO_VIEW_STYLE.borderRadius,
130
+ zIndex: 1,
131
+ overflow: 'hidden',
132
+ backgroundColor: theme.light.disabled,
133
+ justifyContent: 'center',
134
+ alignItems: 'center',
135
+ },
136
+ fullScreenContainer: {
137
+ flex: 1,
138
+ justifyContent: 'center',
139
+ alignItems: 'center',
140
+ },
141
+ });
@@ -0,0 +1,72 @@
1
+ import { StyleSheet, View } from 'react-native';
2
+ import { Path, Svg } from 'react-native-svg';
3
+ import { theme } from '../theme';
4
+ import { SfuModels } from '@stream-io/video-client';
5
+
6
+ /**
7
+ * Props to be passed for the NetworkQualityIndicator component.
8
+ */
9
+ export type NetworkQualityIndicatorType = {
10
+ connectionQuality: SfuModels.ConnectionQuality;
11
+ };
12
+
13
+ const connectionQualitySignalColors: Record<
14
+ SfuModels.ConnectionQuality,
15
+ string[]
16
+ > = {
17
+ 0: [
18
+ theme.light.static_white,
19
+ theme.light.static_white,
20
+ theme.light.static_white,
21
+ ],
22
+ 1: [theme.light.error, theme.light.static_white, theme.light.static_white],
23
+ 2: [theme.light.primary, theme.light.primary, theme.light.static_white],
24
+ 3: [theme.light.primary, theme.light.primary, theme.light.primary],
25
+ };
26
+
27
+ export const NetworkQualityIndicator = ({
28
+ connectionQuality,
29
+ }: NetworkQualityIndicatorType) => {
30
+ if (!connectionQuality) return null;
31
+
32
+ const connectionQualityColors =
33
+ connectionQualitySignalColors[connectionQuality];
34
+
35
+ return (
36
+ <View style={[styles.container, theme.icon.lg]}>
37
+ <Svg viewBox="0 0 34 34" fill={'none'}>
38
+ <Path
39
+ d="M 9.97559 22.3379 L 9.97559 19.616"
40
+ stroke={connectionQualityColors[0]}
41
+ strokeWidth={3}
42
+ strokeLinecap="round"
43
+ strokeLinejoin="round"
44
+ fill={connectionQualityColors[0]}
45
+ />
46
+ <Path
47
+ d="M 16.7808 22.3379 L 16.7808 15.5331"
48
+ stroke={connectionQualityColors[1]}
49
+ strokeWidth={3}
50
+ strokeLinecap="round"
51
+ strokeLinejoin="round"
52
+ fill={connectionQualityColors[1]}
53
+ />
54
+ <Path
55
+ d="M 23.5854 22.3379 L 23.5854 11.4502"
56
+ stroke={connectionQualityColors[2]}
57
+ strokeWidth={3}
58
+ strokeLinecap="round"
59
+ strokeLinejoin="round"
60
+ fill={connectionQualityColors[2]}
61
+ />
62
+ </Svg>
63
+ </View>
64
+ );
65
+ };
66
+
67
+ const styles = StyleSheet.create({
68
+ container: {
69
+ backgroundColor: theme.light.static_overlay,
70
+ borderRadius: theme.rounded.xs,
71
+ },
72
+ });