@amityco/react-native-social-uikit 4.0.0-8da9962.0 → 4.0.0-9b57f0b0.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.
- package/lib/commonjs/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
- package/lib/commonjs/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
- package/lib/commonjs/components/MediaSection/index.js +3 -3
- package/lib/commonjs/components/MediaSection/index.js.map +1 -1
- package/lib/commonjs/components/PostTypeChoiceModal/PostTypeChoiceModal.js +14 -5
- package/lib/commonjs/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
- package/lib/commonjs/components/PostTypeChoiceModal/style.js +1 -2
- package/lib/commonjs/components/PostTypeChoiceModal/style.js.map +1 -1
- package/lib/commonjs/components/Social/PostList/index.js +1 -3
- package/lib/commonjs/components/Social/PostList/index.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js +16 -16
- package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js.map +1 -1
- package/lib/commonjs/screens/LivestreamPlayer/index.js +3 -6
- package/lib/commonjs/screens/LivestreamPlayer/index.js.map +1 -1
- package/lib/commonjs/svg/svg-xml-list.js +1 -1
- package/lib/commonjs/util/postTypeChecker.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
- package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
- package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
- package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +28 -25
- package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
- package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +217 -68
- package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +50 -0
- package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
- package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
- package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +150 -124
- package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +1 -1
- package/lib/commonjs/v4/component/LivestreamContent/index.js +12 -12
- package/lib/commonjs/v4/component/LivestreamContent/index.js.map +1 -1
- package/lib/commonjs/v4/component/PostContent/index.js +4 -4
- package/lib/commonjs/v4/component/PostContent/index.js.map +1 -1
- package/lib/commonjs/v4/component/PostMenu/index.js +2 -2
- package/lib/commonjs/v4/component/PostMenu/index.js.map +1 -1
- package/lib/commonjs/v4/component/PreviewLink/LinkPreview.js +3 -3
- package/lib/commonjs/v4/component/PreviewLink/LinkPreview.js.map +1 -1
- package/lib/commonjs/v4/component/PreviewLink/utils.js +9 -73
- package/lib/commonjs/v4/component/PreviewLink/utils.js.map +1 -1
- package/lib/commonjs/v4/component/Toast/index.js +4 -4
- package/lib/commonjs/v4/component/Toast/index.js.map +1 -1
- package/lib/commonjs/v4/component/Toast/styles.js +2 -2
- package/lib/commonjs/v4/component/Toast/styles.js.map +1 -1
- package/lib/commonjs/v4/enum/roomStatus.js +14 -0
- package/lib/commonjs/v4/enum/roomStatus.js.map +1 -0
- package/lib/commonjs/v4/hook/index.js +22 -0
- package/lib/commonjs/v4/hook/index.js.map +1 -1
- package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js +1 -3
- package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
- package/lib/commonjs/v4/hook/usePostSubscription.js +38 -0
- package/lib/commonjs/v4/hook/usePostSubscription.js.map +1 -0
- package/lib/commonjs/v4/hook/useRoomSubscription.js +22 -0
- package/lib/commonjs/v4/hook/useRoomSubscription.js.map +1 -0
- package/lib/commonjs/v4/index.js +7 -0
- package/lib/commonjs/v4/index.js.map +1 -1
- package/lib/commonjs/v4/stores/slices/toast.js +4 -1
- package/lib/commonjs/v4/stores/slices/toast.js.map +1 -1
- package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
- package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
- package/lib/module/components/MediaSection/index.js +3 -3
- package/lib/module/components/MediaSection/index.js.map +1 -1
- package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js +15 -8
- package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
- package/lib/module/components/PostTypeChoiceModal/style.js +1 -2
- package/lib/module/components/PostTypeChoiceModal/style.js.map +1 -1
- package/lib/module/components/Social/PostList/index.js +1 -3
- package/lib/module/components/Social/PostList/index.js.map +1 -1
- package/lib/module/index.js +2 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/CreateLivestream/CreateLivestream.js +17 -17
- package/lib/module/screens/CreateLivestream/CreateLivestream.js.map +1 -1
- package/lib/module/screens/LivestreamPlayer/index.js +4 -8
- package/lib/module/screens/LivestreamPlayer/index.js.map +1 -1
- package/lib/module/svg/svg-xml-list.js +1 -1
- package/lib/module/util/postTypeChecker.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
- package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
- package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
- package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
- package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
- package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
- package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +29 -26
- package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
- package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +222 -72
- package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +42 -0
- package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
- package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
- package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +152 -126
- package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
- package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +1 -1
- package/lib/module/v4/component/LivestreamContent/index.js +13 -13
- package/lib/module/v4/component/LivestreamContent/index.js.map +1 -1
- package/lib/module/v4/component/PostContent/index.js +4 -4
- package/lib/module/v4/component/PostContent/index.js.map +1 -1
- package/lib/module/v4/component/PostMenu/index.js +2 -2
- package/lib/module/v4/component/PostMenu/index.js.map +1 -1
- package/lib/module/v4/component/PreviewLink/LinkPreview.js +3 -3
- package/lib/module/v4/component/PreviewLink/LinkPreview.js.map +1 -1
- package/lib/module/v4/component/PreviewLink/utils.js +9 -73
- package/lib/module/v4/component/PreviewLink/utils.js.map +1 -1
- package/lib/module/v4/component/Toast/index.js +4 -4
- package/lib/module/v4/component/Toast/index.js.map +1 -1
- package/lib/module/v4/component/Toast/styles.js +2 -2
- package/lib/module/v4/component/Toast/styles.js.map +1 -1
- package/lib/module/v4/enum/roomStatus.js +8 -0
- package/lib/module/v4/enum/roomStatus.js.map +1 -0
- package/lib/module/v4/hook/index.js +2 -0
- package/lib/module/v4/hook/index.js.map +1 -1
- package/lib/module/v4/hook/useCustomRankingGlobalFeed.js +1 -3
- package/lib/module/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
- package/lib/module/v4/hook/usePostSubscription.js +31 -0
- package/lib/module/v4/hook/usePostSubscription.js.map +1 -0
- package/lib/module/v4/hook/useRoomSubscription.js +15 -0
- package/lib/module/v4/hook/useRoomSubscription.js.map +1 -0
- package/lib/module/v4/index.js +1 -1
- package/lib/module/v4/index.js.map +1 -1
- package/lib/module/v4/stores/slices/toast.js +4 -1
- package/lib/module/v4/stores/slices/toast.js.map +1 -1
- package/lib/typescript/src/components/MediaSection/index.d.ts.map +1 -1
- package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts +1 -2
- package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts.map +1 -1
- package/lib/typescript/src/components/Social/PostList/index.d.ts +1 -3
- package/lib/typescript/src/components/Social/PostList/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/LivestreamPlayer/index.d.ts.map +1 -1
- package/lib/typescript/src/util/postTypeChecker.d.ts +1 -1
- package/lib/typescript/src/util/postTypeChecker.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts +1 -3
- package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts +1 -0
- package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.d.ts +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts +8 -0
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts.map +1 -0
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts +70 -2
- package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts +1 -0
- package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts +1 -1
- package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/PostContent/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/PreviewLink/utils.d.ts +6 -1
- package/lib/typescript/src/v4/component/PreviewLink/utils.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/Toast/styles.d.ts +1 -1
- package/lib/typescript/src/v4/component/Toast/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/enum/roomStatus.d.ts +8 -0
- package/lib/typescript/src/v4/enum/roomStatus.d.ts.map +1 -0
- package/lib/typescript/src/v4/hook/index.d.ts +2 -0
- package/lib/typescript/src/v4/hook/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts +3 -0
- package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts.map +1 -1
- package/lib/typescript/src/v4/hook/usePostSubscription.d.ts +4 -0
- package/lib/typescript/src/v4/hook/usePostSubscription.d.ts.map +1 -0
- package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts +4 -0
- package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts.map +1 -0
- package/lib/typescript/src/v4/index.d.ts +1 -0
- package/lib/typescript/src/v4/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/routes/RouteParamList.d.ts +1 -1
- package/lib/typescript/src/v4/routes/RouteParamList.d.ts.map +1 -1
- package/lib/typescript/src/v4/stores/slices/toast.d.ts +1 -0
- package/lib/typescript/src/v4/stores/slices/toast.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.tsx +1 -1
- package/src/components/MediaSection/index.tsx +4 -6
- package/src/components/PostTypeChoiceModal/PostTypeChoiceModal.tsx +15 -15
- package/src/components/PostTypeChoiceModal/style.ts +1 -2
- package/src/components/Social/PostList/index.tsx +1 -4
- package/src/index.tsx +2 -2
- package/src/screens/CreateLivestream/CreateLivestream.tsx +17 -17
- package/src/screens/LivestreamPlayer/index.tsx +9 -15
- package/src/svg/svg-xml-list.ts +1 -1
- package/src/util/postTypeChecker.ts +1 -1
- package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx +10 -10
- package/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.tsx +1 -1
- package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.tsx +1 -1
- package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.tsx +1 -1
- package/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.ts +3 -2
- package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.tsx +24 -25
- package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.ts +2 -2
- package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.tsx +255 -89
- package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.tsx +48 -0
- package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.ts +72 -3
- package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.tsx +205 -154
- package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.ts +2 -0
- package/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.tsx +1 -1
- package/src/v4/component/LivestreamContent/index.tsx +21 -22
- package/src/v4/component/PostContent/index.tsx +6 -8
- package/src/v4/component/PostMenu/index.tsx +2 -2
- package/src/v4/component/PreviewLink/LinkPreview.tsx +3 -3
- package/src/v4/component/PreviewLink/utils.ts +9 -108
- package/src/v4/component/Toast/index.tsx +1 -1
- package/src/v4/component/Toast/styles.ts +2 -2
- package/src/v4/enum/roomStatus.ts +7 -0
- package/src/v4/hook/index.ts +2 -0
- package/src/v4/hook/useCustomRankingGlobalFeed.ts +1 -1
- package/src/v4/hook/usePostSubscription.ts +34 -0
- package/src/v4/hook/useRoomSubscription.ts +19 -0
- package/src/v4/index.tsx +1 -1
- package/src/v4/routes/RouteParamList.tsx +1 -1
- package/src/v4/stores/slices/toast.ts +5 -0
- package/uikit.config.json +1 -1
- package/lib/commonjs/v4/enum/livestreamStatus.js +0 -13
- package/lib/commonjs/v4/enum/livestreamStatus.js.map +0 -1
- package/lib/module/v4/enum/livestreamStatus.js +0 -7
- package/lib/module/v4/enum/livestreamStatus.js.map +0 -1
- package/lib/typescript/src/v4/enum/livestreamStatus.d.ts +0 -7
- package/lib/typescript/src/v4/enum/livestreamStatus.d.ts.map +0 -1
- package/src/v4/enum/livestreamStatus.ts +0 -6
|
@@ -35,8 +35,7 @@ import { RootStackParamList } from '../../../routes/RouteParamList';
|
|
|
35
35
|
import CommunityCreatePostButton from '../../../elements/CommunityCreatePostButton/CommunityCreatePostButton';
|
|
36
36
|
import { SvgXml } from 'react-native-svg';
|
|
37
37
|
import { useBehaviour } from '../../../../v4/providers/BehaviourProvider';
|
|
38
|
-
|
|
39
|
-
import { poll, post, story } from '../../../../v4/assets/icons';
|
|
38
|
+
import { livestream, poll, post, story } from '../../../../v4/assets/icons';
|
|
40
39
|
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
|
|
41
40
|
|
|
42
41
|
import { useTheme } from 'react-native-paper';
|
|
@@ -265,7 +264,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
|
|
|
265
264
|
AmityPostTargetSelectionPageBehavior,
|
|
266
265
|
AmityPollTargetSelectionPageBehavior,
|
|
267
266
|
AmityStoryTargetSelectionPageBehavior,
|
|
268
|
-
|
|
267
|
+
AmityLivestreamPostTargetSelectionPageBehavior,
|
|
269
268
|
} = useBehaviour();
|
|
270
269
|
const navigation =
|
|
271
270
|
useNavigation<
|
|
@@ -311,26 +310,26 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
|
|
|
311
310
|
});
|
|
312
311
|
};
|
|
313
312
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
313
|
+
const handleCreateLivestream = () => {
|
|
314
|
+
closeBottomSheet();
|
|
315
|
+
|
|
316
|
+
if (
|
|
317
|
+
AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage
|
|
318
|
+
) {
|
|
319
|
+
return AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage(
|
|
320
|
+
{
|
|
321
|
+
targetId: communityId,
|
|
322
|
+
targetType: 'community',
|
|
323
|
+
targetName: community?.displayName,
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
navigation.navigate('CreateLivestream', {
|
|
328
|
+
targetId: communityId,
|
|
329
|
+
targetType: 'community',
|
|
330
|
+
targetName: community?.displayName,
|
|
331
|
+
});
|
|
332
|
+
};
|
|
334
333
|
|
|
335
334
|
const handleCreatePoll = () => {
|
|
336
335
|
closeBottomSheet();
|
|
@@ -398,7 +397,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
|
|
|
398
397
|
<SvgXml width={24} height={24} xml={poll()} color={colors.base} />
|
|
399
398
|
<Text style={styles.bottomSheetOptionText}>Poll</Text>
|
|
400
399
|
</TouchableOpacity>
|
|
401
|
-
|
|
400
|
+
<TouchableOpacity
|
|
402
401
|
onPress={handleCreateLivestream}
|
|
403
402
|
style={styles.bottomSheetOption}
|
|
404
403
|
>
|
|
@@ -409,7 +408,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
|
|
|
409
408
|
color={colors.base}
|
|
410
409
|
/>
|
|
411
410
|
<Text style={styles.bottomSheetOptionText}>Livestream</Text>
|
|
412
|
-
</TouchableOpacity>
|
|
411
|
+
</TouchableOpacity>
|
|
413
412
|
</Animated.View>
|
|
414
413
|
</Pressable>
|
|
415
414
|
</Modal>
|
|
@@ -41,7 +41,7 @@ export const useStyles = (theme: MyMD3Theme) => {
|
|
|
41
41
|
backgroundColor: theme.colors.background,
|
|
42
42
|
borderTopLeftRadius: 20,
|
|
43
43
|
borderTopRightRadius: 20,
|
|
44
|
-
|
|
44
|
+
paddingHorizontal: 16,
|
|
45
45
|
minHeight: 200,
|
|
46
46
|
paddingBottom: insets.bottom + 10,
|
|
47
47
|
},
|
|
@@ -57,7 +57,7 @@ export const useStyles = (theme: MyMD3Theme) => {
|
|
|
57
57
|
flexDirection: 'row',
|
|
58
58
|
alignItems: 'center',
|
|
59
59
|
paddingVertical: 16,
|
|
60
|
-
paddingHorizontal:
|
|
60
|
+
paddingHorizontal: 0,
|
|
61
61
|
},
|
|
62
62
|
bottomSheetOptionText: {
|
|
63
63
|
fontSize: 16,
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useCallback,
|
|
3
|
-
useEffect,
|
|
4
|
-
useLayoutEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
2
|
import {
|
|
9
3
|
Alert,
|
|
10
4
|
Image,
|
|
@@ -12,20 +6,15 @@ import {
|
|
|
12
6
|
Platform,
|
|
13
7
|
TextInput,
|
|
14
8
|
TouchableOpacity,
|
|
15
|
-
// Linking,
|
|
16
9
|
View,
|
|
17
10
|
ImageStyle,
|
|
11
|
+
Linking,
|
|
18
12
|
} from 'react-native';
|
|
19
13
|
import { useStyles } from './styles';
|
|
20
14
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
21
|
-
// import {
|
|
22
|
-
// AmityStreamBroadcasterState,
|
|
23
|
-
// AmityVideoBroadcaster,
|
|
24
|
-
// // @ts-ignore
|
|
25
|
-
// } from '@amityco/video-broadcaster-react-native';
|
|
26
15
|
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
|
|
27
16
|
import useImagePicker from '../../../../v4/hook/useImagePicker';
|
|
28
|
-
import { arrowDown } from '../../../../v4/assets/icons';
|
|
17
|
+
import { arrowDown, close } from '../../../../v4/assets/icons';
|
|
29
18
|
import { SvgXml } from 'react-native-svg';
|
|
30
19
|
import { Typography } from '../../../component/Typography/Typography';
|
|
31
20
|
import { useTheme } from 'react-native-paper';
|
|
@@ -33,12 +22,12 @@ import { MyMD3Theme } from '../../../../providers/amity-ui-kit-provider';
|
|
|
33
22
|
import { useBottomSheet } from '../../../../redux/slices/bottomSheetSlice';
|
|
34
23
|
import { CircularProgressIndicator } from '../../../component/CircularProgressIndicator';
|
|
35
24
|
import { RootStackParamList } from '../../../../v4/routes/RouteParamList';
|
|
36
|
-
import { PostRepository,
|
|
25
|
+
import { PostRepository, RoomRepository } from '@amityco/ts-sdk-react-native';
|
|
37
26
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
38
|
-
|
|
27
|
+
import Button from '../../../component/Button/Button';
|
|
39
28
|
import { useRequestPermission } from '../../../../v4/hook/useCamera';
|
|
40
29
|
import NetInfo from '@react-native-community/netinfo';
|
|
41
|
-
import {
|
|
30
|
+
import { RoomStatus } from '../../../enum/roomStatus';
|
|
42
31
|
import { AmityThumbnailActionComponent } from '../../Components/AmityThumbnailActionComponent';
|
|
43
32
|
import { StartLivestreamButton } from '../../../elements/StartLivestreamButton';
|
|
44
33
|
import { PageID } from '../../../enum';
|
|
@@ -47,6 +36,18 @@ import { CancelCreateLivestreamButton } from '../../../elements/CancelCreateLive
|
|
|
47
36
|
import { EndLiveStreamButton } from '../../../elements/EndLiveStreamButton';
|
|
48
37
|
import { AddThumbnailButton } from '../../../elements/AddThumbnailButton';
|
|
49
38
|
import { SwitchCameraButton } from '../../../elements/SwitchCameraButton';
|
|
39
|
+
import { Track, LocalVideoTrack } from 'livekit-client';
|
|
40
|
+
import { LiveKitRoom, registerGlobals } from '@livekit/react-native';
|
|
41
|
+
import { RoomView } from './RoomView';
|
|
42
|
+
import { Camera, useCameraDevice } from 'react-native-vision-camera';
|
|
43
|
+
import { useRoomSubscription } from '../../../../v4/hook/useRoomSubscription';
|
|
44
|
+
import { useToast } from '../../../../v4/stores/slices/toast';
|
|
45
|
+
import { usePostSubscription } from '../../../../v4/hook';
|
|
46
|
+
|
|
47
|
+
// Register WebRTC globals required for LiveKit
|
|
48
|
+
registerGlobals();
|
|
49
|
+
|
|
50
|
+
const serverUrl = 'wss://sp-live-3tr59jrk.livekit.cloud';
|
|
50
51
|
|
|
51
52
|
const calculateTime = (time: number) => {
|
|
52
53
|
const hours = Math.floor(time / 3600000);
|
|
@@ -64,7 +65,6 @@ const calculateTime = (time: number) => {
|
|
|
64
65
|
|
|
65
66
|
function AmityCreateLivestreamPage() {
|
|
66
67
|
const styles = useStyles();
|
|
67
|
-
const streamRef = useRef<any>(null);
|
|
68
68
|
const navigation =
|
|
69
69
|
useNavigation<NativeStackNavigationProp<RootStackParamList>>();
|
|
70
70
|
const theme = useTheme<MyMD3Theme>();
|
|
@@ -75,15 +75,31 @@ function AmityCreateLivestreamPage() {
|
|
|
75
75
|
const [isLive, setIsLive] = useState<boolean>(false);
|
|
76
76
|
const [description, setDescription] = useState<string>('');
|
|
77
77
|
const [isEnding, setIsEnding] = useState<boolean>(false);
|
|
78
|
+
const [countdown, setCountdown] = useState<number | null>(null);
|
|
78
79
|
const [post, setPost] = useState<Amity.Post | null>(null);
|
|
79
|
-
const [
|
|
80
|
-
const
|
|
80
|
+
const [room, setRoom] = useState<Amity.Room | null>(null);
|
|
81
|
+
const timerRef = useRef<number | null>(null);
|
|
81
82
|
const [isConnecting, setIsConnecting] = useState<boolean>(false);
|
|
82
83
|
const [androidPermission, setAndroidPermission] = useState<boolean>(false);
|
|
83
84
|
const [iOSPermission, setIOSPermission] = useState<boolean>(true);
|
|
84
85
|
const [reconnecting, setReconnecting] = useState<boolean>(false);
|
|
86
|
+
const [livekitParticipant, setLivekitParticipant] = useState<any>(null);
|
|
87
|
+
const [isFrontCamera, setIsFrontCamera] = useState<boolean>(true);
|
|
88
|
+
const [roomToken, setRoomToken] = useState<Amity.BroadcasterData | null>(
|
|
89
|
+
null
|
|
90
|
+
);
|
|
85
91
|
const unsubscribeRef = useRef<Amity.Unsubscriber>(null);
|
|
86
92
|
|
|
93
|
+
useRoomSubscription({ room });
|
|
94
|
+
|
|
95
|
+
const { subscribedPost } = usePostSubscription(post?.postId || '');
|
|
96
|
+
|
|
97
|
+
const { showToast } = useToast();
|
|
98
|
+
|
|
99
|
+
const frontCamera = useCameraDevice('front');
|
|
100
|
+
const backCamera = useCameraDevice('back');
|
|
101
|
+
const cameraDevice = isFrontCamera ? frontCamera : backCamera;
|
|
102
|
+
|
|
87
103
|
const {
|
|
88
104
|
imageUri,
|
|
89
105
|
isLoading,
|
|
@@ -100,6 +116,43 @@ function AmityCreateLivestreamPage() {
|
|
|
100
116
|
(Platform.OS === 'android' && androidPermission) ||
|
|
101
117
|
(Platform.OS === 'ios' && iOSPermission);
|
|
102
118
|
|
|
119
|
+
const fourHours = 4 * 60 * 60 * 1000; // 4 hours
|
|
120
|
+
const countdownStart = fourHours - 10 * 1000; // Start countdown 10 seconds before end
|
|
121
|
+
const toastTriggerTime = fourHours - 3 * 60 * 1000; // Show toast 3 minutes before end
|
|
122
|
+
|
|
123
|
+
const switchCamera = useCallback(async () => {
|
|
124
|
+
if (isLive && livekitParticipant) {
|
|
125
|
+
try {
|
|
126
|
+
const cameraPublication = livekitParticipant.getTrackPublication(
|
|
127
|
+
Track.Source.Camera
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
if (cameraPublication?.track) {
|
|
131
|
+
const videoTrack = cameraPublication.track as LocalVideoTrack;
|
|
132
|
+
|
|
133
|
+
// Stop current camera
|
|
134
|
+
await videoTrack.stop();
|
|
135
|
+
|
|
136
|
+
// Get new facing mode
|
|
137
|
+
const newFacingMode = isFrontCamera ? 'environment' : 'user';
|
|
138
|
+
|
|
139
|
+
// Restart camera with new facing mode
|
|
140
|
+
await videoTrack.restartTrack({
|
|
141
|
+
facingMode: newFacingMode,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// Toggle the camera state
|
|
145
|
+
setIsFrontCamera((prev) => !prev);
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.error('Failed to switch camera:', error);
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
// Just toggle the camera state for preview
|
|
152
|
+
setIsFrontCamera((prev) => !prev);
|
|
153
|
+
}
|
|
154
|
+
}, [livekitParticipant, isFrontCamera, isLive]);
|
|
155
|
+
|
|
103
156
|
useRequestPermission({
|
|
104
157
|
shouldCall: Platform.OS === 'ios',
|
|
105
158
|
onRequestPermissionFailed: (callback?: () => void) => {
|
|
@@ -156,37 +209,54 @@ function AmityCreateLivestreamPage() {
|
|
|
156
209
|
setIsLive(true);
|
|
157
210
|
setIsConnecting(true);
|
|
158
211
|
|
|
159
|
-
const { data: newStream } = await
|
|
212
|
+
const { data: newStream } = await RoomRepository.createRoom({
|
|
160
213
|
title,
|
|
161
214
|
description: description || undefined,
|
|
162
215
|
thumbnailFileId: uploadedImage?.fileId,
|
|
216
|
+
type: 'coHosts',
|
|
163
217
|
});
|
|
164
218
|
|
|
219
|
+
setRoom(newStream);
|
|
220
|
+
|
|
165
221
|
if (newStream) {
|
|
222
|
+
const roomTokenResponse = await RoomRepository.getBroadcasterData(
|
|
223
|
+
newStream.roomId
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
setRoomToken(roomTokenResponse);
|
|
227
|
+
|
|
166
228
|
const params = {
|
|
167
229
|
targetId,
|
|
168
230
|
targetType,
|
|
169
|
-
dataType: '
|
|
231
|
+
dataType: 'room' as Amity.PostContentType,
|
|
170
232
|
data: {
|
|
171
233
|
text: `${newStream.title}${
|
|
172
234
|
newStream.description ? `\n\n${newStream.description}` : ''
|
|
173
235
|
}`,
|
|
174
|
-
|
|
236
|
+
roomId: newStream.roomId,
|
|
175
237
|
},
|
|
176
238
|
};
|
|
177
239
|
|
|
178
240
|
const newPost = await PostRepository.createPost(params);
|
|
179
241
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
242
|
+
setPost(newPost.data);
|
|
243
|
+
|
|
244
|
+
// Set isConnecting to false since LiveKit room is already connected
|
|
245
|
+
setIsConnecting(false);
|
|
246
|
+
|
|
247
|
+
// Start the timer when live stream actually starts
|
|
248
|
+
if (timerRef.current) {
|
|
249
|
+
clearInterval(timerRef.current);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const intervalId = setInterval(() => {
|
|
253
|
+
setTime((prev) => prev + 1000);
|
|
254
|
+
}, 1000);
|
|
255
|
+
|
|
256
|
+
timerRef.current = intervalId;
|
|
188
257
|
}
|
|
189
258
|
} catch (error) {
|
|
259
|
+
console.log('startLiveStream error', error);
|
|
190
260
|
setIsLive(false);
|
|
191
261
|
setIsConnecting(false);
|
|
192
262
|
Alert.alert(
|
|
@@ -201,17 +271,6 @@ function AmityCreateLivestreamPage() {
|
|
|
201
271
|
}
|
|
202
272
|
};
|
|
203
273
|
|
|
204
|
-
// const onBroadcastStateChange = (state: AmityStreamBroadcasterState) => {
|
|
205
|
-
// if (state === AmityStreamBroadcasterState.CONNECTED) {
|
|
206
|
-
// setIsConnecting(false);
|
|
207
|
-
// setReconnecting(false);
|
|
208
|
-
// const intervalId = setInterval(() => {
|
|
209
|
-
// setTime((prev) => prev + 1000);
|
|
210
|
-
// }, 1000);
|
|
211
|
-
// setTimer(intervalId);
|
|
212
|
-
// }
|
|
213
|
-
// };
|
|
214
|
-
|
|
215
274
|
const confirmEndStreamAlert = () => {
|
|
216
275
|
Alert.alert(
|
|
217
276
|
'End live stream?',
|
|
@@ -234,21 +293,22 @@ function AmityCreateLivestreamPage() {
|
|
|
234
293
|
|
|
235
294
|
const endLiveStream = useCallback(
|
|
236
295
|
async (showEndPopup = false) => {
|
|
237
|
-
if (
|
|
296
|
+
if (room) {
|
|
238
297
|
setIsEnding(true);
|
|
239
298
|
try {
|
|
240
|
-
await
|
|
299
|
+
await RoomRepository.stopRoom(room.roomId);
|
|
241
300
|
} catch (e) {
|
|
242
301
|
console.log('disposeStream error', e);
|
|
243
302
|
} finally {
|
|
244
|
-
streamRef?.current.stopPublish();
|
|
245
|
-
|
|
246
303
|
setIsLive(false);
|
|
247
|
-
|
|
304
|
+
setRoom(null);
|
|
248
305
|
setTitle('');
|
|
249
306
|
setDescription('');
|
|
250
307
|
setTime(0);
|
|
251
|
-
|
|
308
|
+
if (timerRef.current) {
|
|
309
|
+
clearInterval(timerRef.current);
|
|
310
|
+
timerRef.current = null;
|
|
311
|
+
}
|
|
252
312
|
setIsEnding(false);
|
|
253
313
|
setReconnecting(false);
|
|
254
314
|
|
|
@@ -259,15 +319,40 @@ function AmityCreateLivestreamPage() {
|
|
|
259
319
|
}
|
|
260
320
|
}
|
|
261
321
|
},
|
|
262
|
-
[post,
|
|
322
|
+
[post, room, navigation]
|
|
263
323
|
);
|
|
264
324
|
|
|
265
325
|
useEffect(() => {
|
|
266
|
-
|
|
267
|
-
if (
|
|
326
|
+
// Show toast when 3 minutes left
|
|
327
|
+
if (room && time >= toastTriggerTime && time < toastTriggerTime + 1000) {
|
|
328
|
+
showToast({
|
|
329
|
+
type: 'informative',
|
|
330
|
+
message:
|
|
331
|
+
'Your live will automatically end once it reaches 4-hour limit.',
|
|
332
|
+
duration: 3000,
|
|
333
|
+
bottomPosition: 96,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (room && time >= fourHours) {
|
|
268
338
|
endLiveStream(true);
|
|
339
|
+
setCountdown(null);
|
|
340
|
+
} else if (room && time >= countdownStart && time < fourHours) {
|
|
341
|
+
// Calculate countdown from 10 to 0
|
|
342
|
+
const remaining = Math.ceil((fourHours - time) / 1000);
|
|
343
|
+
setCountdown(remaining);
|
|
344
|
+
} else {
|
|
345
|
+
setCountdown(null);
|
|
269
346
|
}
|
|
270
|
-
}, [
|
|
347
|
+
}, [
|
|
348
|
+
endLiveStream,
|
|
349
|
+
room,
|
|
350
|
+
time,
|
|
351
|
+
showToast,
|
|
352
|
+
toastTriggerTime,
|
|
353
|
+
fourHours,
|
|
354
|
+
countdownStart,
|
|
355
|
+
]);
|
|
271
356
|
|
|
272
357
|
useEffect(() => {
|
|
273
358
|
if (Platform.OS === 'android') checkPermissionAndroid();
|
|
@@ -284,48 +369,45 @@ function AmityCreateLivestreamPage() {
|
|
|
284
369
|
return () => unsubscribe();
|
|
285
370
|
}, []);
|
|
286
371
|
|
|
287
|
-
useLayoutEffect(() => {
|
|
288
|
-
setTimeout(() => {
|
|
289
|
-
streamRef.current && streamRef.current.switchCamera();
|
|
290
|
-
}, 300);
|
|
291
|
-
}, [streamRef]);
|
|
292
|
-
|
|
293
372
|
useEffect(() => {
|
|
294
373
|
let threeMinutesTimeout: number;
|
|
295
374
|
|
|
296
|
-
if (reconnecting &&
|
|
375
|
+
if (reconnecting && room && room?.status === RoomStatus.live) {
|
|
297
376
|
threeMinutesTimeout = setTimeout(() => {
|
|
298
377
|
endLiveStream();
|
|
299
378
|
}, 1000 * 60 * 3);
|
|
300
379
|
}
|
|
301
380
|
|
|
302
|
-
if (
|
|
303
|
-
!reconnecting &&
|
|
304
|
-
stream &&
|
|
305
|
-
stream?.status === 'live' &&
|
|
306
|
-
streamRef?.current
|
|
307
|
-
) {
|
|
308
|
-
streamRef?.current?.startPublish(stream?.streamId);
|
|
309
|
-
|
|
381
|
+
if (!reconnecting && room && room?.status === RoomStatus.live) {
|
|
310
382
|
if (threeMinutesTimeout) {
|
|
311
383
|
clearTimeout(threeMinutesTimeout);
|
|
312
384
|
threeMinutesTimeout = null;
|
|
313
385
|
}
|
|
314
386
|
}
|
|
315
|
-
}, [reconnecting, endLiveStream,
|
|
387
|
+
}, [reconnecting, endLiveStream, room]);
|
|
316
388
|
|
|
317
389
|
useEffect(() => {
|
|
318
390
|
const isTerminated =
|
|
319
|
-
|
|
320
|
-
|
|
391
|
+
room?.moderation?.terminateLabels &&
|
|
392
|
+
room?.moderation?.terminateLabels?.length > 0;
|
|
321
393
|
const isLiveOrEnded =
|
|
322
|
-
|
|
323
|
-
stream?.status === LivestreamStatus.ended;
|
|
394
|
+
room?.status === RoomStatus.live || room?.status === RoomStatus.ended;
|
|
324
395
|
|
|
325
396
|
if (isLiveOrEnded && isTerminated) {
|
|
326
397
|
navigation.replace('LivestreamTerminated', { type: 'streamer' });
|
|
327
398
|
}
|
|
328
|
-
}, [
|
|
399
|
+
}, [room?.moderation?.terminateLabels, room?.status, navigation]);
|
|
400
|
+
|
|
401
|
+
useEffect(() => {
|
|
402
|
+
if (room?.isDeleted || subscribedPost?.isDeleted) {
|
|
403
|
+
navigation.replace('PostDetail', { postId: subscribedPost?.postId });
|
|
404
|
+
}
|
|
405
|
+
}, [
|
|
406
|
+
navigation,
|
|
407
|
+
room?.isDeleted,
|
|
408
|
+
subscribedPost?.postId,
|
|
409
|
+
subscribedPost?.isDeleted,
|
|
410
|
+
]);
|
|
329
411
|
|
|
330
412
|
useEffect(() => {
|
|
331
413
|
const unsubscribe = unsubscribeRef.current;
|
|
@@ -345,17 +427,53 @@ function AmityCreateLivestreamPage() {
|
|
|
345
427
|
style={[styles.overlay, !hasPermission && styles.noPermissionOverlay]}
|
|
346
428
|
/>
|
|
347
429
|
)}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
430
|
+
|
|
431
|
+
{/* Preview camera part */}
|
|
432
|
+
|
|
433
|
+
{hasPermission ? (
|
|
434
|
+
roomToken ? (
|
|
435
|
+
<LiveKitRoom
|
|
436
|
+
serverUrl={serverUrl}
|
|
437
|
+
token={roomToken.coHostToken}
|
|
438
|
+
connect={true}
|
|
439
|
+
options={{
|
|
440
|
+
adaptiveStream: { pixelDensity: 'screen' },
|
|
441
|
+
}}
|
|
442
|
+
audio={{
|
|
443
|
+
echoCancellation: true,
|
|
444
|
+
noiseSuppression: true,
|
|
445
|
+
autoGainControl: true,
|
|
446
|
+
}}
|
|
447
|
+
video={{
|
|
448
|
+
facingMode: isFrontCamera ? 'user' : 'environment',
|
|
449
|
+
}}
|
|
450
|
+
onConnected={() => {
|
|
451
|
+
setIsConnecting(false);
|
|
452
|
+
setReconnecting(false);
|
|
453
|
+
}}
|
|
454
|
+
>
|
|
455
|
+
<View style={styles.cameraContainer}>
|
|
456
|
+
<View style={styles.camera}>
|
|
457
|
+
<RoomView
|
|
458
|
+
onLocalParticipantReady={setLivekitParticipant}
|
|
459
|
+
isFrontCamera={isFrontCamera}
|
|
460
|
+
/>
|
|
461
|
+
</View>
|
|
462
|
+
</View>
|
|
463
|
+
</LiveKitRoom>
|
|
464
|
+
) : (
|
|
465
|
+
<View style={styles.cameraContainer}>
|
|
466
|
+
<View style={styles.camera}>
|
|
467
|
+
{cameraDevice && (
|
|
468
|
+
<Camera
|
|
469
|
+
style={{ flex: 1 }}
|
|
470
|
+
device={cameraDevice}
|
|
471
|
+
isActive={true}
|
|
472
|
+
/>
|
|
473
|
+
)}
|
|
474
|
+
</View>
|
|
357
475
|
</View>
|
|
358
|
-
|
|
476
|
+
)
|
|
359
477
|
) : (
|
|
360
478
|
<View style={styles.permission}>
|
|
361
479
|
<Typography.TitleBold style={styles.permissionTitle}>
|
|
@@ -374,7 +492,8 @@ function AmityCreateLivestreamPage() {
|
|
|
374
492
|
</Typography.BodyBold>
|
|
375
493
|
</Button>
|
|
376
494
|
</View>
|
|
377
|
-
)}
|
|
495
|
+
)}
|
|
496
|
+
|
|
378
497
|
{isEnding && (
|
|
379
498
|
<View style={styles.connecting}>
|
|
380
499
|
<CircularProgressIndicator size={40} strokeWidth={2} />
|
|
@@ -406,12 +525,46 @@ function AmityCreateLivestreamPage() {
|
|
|
406
525
|
</Typography.Caption>
|
|
407
526
|
</View>
|
|
408
527
|
)}
|
|
528
|
+
|
|
529
|
+
<TouchableOpacity
|
|
530
|
+
style={styles.closeButton}
|
|
531
|
+
onPress={() => confirmEndStreamAlert()}
|
|
532
|
+
>
|
|
533
|
+
<SvgXml
|
|
534
|
+
xml={close()}
|
|
535
|
+
width="28"
|
|
536
|
+
height="28"
|
|
537
|
+
color={theme.colors.background}
|
|
538
|
+
/>
|
|
539
|
+
</TouchableOpacity>
|
|
540
|
+
|
|
409
541
|
<View style={styles.timer}>
|
|
410
542
|
<LiveTimerStatus
|
|
411
543
|
time={calculateTime(time)}
|
|
412
544
|
pageId={PageID.create_livestream_page}
|
|
413
545
|
/>
|
|
414
546
|
</View>
|
|
547
|
+
{countdown !== null && (
|
|
548
|
+
<View style={styles.countdownOverlay}>
|
|
549
|
+
<View style={styles.countdownContainer}>
|
|
550
|
+
<Typography.TitleBold style={styles.countdownText}>
|
|
551
|
+
Live stream ends in
|
|
552
|
+
</Typography.TitleBold>
|
|
553
|
+
<View style={styles.countdownCircle}>
|
|
554
|
+
<CircularProgressIndicator
|
|
555
|
+
size={64}
|
|
556
|
+
strokeWidth={2}
|
|
557
|
+
progress={((10 - countdown) / 10) * 100}
|
|
558
|
+
/>
|
|
559
|
+
<View style={styles.countdownNumberContainer}>
|
|
560
|
+
<Typography.Title style={styles.countdownNumber}>
|
|
561
|
+
{countdown}
|
|
562
|
+
</Typography.Title>
|
|
563
|
+
</View>
|
|
564
|
+
</View>
|
|
565
|
+
</View>
|
|
566
|
+
</View>
|
|
567
|
+
)}
|
|
415
568
|
</>
|
|
416
569
|
)
|
|
417
570
|
) : (
|
|
@@ -443,7 +596,18 @@ function AmityCreateLivestreamPage() {
|
|
|
443
596
|
/>
|
|
444
597
|
<TouchableOpacity
|
|
445
598
|
style={styles.communityButton}
|
|
446
|
-
onPress={() =>
|
|
599
|
+
onPress={() => {
|
|
600
|
+
const state = navigation.getState();
|
|
601
|
+
const routes = state.routes;
|
|
602
|
+
const currentIndex = state.index;
|
|
603
|
+
const previousRoute = routes[currentIndex - 1];
|
|
604
|
+
|
|
605
|
+
if (previousRoute?.name === 'LivestreamPostTargetSelection') {
|
|
606
|
+
navigation.goBack();
|
|
607
|
+
} else {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
}}
|
|
447
611
|
activeOpacity={0.7}
|
|
448
612
|
>
|
|
449
613
|
<Typography.Body
|
|
@@ -452,7 +616,11 @@ function AmityCreateLivestreamPage() {
|
|
|
452
616
|
ellipsizeMode="tail"
|
|
453
617
|
>
|
|
454
618
|
Live on{' '}
|
|
455
|
-
<Typography.BodyBold
|
|
619
|
+
<Typography.BodyBold
|
|
620
|
+
numberOfLines={1}
|
|
621
|
+
ellipsizeMode="tail"
|
|
622
|
+
style={styles.communityName}
|
|
623
|
+
>
|
|
456
624
|
{targetName}
|
|
457
625
|
</Typography.BodyBold>
|
|
458
626
|
</Typography.Body>
|
|
@@ -567,9 +735,7 @@ function AmityCreateLivestreamPage() {
|
|
|
567
735
|
)}
|
|
568
736
|
<SwitchCameraButton
|
|
569
737
|
pageId={PageID.create_livestream_page}
|
|
570
|
-
onPress={
|
|
571
|
-
streamRef.current && streamRef.current.switchCamera();
|
|
572
|
-
}}
|
|
738
|
+
onPress={switchCamera}
|
|
573
739
|
/>
|
|
574
740
|
</View>
|
|
575
741
|
</SafeAreaView>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Track } from 'livekit-client';
|
|
4
|
+
import { VideoTrack, useLocalParticipant } from '@livekit/react-native';
|
|
5
|
+
import { useStyles } from './styles';
|
|
6
|
+
|
|
7
|
+
interface RoomViewProps {
|
|
8
|
+
onLocalParticipantReady?: (participant: any) => void;
|
|
9
|
+
isFrontCamera: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const RoomView: React.FC<RoomViewProps> = ({
|
|
13
|
+
onLocalParticipantReady,
|
|
14
|
+
isFrontCamera,
|
|
15
|
+
}) => {
|
|
16
|
+
const { localParticipant } = useLocalParticipant();
|
|
17
|
+
const styles = useStyles();
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (localParticipant && onLocalParticipantReady) {
|
|
21
|
+
onLocalParticipantReady(localParticipant);
|
|
22
|
+
}
|
|
23
|
+
}, [localParticipant, onLocalParticipantReady]);
|
|
24
|
+
|
|
25
|
+
if (!localParticipant?.isCameraEnabled) {
|
|
26
|
+
return <View style={styles.roomContainer} />;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const cameraTrack = localParticipant.getTrackPublication(Track.Source.Camera);
|
|
30
|
+
|
|
31
|
+
if (!cameraTrack?.track) {
|
|
32
|
+
return <View style={styles.roomContainer} />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View style={styles.roomContainer}>
|
|
37
|
+
<VideoTrack
|
|
38
|
+
trackRef={{
|
|
39
|
+
participant: localParticipant,
|
|
40
|
+
publication: cameraTrack,
|
|
41
|
+
source: Track.Source.Camera,
|
|
42
|
+
}}
|
|
43
|
+
style={styles.videoTrack}
|
|
44
|
+
mirror={isFrontCamera}
|
|
45
|
+
/>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
};
|