@amityco/react-native-social-uikit 4.0.0-4221f0d.0 → 4.0.0-7db12756.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/lib/commonjs/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
  2. package/lib/commonjs/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
  3. package/lib/commonjs/components/MediaSection/index.js +3 -3
  4. package/lib/commonjs/components/MediaSection/index.js.map +1 -1
  5. package/lib/commonjs/components/PostTypeChoiceModal/PostTypeChoiceModal.js +14 -5
  6. package/lib/commonjs/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
  7. package/lib/commonjs/components/PostTypeChoiceModal/style.js +1 -2
  8. package/lib/commonjs/components/PostTypeChoiceModal/style.js.map +1 -1
  9. package/lib/commonjs/components/Social/PostList/index.js +1 -3
  10. package/lib/commonjs/components/Social/PostList/index.js.map +1 -1
  11. package/lib/commonjs/index.js +6 -0
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js +16 -16
  14. package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js.map +1 -1
  15. package/lib/commonjs/screens/LivestreamPlayer/index.js +3 -6
  16. package/lib/commonjs/screens/LivestreamPlayer/index.js.map +1 -1
  17. package/lib/commonjs/svg/svg-xml-list.js +1 -1
  18. package/lib/commonjs/util/postTypeChecker.js.map +1 -1
  19. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
  20. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  21. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
  22. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
  23. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
  24. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
  25. package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
  26. package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
  27. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +28 -25
  28. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  29. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
  30. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
  31. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +206 -68
  32. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
  33. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +50 -0
  34. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
  35. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
  36. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
  37. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +150 -124
  38. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
  39. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
  40. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
  41. package/lib/commonjs/v4/component/LivestreamContent/index.js +12 -12
  42. package/lib/commonjs/v4/component/LivestreamContent/index.js.map +1 -1
  43. package/lib/commonjs/v4/component/PostContent/index.js +4 -4
  44. package/lib/commonjs/v4/component/PostContent/index.js.map +1 -1
  45. package/lib/commonjs/v4/component/PostMenu/index.js +2 -2
  46. package/lib/commonjs/v4/component/PostMenu/index.js.map +1 -1
  47. package/lib/commonjs/v4/component/PreviewLink/LinkPreview.js +3 -3
  48. package/lib/commonjs/v4/component/PreviewLink/LinkPreview.js.map +1 -1
  49. package/lib/commonjs/v4/component/PreviewLink/utils.js +9 -73
  50. package/lib/commonjs/v4/component/PreviewLink/utils.js.map +1 -1
  51. package/lib/commonjs/v4/component/Toast/index.js +4 -4
  52. package/lib/commonjs/v4/component/Toast/index.js.map +1 -1
  53. package/lib/commonjs/v4/component/Toast/styles.js +2 -2
  54. package/lib/commonjs/v4/component/Toast/styles.js.map +1 -1
  55. package/lib/commonjs/v4/enum/roomStatus.js +14 -0
  56. package/lib/commonjs/v4/enum/roomStatus.js.map +1 -0
  57. package/lib/commonjs/v4/hook/index.js +22 -0
  58. package/lib/commonjs/v4/hook/index.js.map +1 -1
  59. package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js +1 -3
  60. package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
  61. package/lib/commonjs/v4/hook/usePostSubscription.js +38 -0
  62. package/lib/commonjs/v4/hook/usePostSubscription.js.map +1 -0
  63. package/lib/commonjs/v4/hook/useRoomSubscription.js +22 -0
  64. package/lib/commonjs/v4/hook/useRoomSubscription.js.map +1 -0
  65. package/lib/commonjs/v4/index.js +7 -0
  66. package/lib/commonjs/v4/index.js.map +1 -1
  67. package/lib/commonjs/v4/stores/slices/toast.js +4 -1
  68. package/lib/commonjs/v4/stores/slices/toast.js.map +1 -1
  69. package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
  70. package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
  71. package/lib/module/components/MediaSection/index.js +3 -3
  72. package/lib/module/components/MediaSection/index.js.map +1 -1
  73. package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js +15 -8
  74. package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
  75. package/lib/module/components/PostTypeChoiceModal/style.js +1 -2
  76. package/lib/module/components/PostTypeChoiceModal/style.js.map +1 -1
  77. package/lib/module/components/Social/PostList/index.js +1 -3
  78. package/lib/module/components/Social/PostList/index.js.map +1 -1
  79. package/lib/module/index.js +2 -6
  80. package/lib/module/index.js.map +1 -1
  81. package/lib/module/screens/CreateLivestream/CreateLivestream.js +17 -17
  82. package/lib/module/screens/CreateLivestream/CreateLivestream.js.map +1 -1
  83. package/lib/module/screens/LivestreamPlayer/index.js +4 -8
  84. package/lib/module/screens/LivestreamPlayer/index.js.map +1 -1
  85. package/lib/module/svg/svg-xml-list.js +1 -1
  86. package/lib/module/util/postTypeChecker.js.map +1 -1
  87. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
  88. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  89. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
  90. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
  91. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
  92. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
  93. package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
  94. package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
  95. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +29 -26
  96. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  97. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
  98. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
  99. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +211 -72
  100. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
  101. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +42 -0
  102. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
  103. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
  104. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
  105. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +152 -126
  106. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
  107. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
  108. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
  109. package/lib/module/v4/component/LivestreamContent/index.js +13 -13
  110. package/lib/module/v4/component/LivestreamContent/index.js.map +1 -1
  111. package/lib/module/v4/component/PostContent/index.js +4 -4
  112. package/lib/module/v4/component/PostContent/index.js.map +1 -1
  113. package/lib/module/v4/component/PostMenu/index.js +2 -2
  114. package/lib/module/v4/component/PostMenu/index.js.map +1 -1
  115. package/lib/module/v4/component/PreviewLink/LinkPreview.js +3 -3
  116. package/lib/module/v4/component/PreviewLink/LinkPreview.js.map +1 -1
  117. package/lib/module/v4/component/PreviewLink/utils.js +9 -73
  118. package/lib/module/v4/component/PreviewLink/utils.js.map +1 -1
  119. package/lib/module/v4/component/Toast/index.js +4 -4
  120. package/lib/module/v4/component/Toast/index.js.map +1 -1
  121. package/lib/module/v4/component/Toast/styles.js +2 -2
  122. package/lib/module/v4/component/Toast/styles.js.map +1 -1
  123. package/lib/module/v4/enum/roomStatus.js +8 -0
  124. package/lib/module/v4/enum/roomStatus.js.map +1 -0
  125. package/lib/module/v4/hook/index.js +2 -0
  126. package/lib/module/v4/hook/index.js.map +1 -1
  127. package/lib/module/v4/hook/useCustomRankingGlobalFeed.js +1 -3
  128. package/lib/module/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
  129. package/lib/module/v4/hook/usePostSubscription.js +31 -0
  130. package/lib/module/v4/hook/usePostSubscription.js.map +1 -0
  131. package/lib/module/v4/hook/useRoomSubscription.js +15 -0
  132. package/lib/module/v4/hook/useRoomSubscription.js.map +1 -0
  133. package/lib/module/v4/index.js +1 -1
  134. package/lib/module/v4/index.js.map +1 -1
  135. package/lib/module/v4/stores/slices/toast.js +4 -1
  136. package/lib/module/v4/stores/slices/toast.js.map +1 -1
  137. package/lib/typescript/src/components/MediaSection/index.d.ts.map +1 -1
  138. package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts +1 -2
  139. package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts.map +1 -1
  140. package/lib/typescript/src/components/Social/PostList/index.d.ts +1 -3
  141. package/lib/typescript/src/components/Social/PostList/index.d.ts.map +1 -1
  142. package/lib/typescript/src/index.d.ts +2 -2
  143. package/lib/typescript/src/index.d.ts.map +1 -1
  144. package/lib/typescript/src/screens/LivestreamPlayer/index.d.ts.map +1 -1
  145. package/lib/typescript/src/util/postTypeChecker.d.ts +1 -1
  146. package/lib/typescript/src/util/postTypeChecker.d.ts.map +1 -1
  147. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts +1 -3
  148. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts.map +1 -1
  149. package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts +1 -0
  150. package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts.map +1 -1
  151. package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.d.ts.map +1 -1
  152. package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.d.ts +1 -1
  153. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.d.ts.map +1 -1
  154. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts +8 -0
  155. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts.map +1 -0
  156. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts +70 -2
  157. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts.map +1 -1
  158. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.d.ts.map +1 -1
  159. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts +1 -0
  160. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts.map +1 -1
  161. package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts +1 -1
  162. package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts.map +1 -1
  163. package/lib/typescript/src/v4/component/PostContent/index.d.ts.map +1 -1
  164. package/lib/typescript/src/v4/component/PreviewLink/utils.d.ts +6 -1
  165. package/lib/typescript/src/v4/component/PreviewLink/utils.d.ts.map +1 -1
  166. package/lib/typescript/src/v4/component/Toast/styles.d.ts +1 -1
  167. package/lib/typescript/src/v4/component/Toast/styles.d.ts.map +1 -1
  168. package/lib/typescript/src/v4/enum/roomStatus.d.ts +8 -0
  169. package/lib/typescript/src/v4/enum/roomStatus.d.ts.map +1 -0
  170. package/lib/typescript/src/v4/hook/index.d.ts +2 -0
  171. package/lib/typescript/src/v4/hook/index.d.ts.map +1 -1
  172. package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts +3 -0
  173. package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts.map +1 -1
  174. package/lib/typescript/src/v4/hook/usePostSubscription.d.ts +4 -0
  175. package/lib/typescript/src/v4/hook/usePostSubscription.d.ts.map +1 -0
  176. package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts +4 -0
  177. package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts.map +1 -0
  178. package/lib/typescript/src/v4/index.d.ts +1 -0
  179. package/lib/typescript/src/v4/index.d.ts.map +1 -1
  180. package/lib/typescript/src/v4/routes/RouteParamList.d.ts +1 -1
  181. package/lib/typescript/src/v4/routes/RouteParamList.d.ts.map +1 -1
  182. package/lib/typescript/src/v4/stores/slices/toast.d.ts +1 -0
  183. package/lib/typescript/src/v4/stores/slices/toast.d.ts.map +1 -1
  184. package/package.json +6 -3
  185. package/src/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.tsx +1 -1
  186. package/src/components/MediaSection/index.tsx +4 -6
  187. package/src/components/PostTypeChoiceModal/PostTypeChoiceModal.tsx +15 -15
  188. package/src/components/PostTypeChoiceModal/style.ts +1 -2
  189. package/src/components/Social/PostList/index.tsx +1 -4
  190. package/src/index.tsx +2 -2
  191. package/src/screens/CreateLivestream/CreateLivestream.tsx +17 -17
  192. package/src/screens/LivestreamPlayer/index.tsx +9 -15
  193. package/src/svg/svg-xml-list.ts +1 -1
  194. package/src/util/postTypeChecker.ts +1 -1
  195. package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx +10 -10
  196. package/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.tsx +1 -1
  197. package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.tsx +1 -1
  198. package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.tsx +1 -1
  199. package/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.ts +3 -2
  200. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.tsx +24 -25
  201. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.ts +2 -2
  202. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.tsx +241 -89
  203. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.tsx +48 -0
  204. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.ts +72 -3
  205. package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.tsx +200 -154
  206. package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.ts +2 -0
  207. package/src/v4/component/LivestreamContent/index.tsx +21 -22
  208. package/src/v4/component/PostContent/index.tsx +6 -8
  209. package/src/v4/component/PostMenu/index.tsx +2 -2
  210. package/src/v4/component/PreviewLink/LinkPreview.tsx +3 -3
  211. package/src/v4/component/PreviewLink/utils.ts +9 -108
  212. package/src/v4/component/Toast/index.tsx +1 -1
  213. package/src/v4/component/Toast/styles.ts +2 -2
  214. package/src/v4/enum/roomStatus.ts +7 -0
  215. package/src/v4/hook/index.ts +2 -0
  216. package/src/v4/hook/useCustomRankingGlobalFeed.ts +1 -1
  217. package/src/v4/hook/usePostSubscription.ts +34 -0
  218. package/src/v4/hook/useRoomSubscription.ts +19 -0
  219. package/src/v4/index.tsx +1 -1
  220. package/src/v4/routes/RouteParamList.tsx +1 -1
  221. package/src/v4/stores/slices/toast.ts +5 -0
  222. package/uikit.config.json +1 -1
  223. package/lib/commonjs/v4/enum/livestreamStatus.js +0 -13
  224. package/lib/commonjs/v4/enum/livestreamStatus.js.map +0 -1
  225. package/lib/module/v4/enum/livestreamStatus.js +0 -7
  226. package/lib/module/v4/enum/livestreamStatus.js.map +0 -1
  227. package/lib/typescript/src/v4/enum/livestreamStatus.d.ts +0 -7
  228. package/lib/typescript/src/v4/enum/livestreamStatus.d.ts.map +0 -1
  229. package/src/v4/enum/livestreamStatus.ts +0 -6
@@ -8,7 +8,7 @@ export const useStyles = () => {
8
8
  const { height: screenHeight } = Dimensions.get('window');
9
9
  const insets = useSafeAreaInsets();
10
10
 
11
- const availableHeight = screenHeight - 80 - 60 - 40 - 40 - 120;
11
+ const availableHeight = screenHeight - 80 - 60 - 40 - 40 - 120 - 50;
12
12
  const styles = StyleSheet.create({
13
13
  container: {
14
14
  flex: 1,
@@ -26,7 +26,6 @@ export const useStyles = () => {
26
26
  },
27
27
  overlay: {
28
28
  flex: 1,
29
- height: '100%',
30
29
  top: 0,
31
30
  bottom: 0,
32
31
  left: 0,
@@ -158,12 +157,19 @@ export const useStyles = () => {
158
157
  text: {
159
158
  color: theme.colors.background,
160
159
  },
161
- timer: {
160
+
161
+ closeButton: {
162
162
  left: 16,
163
163
  zIndex: 100,
164
164
  position: 'absolute',
165
165
  top: 20 + insets.top,
166
166
  },
167
+ timer: {
168
+ right: 16,
169
+ zIndex: 100,
170
+ position: 'absolute',
171
+ top: 20 + insets.top,
172
+ },
167
173
  permission: {
168
174
  flex: 1,
169
175
  top: 80 + insets.top,
@@ -191,6 +197,69 @@ export const useStyles = () => {
191
197
  color: theme.colors.background,
192
198
  textAlign: 'center',
193
199
  },
200
+ containerRoom: {
201
+ flex: 1,
202
+ alignItems: 'stretch',
203
+ justifyContent: 'center',
204
+ padding: 10,
205
+ },
206
+ participantView: {
207
+ flex: 1,
208
+ margin: 5,
209
+ height: 200,
210
+ backgroundColor: '#ccc',
211
+ },
212
+ roomContainer: {
213
+ flex: 1,
214
+ width: '100%',
215
+ height: '100%',
216
+ },
217
+ videoTrack: {
218
+ width: '100%',
219
+ height: '100%',
220
+ },
221
+ countdownOverlay: {
222
+ position: 'absolute',
223
+ top: 0,
224
+ left: 0,
225
+ right: 0,
226
+ bottom: 80,
227
+ justifyContent: 'center',
228
+ alignItems: 'center',
229
+ backgroundColor: 'rgba(0, 0, 0, 0.7)',
230
+ zIndex: 150,
231
+ },
232
+ countdownContainer: {
233
+ alignItems: 'center',
234
+ gap: 24,
235
+ },
236
+ countdownCircle: {
237
+ position: 'relative',
238
+ alignItems: 'center',
239
+ justifyContent: 'center',
240
+ width: 72,
241
+ height: 72,
242
+ },
243
+ countdownNumberContainer: {
244
+ position: 'absolute',
245
+ top: 0,
246
+ left: 0,
247
+ right: 0,
248
+ bottom: 0,
249
+ alignItems: 'center',
250
+ justifyContent: 'center',
251
+ },
252
+ countdownNumber: {
253
+ fontSize: 32,
254
+ fontWeight: '700',
255
+ color: theme.colors.background,
256
+ },
257
+ countdownText: {
258
+ fontSize: 24,
259
+ fontWeight: '500',
260
+ color: theme.colors.background,
261
+ textAlign: 'center',
262
+ },
194
263
  });
195
264
 
196
265
  return styles;
@@ -1,131 +1,72 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import {
3
- View,
4
- TouchableOpacity,
5
- TouchableWithoutFeedback,
6
- useAnimatedValue,
7
- } from 'react-native';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
+ import { View, TouchableOpacity, Platform } from 'react-native';
8
3
  import { useStyles } from './styles';
9
- // @ts-ignore
10
- // import { AmityStreamPlayer } from '@amityco/video-player-react-native';
11
4
  import LiveStreamEndThumbnail from '../../../component/LivestreamContent/LivestreamEndedThumbnail';
12
- import { Animated } from 'react-native';
13
5
  import { SvgXml } from 'react-native-svg';
14
- import {
15
- getPostTopic,
16
- PostRepository,
17
- StreamRepository,
18
- subscribeTopic,
19
- } from '@amityco/ts-sdk-react-native';
20
- import { close, pause, resume } from '../../../assets/icons';
6
+ import { close } from '../../../assets/icons';
21
7
  import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
22
8
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
23
9
  import { RootStackParamList } from '../../../routes/RouteParamList';
24
- import { LivestreamStatus } from '../../../enum/livestreamStatus';
10
+ import { RoomStatus } from '../../../enum/roomStatus';
25
11
  import LiveStreamIdleThumbnail from '../../../component/LivestreamContent/LivestreamIdleThumbnail';
26
12
  import { Typography } from '../../../component/Typography/Typography';
27
13
  import { SafeAreaView } from 'react-native-safe-area-context';
28
14
  import NetInfo from '@react-native-community/netinfo';
29
15
  import { CircularProgressIndicator } from '../../../component/CircularProgressIndicator';
30
- const usePostSubscription = (postId: string) => {
31
- const [subscribedPost, setSubscribedPost] = useState<Amity.Post>(null);
32
-
33
- useEffect(() => {
34
- let unsubscribe: () => void;
35
- if (postId) {
36
- unsubscribe = PostRepository.getPost(postId, ({ data }) => {
37
- setSubscribedPost(data);
38
- });
39
- }
40
- return () => {
41
- unsubscribe && unsubscribe();
42
- };
43
- }, [postId]);
44
-
45
- useEffect(() => {
46
- let unsubscribe: () => void;
47
- if (subscribedPost) {
48
- unsubscribe = subscribeTopic(getPostTopic(subscribedPost));
49
- }
50
- return () => {
51
- unsubscribe && unsubscribe();
52
- };
53
- }, [subscribedPost]);
54
-
55
- return { subscribedPost };
56
- };
16
+ import Video from 'react-native-video';
17
+ import useAuth from '../../../../hooks/useAuth';
18
+ import {
19
+ usePostSubscription,
20
+ useRoomSubscription,
21
+ } from '../../../../v4/hook/index';
22
+ import { RoomRepository } from '@amityco/ts-sdk-react-native';
57
23
 
58
24
  function AmityLiveStreamPlayerPage() {
59
- const ref = useRef<any>(null);
60
25
  const { styles, theme } = useStyles();
61
- const controlOpacity = useAnimatedValue(0);
62
26
  const navigation =
63
27
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
64
28
  const route = useRoute<RouteProp<RootStackParamList, 'LivestreamPlayer'>>();
65
29
 
66
- const [error, setError] = useState<any>(null);
67
- const [isPlaying, setIsPlaying] = useState(true);
68
30
  const [reconnecting, setReconnecting] = useState(false);
69
- const [livestream, setLivestream] = useState<Amity.Stream>();
70
-
71
- const { streamId, post } = route.params;
31
+ const [room, setRoom] = useState<Amity.Room | null>(null);
32
+ const [videoError, setVideoError] = useState(false);
33
+ const [error, setError] = useState<Error | null>(null);
34
+ const [, setPlayerInitialized] = useState(false);
35
+ const [videoKey, setVideoKey] = useState(0);
36
+ const [isPaused, setIsPaused] = useState(false);
37
+ const [wasLive, setWasLive] = useState(false);
72
38
 
39
+ const { roomId, post } = route.params;
73
40
  const { subscribedPost } = usePostSubscription(post?.postId);
41
+ useRoomSubscription({ room });
74
42
 
75
- const onStopPlayer = () => {
76
- ref.current && ref.current.pause();
77
- setIsPlaying(false);
78
- };
79
-
80
- const onStartPlayer = () => {
81
- ref.current && ref.current.play();
82
- setIsPlaying(true);
83
- };
84
-
85
- const onPressControlButton = () => {
86
- isPlaying ? onStopPlayer() : onStartPlayer();
87
- };
88
-
89
- const onToggleControl = () => {
90
- controlOpacity.stopAnimation((currentValue) => {
91
- Animated.timing(controlOpacity, {
92
- toValue: currentValue === 0 ? 1 : 0,
93
- duration: 300,
94
- useNativeDriver: false,
95
- }).start();
96
- });
97
- };
43
+ const { client } = useAuth();
44
+ const videoRef = useRef<any>(null);
45
+ const isStreamEnding = useRef(false);
98
46
 
99
47
  useEffect(() => {
100
- const unsubscribe = StreamRepository.getStreamById(
101
- streamId,
48
+ const unsubscribe = RoomRepository.getRoom(
49
+ roomId,
102
50
  ({ data, loading, error: streamError }) => {
103
51
  if (streamError) setError(streamError);
104
- if (!loading && data) setLivestream({ ...data });
52
+ if (!loading && data) setRoom({ ...data });
105
53
  }
106
54
  );
107
55
 
108
56
  return () => unsubscribe();
109
- }, [streamId]);
57
+ }, [roomId]);
110
58
 
111
59
  useEffect(() => {
112
- if (livestream?.isDeleted || subscribedPost?.isDeleted) {
113
- navigation.replace('PostDetail', { postId: subscribedPost?.postId });
60
+ if (room?.status === RoomStatus.live) {
61
+ setWasLive(true);
114
62
  }
115
- }, [livestream?.isDeleted, subscribedPost, navigation]);
63
+ }, [room?.status]);
116
64
 
117
65
  useEffect(() => {
118
- const isTerminated =
119
- livestream?.moderation?.terminateLabels &&
120
- livestream?.moderation?.terminateLabels?.length > 0;
121
- const isLiveOrEnded =
122
- livestream?.status === LivestreamStatus.live ||
123
- livestream?.status === LivestreamStatus.ended;
124
-
125
- if (isLiveOrEnded && isTerminated) {
126
- navigation.replace('LivestreamTerminated', { type: 'viewer' });
66
+ if (room?.isDeleted || subscribedPost?.isDeleted) {
67
+ navigation.replace('PostDetail', { postId: subscribedPost?.postId });
127
68
  }
128
- }, [livestream?.moderation?.terminateLabels, livestream?.status, navigation]);
69
+ }, [room?.isDeleted, subscribedPost, navigation]);
129
70
 
130
71
  useEffect(() => {
131
72
  const unsubscribe = NetInfo.addEventListener((state) => {
@@ -134,24 +75,121 @@ function AmityLiveStreamPlayerPage() {
134
75
  return () => unsubscribe();
135
76
  }, []);
136
77
 
137
- if (!livestream || error)
78
+ useEffect(() => {
79
+ if (!room?.status) return;
80
+
81
+ const shouldEnd =
82
+ room.status === RoomStatus.ended ||
83
+ (room.status === RoomStatus.recorded && wasLive);
84
+
85
+ if (!shouldEnd || isStreamEnding.current) return;
86
+
87
+ isStreamEnding.current = true;
88
+ setIsPaused(true);
89
+
90
+ if (Platform.OS === 'ios') {
91
+ // iOS: ONLY dismiss fullscreen. DO NOT touch key. DO NOT unmount.
92
+ requestAnimationFrame(() => {
93
+ videoRef.current?.dismissFullscreenPlayer?.();
94
+ });
95
+ } else {
96
+ // Android: HARD destroy
97
+ setTimeout(() => {
98
+ setVideoKey((prev) => prev + 1);
99
+ }, 50);
100
+ }
101
+ }, [room?.status, wasLive]);
102
+
103
+ useEffect(() => {
104
+ let timer: ReturnType<typeof setTimeout> | null = null;
105
+
106
+ if (
107
+ videoRef.current &&
108
+ room &&
109
+ room.status === RoomStatus.live &&
110
+ !videoError &&
111
+ Platform.OS === 'ios'
112
+ ) {
113
+ const isTerminated =
114
+ room?.moderation?.terminateLabels &&
115
+ room?.moderation?.terminateLabels?.length > 0;
116
+
117
+ if (!isTerminated) {
118
+ timer = setTimeout(() => {
119
+ videoRef.current?.presentFullscreenPlayer();
120
+ }, 100);
121
+ }
122
+ }
123
+
124
+ return () => {
125
+ if (timer !== null) {
126
+ clearTimeout(timer);
127
+ }
128
+ };
129
+ }, [room, videoError]);
130
+
131
+ const isTerminated =
132
+ room?.moderation?.terminateLabels &&
133
+ room?.moderation?.terminateLabels?.length > 0;
134
+
135
+ const shouldShowEndThumbnail =
136
+ room?.status === RoomStatus.ended ||
137
+ (room?.status === RoomStatus.recorded && wasLive) ||
138
+ isTerminated;
139
+
140
+ useEffect(() => {
141
+ if (!room?.status) return;
142
+
143
+ const shouldEnd =
144
+ room.status === RoomStatus.ended ||
145
+ (room.status === RoomStatus.recorded && wasLive);
146
+
147
+ if (!shouldEnd || isStreamEnding.current) return;
148
+
149
+ isStreamEnding.current = true;
150
+ setIsPaused(true);
151
+
152
+ if (Platform.OS === 'ios') {
153
+ // iOS: just dismiss fullscreen, DO NOT destroy immediately
154
+ if (videoRef.current) {
155
+ try {
156
+ videoRef.current.dismissFullscreenPlayer?.();
157
+ } catch {}
158
+ }
159
+ } else {
160
+ // Android: HARD destroy
161
+ setTimeout(() => {
162
+ setVideoKey((prev) => prev + 1);
163
+ }, 50);
164
+ }
165
+ }, [room?.status, wasLive]);
166
+
167
+ if (!room || error) {
138
168
  return (
139
169
  <SafeAreaView style={styles.container}>
140
170
  <LiveStreamIdleThumbnail />
141
171
  </SafeAreaView>
142
172
  );
173
+ }
174
+
175
+ const closePlayer = () => {
176
+ navigation.goBack();
177
+ };
178
+
179
+ const videoUrl =
180
+ room.status === RoomStatus.recorded
181
+ ? room.recordedPlaybackInfos[0]?.url
182
+ : room.livePlaybackUrl;
143
183
 
144
184
  return (
145
185
  <SafeAreaView style={styles.container}>
146
- {livestream.status === LivestreamStatus.ended ? (
186
+ {shouldShowEndThumbnail ? (
147
187
  <>
148
188
  <View style={styles.steamEndContainer}>
149
189
  <LiveStreamEndThumbnail />
150
190
  </View>
151
- <TouchableOpacity
152
- style={styles.closeButton}
153
- onPress={navigation.goBack}
154
- >
191
+
192
+ <TouchableOpacity style={styles.closeButton} onPress={closePlayer}>
155
193
  <SvgXml
156
194
  xml={close()}
157
195
  width="28"
@@ -160,14 +198,70 @@ function AmityLiveStreamPlayerPage() {
160
198
  />
161
199
  </TouchableOpacity>
162
200
  </>
163
- ) : // <AmityStreamPlayer
164
- // ref={ref}
165
- // stream={livestream}
166
- // onBack={navigation.goBack}
167
- // status={livestream.status === 'live' ? 'live' : 'recorded'}
168
- // />
169
- null}
170
- {livestream.status === LivestreamStatus.live && reconnecting && (
201
+ ) : (
202
+ <View style={styles.container}>
203
+ {(room.status === RoomStatus.live ||
204
+ room.status === RoomStatus.waiting_reconnect) && (
205
+ <View style={styles.indicator}>
206
+ <View style={styles.status}>
207
+ <Typography.CaptionBold style={styles.live}>
208
+ LIVE
209
+ </Typography.CaptionBold>
210
+ </View>
211
+ </View>
212
+ )}
213
+
214
+ {!shouldShowEndThumbnail && (
215
+ <Video
216
+ key={
217
+ Platform.OS === 'android' ? `${videoUrl}-${videoKey}` : videoUrl
218
+ }
219
+ ref={videoRef}
220
+ source={{
221
+ uri:
222
+ room.status === RoomStatus.recorded
223
+ ? room.recordedPlaybackInfos[0]?.url
224
+ : room.livePlaybackUrl,
225
+ headers: {
226
+ Authorization: `Bearer ${client.token.accessToken}`,
227
+ },
228
+ }}
229
+ style={styles.container}
230
+ resizeMode="contain"
231
+ controls={room?.status === RoomStatus.recorded && !wasLive}
232
+ fullscreen={
233
+ Platform.OS === 'ios' && room.status !== RoomStatus.recorded
234
+ }
235
+ fullscreenOrientation="landscape"
236
+ paused={isPaused}
237
+ muted={false}
238
+ volume={1.0}
239
+ audioOutput="speaker"
240
+ playInBackground={false}
241
+ playWhenInactive={false}
242
+ repeat={false}
243
+ onLoad={() => {
244
+ setPlayerInitialized(true);
245
+ if (room.status === RoomStatus.recorded) {
246
+ setIsPaused(false);
247
+ }
248
+ }}
249
+ onError={(e) => {
250
+ console.log('Video Error: ', e);
251
+ setVideoError(true);
252
+ }}
253
+ onFullscreenPlayerDidDismiss={() => {
254
+ if (Platform.OS === 'ios') {
255
+ closePlayer();
256
+ }
257
+ }}
258
+ />
259
+ )}
260
+ </View>
261
+ )}
262
+
263
+ {((room.status === RoomStatus.live && reconnecting) ||
264
+ room.status === RoomStatus.waiting_reconnect) && (
171
265
  <View style={styles.connecting}>
172
266
  <CircularProgressIndicator size={40} strokeWidth={2} />
173
267
  <Typography.TitleBold style={styles.text}>
@@ -179,54 +273,6 @@ function AmityLiveStreamPlayerPage() {
179
273
  </Typography.Caption>
180
274
  </View>
181
275
  )}
182
- {livestream.status === LivestreamStatus.live && (
183
- <>
184
- <View style={styles.indicator}>
185
- <View style={styles.status}>
186
- <Typography.CaptionBold style={styles.live}>
187
- LIVE
188
- </Typography.CaptionBold>
189
- </View>
190
- </View>
191
- <TouchableWithoutFeedback onPress={onToggleControl}>
192
- <Animated.View
193
- style={[styles.control, { opacity: controlOpacity }]}
194
- >
195
- <TouchableOpacity
196
- style={styles.closeButton}
197
- onPress={navigation.goBack}
198
- >
199
- <SvgXml
200
- xml={close()}
201
- width="28"
202
- height="28"
203
- color={theme.colors.background}
204
- />
205
- </TouchableOpacity>
206
-
207
- <View style={styles.controller}>
208
- <TouchableOpacity onPress={onPressControlButton}>
209
- {isPlaying ? (
210
- <SvgXml
211
- width={32}
212
- height={32}
213
- xml={pause()}
214
- color={theme.colors.background}
215
- />
216
- ) : (
217
- <SvgXml
218
- width={32}
219
- height={32}
220
- xml={resume()}
221
- color={theme.colors.background}
222
- />
223
- )}
224
- </TouchableOpacity>
225
- </View>
226
- </Animated.View>
227
- </TouchableWithoutFeedback>
228
- </>
229
- )}
230
276
  </SafeAreaView>
231
277
  );
232
278
  }
@@ -13,9 +13,11 @@ export const useStyles = () => {
13
13
  position: 'relative',
14
14
  backgroundColor: '#000000',
15
15
  },
16
+
16
17
  steamEndContainer: {
17
18
  flex: 1,
18
19
  justifyContent: 'center',
20
+ backgroundColor: '#000000',
19
21
  },
20
22
  indicator: {
21
23
  left: 16,
@@ -7,14 +7,14 @@ import {
7
7
  ImageStyle,
8
8
  } from 'react-native';
9
9
  import React, { useEffect, useState, useCallback, Fragment } from 'react';
10
- import { FileRepository, StreamRepository } from '@amityco/ts-sdk-react-native';
10
+ import { FileRepository, RoomRepository } from '@amityco/ts-sdk-react-native';
11
11
  import { useStyles } from './styles';
12
12
  import { useNavigation } from '@react-navigation/native';
13
13
  import { SvgXml } from 'react-native-svg';
14
14
  import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
15
15
  import { play } from '../../assets/icons';
16
16
  import { Typography } from '../Typography/Typography';
17
- import { LivestreamStatus } from '../../enum/livestreamStatus';
17
+ import { RoomStatus } from '../../enum/roomStatus';
18
18
  import LiveStreamEndThumbnail from './LivestreamEndedThumbnail';
19
19
  import LiveStreamIdleThumbnail from './LivestreamIdleThumbnail';
20
20
  import RenderTextWithMention from '../RenderTextWithMention/RenderTextWithMention';
@@ -22,14 +22,14 @@ import { RootStackParamList } from '../../routes/RouteParamList';
22
22
  import LiveStreamTerminatedThumbnail from './LivestreamTerminatedThumbnail';
23
23
 
24
24
  interface ILivestreamContent {
25
- streamId: Amity.Stream['streamId'];
25
+ roomId: Amity.Room['roomId'];
26
26
  onPressPost: () => void;
27
27
  post: Amity.Post;
28
28
  }
29
29
 
30
30
  const LivestreamContent: React.FC<ILivestreamContent> = ({
31
31
  post,
32
- streamId,
32
+ roomId,
33
33
  onPressPost,
34
34
  }) => {
35
35
  const { styles, theme } = useStyles();
@@ -39,18 +39,18 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
39
39
  >();
40
40
 
41
41
  const [error, setError] = useState<boolean>(false);
42
- const [livestream, setLivestream] = useState<Amity.Stream>();
42
+ const [livestream, setLivestream] = useState<Amity.Room>();
43
43
  const [thumbnailUrl, setThumbnailUrl] = useState<ImageSourcePropType>();
44
44
  const [isUpcoming, setIsUpcoming] = useState<boolean>(false);
45
45
 
46
46
  const onPlayLivestream = useCallback(() => {
47
47
  navigation.navigate('LivestreamPlayer', {
48
48
  post,
49
- streamId: livestream.streamId,
49
+ roomId: livestream.roomId,
50
50
  });
51
51
  }, [livestream, navigation, post]);
52
52
 
53
- const getLivestreamThumbnail = async (currentStream: Amity.Stream) => {
53
+ const getLivestreamThumbnail = async (currentStream: Amity.Room) => {
54
54
  const defaultThumbnail = require('../../assets/images/livestream.png');
55
55
 
56
56
  if (currentStream.thumbnailFileId) {
@@ -71,8 +71,8 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
71
71
 
72
72
  useEffect(() => {
73
73
  setIsUpcoming(true);
74
- const unsubscribe = StreamRepository.getStreamById(
75
- streamId,
74
+ const unsubscribe = RoomRepository.getRoom(
75
+ roomId,
76
76
  ({ data, loading, error: streamError }) => {
77
77
  if (streamError) setError(!!streamError);
78
78
  if (!loading && data) {
@@ -86,13 +86,13 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
86
86
  return () => {
87
87
  unsubscribe();
88
88
  };
89
- }, [streamId]);
89
+ }, [roomId]);
90
90
 
91
91
  if (!livestream) return null;
92
92
 
93
93
  if (error || livestream?.isDeleted) {
94
94
  return (
95
- <View key={livestream.streamId} style={styles.container}>
95
+ <View key={livestream.roomId} style={styles.container}>
96
96
  <LiveStreamIdleThumbnail />
97
97
  </View>
98
98
  );
@@ -102,12 +102,12 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
102
102
  livestream?.moderation?.terminateLabels &&
103
103
  livestream?.moderation?.terminateLabels?.length > 0;
104
104
  const isLiveOrEnded =
105
- livestream?.status === LivestreamStatus.live ||
106
- livestream?.status === LivestreamStatus.ended;
105
+ livestream?.status === RoomStatus.live ||
106
+ livestream?.status === RoomStatus.ended;
107
107
 
108
108
  if (isTerminated && isLiveOrEnded) {
109
109
  return (
110
- <View key={livestream.streamId} style={styles.container}>
110
+ <View key={livestream.roomId} style={styles.container}>
111
111
  <LiveStreamTerminatedThumbnail />
112
112
  </View>
113
113
  );
@@ -129,7 +129,7 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
129
129
  )}
130
130
  </Pressable>
131
131
  <View style={styles.container}>
132
- {(livestream.status === LivestreamStatus.idle || isUpcoming) &&
132
+ {(livestream.status === RoomStatus.idle || isUpcoming) &&
133
133
  thumbnailUrl && (
134
134
  <View style={styles.content}>
135
135
  <Image
@@ -144,12 +144,10 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
144
144
  </View>
145
145
  )}
146
146
 
147
- {livestream.status === LivestreamStatus.ended && (
148
- <LiveStreamEndThumbnail />
149
- )}
147
+ {livestream.status === RoomStatus.ended && <LiveStreamEndThumbnail />}
150
148
 
151
- {(livestream.status === LivestreamStatus.live ||
152
- livestream.status === LivestreamStatus.recorded) &&
149
+ {(livestream.status === RoomStatus.live ||
150
+ livestream.status === RoomStatus.recorded) &&
153
151
  thumbnailUrl &&
154
152
  !isUpcoming && (
155
153
  <View style={styles.content}>
@@ -157,14 +155,15 @@ const LivestreamContent: React.FC<ILivestreamContent> = ({
157
155
  source={thumbnailUrl}
158
156
  style={styles.streamImageCover as ImageStyle}
159
157
  />
160
- {livestream.status === LivestreamStatus.live && (
158
+ {(livestream.status === RoomStatus.live ||
159
+ livestream.status === RoomStatus.waiting_reconnect) && (
161
160
  <View style={styles.streamStatusLive}>
162
161
  <Typography.CaptionBold style={styles.streamStatusText}>
163
162
  LIVE
164
163
  </Typography.CaptionBold>
165
164
  </View>
166
165
  )}
167
- {livestream.status === LivestreamStatus.recorded && (
166
+ {livestream.status === RoomStatus.recorded && (
168
167
  <View style={styles.streamStatusRecorded}>
169
168
  <Typography.CaptionBold style={styles.streamStatusText}>
170
169
  RECORDED