@stream-io/video-react-native-sdk 0.1.9 → 0.1.11
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/CHANGELOG.md +18 -0
- package/README.md +5 -4
- package/dist/commonjs/components/Call/CallContent/CallContent.js +1 -1
- package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
- package/dist/commonjs/components/Livestream/HostLivestream/HostLivestream.js +71 -0
- package/dist/commonjs/components/Livestream/HostLivestream/HostLivestream.js.map +1 -0
- package/dist/commonjs/components/Livestream/HostLivestream/index.js +17 -0
- package/dist/commonjs/components/Livestream/HostLivestream/index.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/HostLivestreamControls.js +69 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/HostLivestreamControls.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/HostStartStreamButton.js +113 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/HostStartStreamButton.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js +70 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamMediaControls.js +38 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamMediaControls.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js +70 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js +83 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/ViewerLivestreamControls.js +64 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/ViewerLivestreamControls.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/index.js +61 -0
- package/dist/commonjs/components/Livestream/LivestreamControls/index.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamLayout/LivestreamLayout.js +65 -0
- package/dist/commonjs/components/Livestream/LivestreamLayout/LivestreamLayout.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamLayout/index.js +17 -0
- package/dist/commonjs/components/Livestream/LivestreamLayout/index.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/DurationBadge.js +144 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/DurationBadge.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/FollowerCount.js +71 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/FollowerCount.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/HostLivestreamTopView.js +87 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/HostLivestreamTopView.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/LiveIndicator.js +55 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/LiveIndicator.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.js +80 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.js.map +1 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/index.js +50 -0
- package/dist/commonjs/components/Livestream/LivestreamTopView/index.js.map +1 -0
- package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLivestream.js +88 -0
- package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLivestream.js.map +1 -0
- package/dist/commonjs/components/Livestream/ViewerLivestream/index.js +17 -0
- package/dist/commonjs/components/Livestream/ViewerLivestream/index.js.map +1 -0
- package/dist/commonjs/components/Livestream/index.js +61 -0
- package/dist/commonjs/components/Livestream/index.js.map +1 -0
- package/dist/commonjs/components/index.js +11 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/hooks/usePaginatedLayoutSortPreset.js +26 -0
- package/dist/commonjs/hooks/usePaginatedLayoutSortPreset.js.map +1 -0
- package/dist/commonjs/icons/EndStreamIcon.js +20 -0
- package/dist/commonjs/icons/EndStreamIcon.js.map +1 -0
- package/dist/commonjs/icons/Eye.js +20 -0
- package/dist/commonjs/icons/Eye.js.map +1 -0
- package/dist/commonjs/icons/LeaveStreamIcon.js +20 -0
- package/dist/commonjs/icons/LeaveStreamIcon.js.map +1 -0
- package/dist/commonjs/icons/ShieldBadge.js +20 -0
- package/dist/commonjs/icons/ShieldBadge.js.map +1 -0
- package/dist/commonjs/icons/StartStreamIcon.js +20 -0
- package/dist/commonjs/icons/StartStreamIcon.js.map +1 -0
- package/dist/commonjs/icons/index.js +55 -0
- package/dist/commonjs/icons/index.js.map +1 -1
- package/dist/commonjs/theme/theme.js +70 -0
- package/dist/commonjs/theme/theme.js.map +1 -1
- package/dist/commonjs/translations/en.json +6 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/commonjs/version.js.map +1 -1
- package/dist/module/components/Call/CallContent/CallContent.js +1 -1
- package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
- package/dist/module/components/Livestream/HostLivestream/HostLivestream.js +64 -0
- package/dist/module/components/Livestream/HostLivestream/HostLivestream.js.map +1 -0
- package/dist/module/components/Livestream/HostLivestream/index.js +2 -0
- package/dist/module/components/Livestream/HostLivestream/index.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/HostLivestreamControls.js +62 -0
- package/dist/module/components/Livestream/LivestreamControls/HostLivestreamControls.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/HostStartStreamButton.js +105 -0
- package/dist/module/components/Livestream/LivestreamControls/HostStartStreamButton.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js +63 -0
- package/dist/module/components/Livestream/LivestreamControls/LivestreamAudioControlButton.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/LivestreamMediaControls.js +31 -0
- package/dist/module/components/Livestream/LivestreamControls/LivestreamMediaControls.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js +63 -0
- package/dist/module/components/Livestream/LivestreamControls/LivestreamVideoControlButton.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js +75 -0
- package/dist/module/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/ViewerLivestreamControls.js +57 -0
- package/dist/module/components/Livestream/LivestreamControls/ViewerLivestreamControls.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamControls/index.js +6 -0
- package/dist/module/components/Livestream/LivestreamControls/index.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamLayout/LivestreamLayout.js +58 -0
- package/dist/module/components/Livestream/LivestreamLayout/LivestreamLayout.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamLayout/index.js +2 -0
- package/dist/module/components/Livestream/LivestreamLayout/index.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamTopView/DurationBadge.js +136 -0
- package/dist/module/components/Livestream/LivestreamTopView/DurationBadge.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamTopView/FollowerCount.js +64 -0
- package/dist/module/components/Livestream/LivestreamTopView/FollowerCount.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamTopView/HostLivestreamTopView.js +80 -0
- package/dist/module/components/Livestream/LivestreamTopView/HostLivestreamTopView.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamTopView/LiveIndicator.js +48 -0
- package/dist/module/components/Livestream/LivestreamTopView/LiveIndicator.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.js +73 -0
- package/dist/module/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.js.map +1 -0
- package/dist/module/components/Livestream/LivestreamTopView/index.js +5 -0
- package/dist/module/components/Livestream/LivestreamTopView/index.js.map +1 -0
- package/dist/module/components/Livestream/ViewerLivestream/ViewerLivestream.js +81 -0
- package/dist/module/components/Livestream/ViewerLivestream/ViewerLivestream.js.map +1 -0
- package/dist/module/components/Livestream/ViewerLivestream/index.js +2 -0
- package/dist/module/components/Livestream/ViewerLivestream/index.js.map +1 -0
- package/dist/module/components/Livestream/index.js +6 -0
- package/dist/module/components/Livestream/index.js.map +1 -0
- package/dist/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/hooks/usePaginatedLayoutSortPreset.js +19 -0
- package/dist/module/hooks/usePaginatedLayoutSortPreset.js.map +1 -0
- package/dist/module/icons/EndStreamIcon.js +12 -0
- package/dist/module/icons/EndStreamIcon.js.map +1 -0
- package/dist/module/icons/Eye.js +12 -0
- package/dist/module/icons/Eye.js.map +1 -0
- package/dist/module/icons/LeaveStreamIcon.js +12 -0
- package/dist/module/icons/LeaveStreamIcon.js.map +1 -0
- package/dist/module/icons/ShieldBadge.js +12 -0
- package/dist/module/icons/ShieldBadge.js.map +1 -0
- package/dist/module/icons/StartStreamIcon.js +12 -0
- package/dist/module/icons/StartStreamIcon.js.map +1 -0
- package/dist/module/icons/index.js +5 -0
- package/dist/module/icons/index.js.map +1 -1
- package/dist/module/theme/theme.js +70 -0
- package/dist/module/theme/theme.js.map +1 -1
- package/dist/module/translations/en.json +6 -1
- package/dist/module/version.js +1 -1
- package/dist/module/version.js.map +1 -1
- package/dist/typescript/components/Livestream/HostLivestream/HostLivestream.d.ts +30 -0
- package/dist/typescript/components/Livestream/HostLivestream/HostLivestream.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/HostLivestream/index.d.ts +2 -0
- package/dist/typescript/components/Livestream/HostLivestream/index.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/HostLivestreamControls.d.ts +25 -0
- package/dist/typescript/components/Livestream/LivestreamControls/HostLivestreamControls.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/HostStartStreamButton.d.ts +25 -0
- package/dist/typescript/components/Livestream/LivestreamControls/HostStartStreamButton.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/LivestreamAudioControlButton.d.ts +6 -0
- package/dist/typescript/components/Livestream/LivestreamControls/LivestreamAudioControlButton.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/LivestreamMediaControls.d.ts +10 -0
- package/dist/typescript/components/Livestream/LivestreamControls/LivestreamMediaControls.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/LivestreamVideoControlButton.d.ts +6 -0
- package/dist/typescript/components/Livestream/LivestreamControls/LivestreamVideoControlButton.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.d.ts +16 -0
- package/dist/typescript/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/ViewerLivestreamControls.d.ts +16 -0
- package/dist/typescript/components/Livestream/LivestreamControls/ViewerLivestreamControls.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamControls/index.d.ts +6 -0
- package/dist/typescript/components/Livestream/LivestreamControls/index.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamLayout/LivestreamLayout.d.ts +17 -0
- package/dist/typescript/components/Livestream/LivestreamLayout/LivestreamLayout.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamLayout/index.d.ts +2 -0
- package/dist/typescript/components/Livestream/LivestreamLayout/index.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/DurationBadge.d.ts +12 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/DurationBadge.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/FollowerCount.d.ts +10 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/FollowerCount.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/HostLivestreamTopView.d.ts +26 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/HostLivestreamTopView.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/LiveIndicator.d.ts +10 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/LiveIndicator.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.d.ts +26 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/index.d.ts +5 -0
- package/dist/typescript/components/Livestream/LivestreamTopView/index.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/ViewerLivestream/ViewerLivestream.d.ts +32 -0
- package/dist/typescript/components/Livestream/ViewerLivestream/ViewerLivestream.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/ViewerLivestream/index.d.ts +2 -0
- package/dist/typescript/components/Livestream/ViewerLivestream/index.d.ts.map +1 -0
- package/dist/typescript/components/Livestream/index.d.ts +6 -0
- package/dist/typescript/components/Livestream/index.d.ts.map +1 -0
- package/dist/typescript/components/index.d.ts +1 -0
- package/dist/typescript/components/index.d.ts.map +1 -1
- package/dist/typescript/hooks/usePaginatedLayoutSortPreset.d.ts +3 -0
- package/dist/typescript/hooks/usePaginatedLayoutSortPreset.d.ts.map +1 -0
- package/dist/typescript/icons/EndStreamIcon.d.ts +3 -0
- package/dist/typescript/icons/EndStreamIcon.d.ts.map +1 -0
- package/dist/typescript/icons/Eye.d.ts +3 -0
- package/dist/typescript/icons/Eye.d.ts.map +1 -0
- package/dist/typescript/icons/LeaveStreamIcon.d.ts +3 -0
- package/dist/typescript/icons/LeaveStreamIcon.d.ts.map +1 -0
- package/dist/typescript/icons/ShieldBadge.d.ts +3 -0
- package/dist/typescript/icons/ShieldBadge.d.ts.map +1 -0
- package/dist/typescript/icons/StartStreamIcon.d.ts +3 -0
- package/dist/typescript/icons/StartStreamIcon.d.ts.map +1 -0
- package/dist/typescript/icons/index.d.ts +5 -0
- package/dist/typescript/icons/index.d.ts.map +1 -1
- package/dist/typescript/theme/theme.d.ts +70 -0
- package/dist/typescript/theme/theme.d.ts.map +1 -1
- package/dist/typescript/translations/index.d.ts +6 -1
- package/dist/typescript/translations/index.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/dist/typescript/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Call/CallContent/CallContent.tsx +1 -1
- package/src/components/Livestream/HostLivestream/HostLivestream.tsx +99 -0
- package/src/components/Livestream/HostLivestream/index.ts +1 -0
- package/src/components/Livestream/LivestreamControls/HostLivestreamControls.tsx +87 -0
- package/src/components/Livestream/LivestreamControls/HostStartStreamButton.tsx +163 -0
- package/src/components/Livestream/LivestreamControls/LivestreamAudioControlButton.tsx +78 -0
- package/src/components/Livestream/LivestreamControls/LivestreamMediaControls.tsx +32 -0
- package/src/components/Livestream/LivestreamControls/LivestreamVideoControlButton.tsx +78 -0
- package/src/components/Livestream/LivestreamControls/ViewerLeaveStreamButton.tsx +102 -0
- package/src/components/Livestream/LivestreamControls/ViewerLivestreamControls.tsx +75 -0
- package/src/components/Livestream/LivestreamControls/index.ts +5 -0
- package/src/components/Livestream/LivestreamLayout/LivestreamLayout.tsx +77 -0
- package/src/components/Livestream/LivestreamLayout/index.ts +1 -0
- package/src/components/Livestream/LivestreamTopView/DurationBadge.tsx +170 -0
- package/src/components/Livestream/LivestreamTopView/FollowerCount.tsx +74 -0
- package/src/components/Livestream/LivestreamTopView/HostLivestreamTopView.tsx +105 -0
- package/src/components/Livestream/LivestreamTopView/LiveIndicator.tsx +53 -0
- package/src/components/Livestream/LivestreamTopView/ViewerLivestreamTopView.tsx +102 -0
- package/src/components/Livestream/LivestreamTopView/index.ts +4 -0
- package/src/components/Livestream/ViewerLivestream/ViewerLivestream.tsx +126 -0
- package/src/components/Livestream/ViewerLivestream/index.ts +1 -0
- package/src/components/Livestream/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/usePaginatedLayoutSortPreset.ts +27 -0
- package/src/icons/EndStreamIcon.tsx +13 -0
- package/src/icons/Eye.tsx +13 -0
- package/src/icons/LeaveStreamIcon.tsx +13 -0
- package/src/icons/ShieldBadge.tsx +13 -0
- package/src/icons/StartStreamIcon.tsx +13 -0
- package/src/icons/index.tsx +5 -0
- package/src/theme/theme.ts +140 -0
- package/src/translations/en.json +6 -1
- package/src/version.ts +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ViewerLeaveStreamButton as DefaultViewerLeaveStreamButton,
|
|
6
|
+
ViewerLeaveStreamButtonProps,
|
|
7
|
+
} from './ViewerLeaveStreamButton';
|
|
8
|
+
import { useTheme } from '../../../contexts';
|
|
9
|
+
import { Z_INDEX } from '../../../constants';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Props for the ViewerLivestreamControls component.
|
|
13
|
+
*/
|
|
14
|
+
export type ViewerLivestreamControlsProps = ViewerLeaveStreamButtonProps & {
|
|
15
|
+
/**
|
|
16
|
+
* Component to customize the leave stream button on the viewer's end live stream.
|
|
17
|
+
*/
|
|
18
|
+
ViewerLeaveStreamButton?: React.ComponentType<ViewerLeaveStreamButtonProps> | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The ViewerLivestreamControls component displays the call controls for the live stream at viewer's end.
|
|
23
|
+
*/
|
|
24
|
+
export const ViewerLivestreamControls = ({
|
|
25
|
+
ViewerLeaveStreamButton = DefaultViewerLeaveStreamButton,
|
|
26
|
+
onLeaveStreamHandler,
|
|
27
|
+
}: ViewerLivestreamControlsProps) => {
|
|
28
|
+
const {
|
|
29
|
+
theme: { colors, viewerLivestreamControls },
|
|
30
|
+
} = useTheme();
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View
|
|
34
|
+
style={[
|
|
35
|
+
styles.container,
|
|
36
|
+
{
|
|
37
|
+
backgroundColor: colors.static_overlay,
|
|
38
|
+
},
|
|
39
|
+
viewerLivestreamControls.container,
|
|
40
|
+
]}
|
|
41
|
+
>
|
|
42
|
+
<View style={[styles.leftElement, viewerLivestreamControls.leftElement]}>
|
|
43
|
+
{ViewerLeaveStreamButton && (
|
|
44
|
+
<ViewerLeaveStreamButton
|
|
45
|
+
onLeaveStreamHandler={onLeaveStreamHandler}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
</View>
|
|
49
|
+
<View
|
|
50
|
+
style={[styles.rightElement, viewerLivestreamControls.rightElement]}
|
|
51
|
+
/>
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
container: {
|
|
58
|
+
position: 'absolute',
|
|
59
|
+
bottom: 0,
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
paddingVertical: 16,
|
|
63
|
+
paddingHorizontal: 8,
|
|
64
|
+
zIndex: Z_INDEX.IN_FRONT,
|
|
65
|
+
},
|
|
66
|
+
content: {},
|
|
67
|
+
leftElement: {
|
|
68
|
+
flex: 1,
|
|
69
|
+
alignItems: 'flex-start',
|
|
70
|
+
},
|
|
71
|
+
rightElement: {
|
|
72
|
+
flex: 1,
|
|
73
|
+
alignItems: 'flex-end',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SfuModels, StreamVideoParticipant } from '@stream-io/video-client';
|
|
3
|
+
import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
4
|
+
import { StyleSheet, View, ViewStyle } from 'react-native';
|
|
5
|
+
import { usePaginatedLayoutSortPreset } from '../../../hooks/usePaginatedLayoutSortPreset';
|
|
6
|
+
import { useTheme } from '../../../contexts';
|
|
7
|
+
import {
|
|
8
|
+
VideoRenderer as DefaultVideoRenderer,
|
|
9
|
+
VideoRendererProps,
|
|
10
|
+
} from '../../Participant';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for the LivestreamLayout component.
|
|
14
|
+
*/
|
|
15
|
+
export type LivestreamLayoutProps = {
|
|
16
|
+
/*
|
|
17
|
+
* Check if device is in landscape mode.
|
|
18
|
+
* This will apply the landscape mode styles to the component.
|
|
19
|
+
*/
|
|
20
|
+
landscape?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Component to customize the video component of the participant.
|
|
23
|
+
*/
|
|
24
|
+
VideoRenderer?: React.ComponentType<VideoRendererProps> | null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const hasScreenShare = (p?: StreamVideoParticipant) =>
|
|
28
|
+
p?.publishedTracks.includes(SfuModels.TrackType.SCREEN_SHARE);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The LivestreamLayout component presents the live stream video layout.
|
|
32
|
+
*/
|
|
33
|
+
export const LivestreamLayout = ({
|
|
34
|
+
landscape,
|
|
35
|
+
VideoRenderer = DefaultVideoRenderer,
|
|
36
|
+
}: LivestreamLayoutProps) => {
|
|
37
|
+
const { useParticipants, useHasOngoingScreenShare } = useCallStateHooks();
|
|
38
|
+
const call = useCall();
|
|
39
|
+
const {
|
|
40
|
+
theme: { colors, livestreamLayout },
|
|
41
|
+
} = useTheme();
|
|
42
|
+
const [currentSpeaker, ...otherParticipants] = useParticipants();
|
|
43
|
+
const hasOngoingScreenShare = useHasOngoingScreenShare();
|
|
44
|
+
const presenter = hasOngoingScreenShare
|
|
45
|
+
? hasScreenShare(currentSpeaker) && currentSpeaker
|
|
46
|
+
: otherParticipants.find(hasScreenShare);
|
|
47
|
+
|
|
48
|
+
usePaginatedLayoutSortPreset(call);
|
|
49
|
+
|
|
50
|
+
const landScapeStyles: ViewStyle = {
|
|
51
|
+
flexDirection: landscape ? 'row' : 'column',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.container,
|
|
58
|
+
landScapeStyles,
|
|
59
|
+
{ backgroundColor: colors.dark_gray },
|
|
60
|
+
livestreamLayout.container,
|
|
61
|
+
]}
|
|
62
|
+
>
|
|
63
|
+
{VideoRenderer && hasOngoingScreenShare && presenter && (
|
|
64
|
+
<VideoRenderer trackType="screenShareTrack" participant={presenter} />
|
|
65
|
+
)}
|
|
66
|
+
{VideoRenderer && !hasOngoingScreenShare && currentSpeaker && (
|
|
67
|
+
<VideoRenderer participant={currentSpeaker} trackType="videoTrack" />
|
|
68
|
+
)}
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const styles = StyleSheet.create({
|
|
74
|
+
container: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LivestreamLayout';
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../contexts';
|
|
4
|
+
import { ShieldBadge } from '../../../icons';
|
|
5
|
+
import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
6
|
+
import { CallSessionResponse, StreamCallEvent } from '@stream-io/video-client';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Props for the HostDurationBadge component.
|
|
10
|
+
*/
|
|
11
|
+
export type DurationBadgeProps = {
|
|
12
|
+
mode?: 'host' | 'viewer';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The HostDurationBadge component displays the duration while the live stream is active.
|
|
17
|
+
*/
|
|
18
|
+
export const DurationBadge = ({ mode }: DurationBadgeProps) => {
|
|
19
|
+
const { useCallSession } = useCallStateHooks();
|
|
20
|
+
const session = useCallSession();
|
|
21
|
+
|
|
22
|
+
const [duration, setDuration] = useState(() => {
|
|
23
|
+
if (!session || !session.live_started_at) {
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
const liveStartTime = new Date(session.live_started_at);
|
|
27
|
+
const now = new Date();
|
|
28
|
+
return Math.floor((now.getTime() - liveStartTime.getTime()) / 1000);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const call = useCall();
|
|
32
|
+
const {
|
|
33
|
+
theme: {
|
|
34
|
+
colors,
|
|
35
|
+
variants: { iconSizes },
|
|
36
|
+
durationBadge,
|
|
37
|
+
},
|
|
38
|
+
} = useTheme();
|
|
39
|
+
|
|
40
|
+
// for host
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (mode !== 'host') {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let intervalId: NodeJS.Timer;
|
|
46
|
+
|
|
47
|
+
const handleLiveStarted = () => {
|
|
48
|
+
intervalId = setInterval(() => {
|
|
49
|
+
setDuration((d) => d + 1);
|
|
50
|
+
}, 1000);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const handleLiveEnded = (event: StreamCallEvent) => {
|
|
54
|
+
const callDetails = (
|
|
55
|
+
event as StreamCallEvent & {
|
|
56
|
+
call: { session: CallSessionResponse };
|
|
57
|
+
}
|
|
58
|
+
).call.session;
|
|
59
|
+
if (callDetails?.live_ended_at !== null) {
|
|
60
|
+
clearInterval(intervalId);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const callLiveStartedUnsubscribe = call?.on(
|
|
65
|
+
'call.live_started',
|
|
66
|
+
handleLiveStarted,
|
|
67
|
+
);
|
|
68
|
+
const callUpdatedUnsubscribe = call?.on('call.updated', handleLiveEnded);
|
|
69
|
+
|
|
70
|
+
return () => {
|
|
71
|
+
if (mode !== 'host') {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (callLiveStartedUnsubscribe && callUpdatedUnsubscribe) {
|
|
75
|
+
callLiveStartedUnsubscribe();
|
|
76
|
+
callUpdatedUnsubscribe();
|
|
77
|
+
}
|
|
78
|
+
if (intervalId) {
|
|
79
|
+
clearInterval(intervalId);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}, [call, mode]);
|
|
83
|
+
|
|
84
|
+
// for viewer
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (mode !== 'viewer') {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let intervalId: NodeJS.Timer;
|
|
90
|
+
const handleLiveStarted = () => {
|
|
91
|
+
intervalId = setInterval(() => {
|
|
92
|
+
setDuration((d) => d + 1);
|
|
93
|
+
}, 1000);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
handleLiveStarted();
|
|
97
|
+
|
|
98
|
+
return () => {
|
|
99
|
+
if (mode !== 'viewer') {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (intervalId) {
|
|
103
|
+
clearInterval(intervalId);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}, [mode]);
|
|
107
|
+
|
|
108
|
+
const formatDuration = (durationInMs: number) => {
|
|
109
|
+
const days = Math.floor(durationInMs / 86400);
|
|
110
|
+
const hours = Math.floor(durationInMs / 3600);
|
|
111
|
+
const minutes = Math.floor((durationInMs % 3600) / 60);
|
|
112
|
+
const seconds = durationInMs % 60;
|
|
113
|
+
|
|
114
|
+
return `${days ? days + ' ' : ''}${hours ? hours + ':' : ''}${
|
|
115
|
+
minutes < 10 ? '0' : ''
|
|
116
|
+
}${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<View
|
|
121
|
+
style={[
|
|
122
|
+
styles.container,
|
|
123
|
+
{ backgroundColor: colors.dark_gray },
|
|
124
|
+
durationBadge.container,
|
|
125
|
+
]}
|
|
126
|
+
>
|
|
127
|
+
<View
|
|
128
|
+
style={[
|
|
129
|
+
styles.icon,
|
|
130
|
+
{
|
|
131
|
+
height: iconSizes.xs,
|
|
132
|
+
width: iconSizes.xs,
|
|
133
|
+
},
|
|
134
|
+
durationBadge.icon,
|
|
135
|
+
]}
|
|
136
|
+
>
|
|
137
|
+
<ShieldBadge />
|
|
138
|
+
</View>
|
|
139
|
+
<Text
|
|
140
|
+
style={[
|
|
141
|
+
styles.label,
|
|
142
|
+
{ color: colors.static_white },
|
|
143
|
+
durationBadge.label,
|
|
144
|
+
]}
|
|
145
|
+
>
|
|
146
|
+
{formatDuration(duration)}
|
|
147
|
+
</Text>
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const styles = StyleSheet.create({
|
|
153
|
+
container: {
|
|
154
|
+
paddingHorizontal: 8,
|
|
155
|
+
paddingVertical: 4,
|
|
156
|
+
borderRadius: 4,
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
},
|
|
161
|
+
icon: {},
|
|
162
|
+
label: {
|
|
163
|
+
textAlign: 'center',
|
|
164
|
+
fontSize: 13,
|
|
165
|
+
fontWeight: '400',
|
|
166
|
+
flexShrink: 1,
|
|
167
|
+
includeFontPadding: false,
|
|
168
|
+
paddingLeft: 4,
|
|
169
|
+
},
|
|
170
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../contexts';
|
|
4
|
+
import { useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
5
|
+
import { Eye } from '../../../icons';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Props for the FollowerCount component.
|
|
9
|
+
*/
|
|
10
|
+
export type FollowerCountProps = {};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The FollowerCount component that displays the number of participants while in the call.
|
|
14
|
+
*/
|
|
15
|
+
export const FollowerCount = ({}: FollowerCountProps) => {
|
|
16
|
+
const {
|
|
17
|
+
theme: {
|
|
18
|
+
colors,
|
|
19
|
+
variants: { iconSizes },
|
|
20
|
+
followerCount,
|
|
21
|
+
},
|
|
22
|
+
} = useTheme();
|
|
23
|
+
const { useParticipantCount } = useCallStateHooks();
|
|
24
|
+
const totalParticipants = useParticipantCount();
|
|
25
|
+
return (
|
|
26
|
+
<View
|
|
27
|
+
style={[
|
|
28
|
+
styles.container,
|
|
29
|
+
{ backgroundColor: colors.dark_gray },
|
|
30
|
+
followerCount.container,
|
|
31
|
+
]}
|
|
32
|
+
>
|
|
33
|
+
<View
|
|
34
|
+
style={[
|
|
35
|
+
styles.icon,
|
|
36
|
+
{ height: iconSizes.xs, width: iconSizes.xs },
|
|
37
|
+
followerCount.icon,
|
|
38
|
+
]}
|
|
39
|
+
>
|
|
40
|
+
<Eye />
|
|
41
|
+
</View>
|
|
42
|
+
<Text
|
|
43
|
+
style={[
|
|
44
|
+
styles.label,
|
|
45
|
+
{ color: colors.static_white },
|
|
46
|
+
followerCount.label,
|
|
47
|
+
]}
|
|
48
|
+
>
|
|
49
|
+
{totalParticipants}
|
|
50
|
+
</Text>
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
container: {
|
|
57
|
+
paddingHorizontal: 8,
|
|
58
|
+
paddingVertical: 4,
|
|
59
|
+
borderTopRightRadius: 4,
|
|
60
|
+
borderBottomRightRadius: 4,
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
},
|
|
65
|
+
icon: {},
|
|
66
|
+
label: {
|
|
67
|
+
fontSize: 13,
|
|
68
|
+
fontWeight: '400',
|
|
69
|
+
flexShrink: 1,
|
|
70
|
+
textAlign: 'center',
|
|
71
|
+
includeFontPadding: false,
|
|
72
|
+
marginLeft: 4,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
DurationBadge as DefaultDurationBadge,
|
|
5
|
+
DurationBadgeProps,
|
|
6
|
+
} from './DurationBadge';
|
|
7
|
+
import {
|
|
8
|
+
LiveIndicator as DefaultLiveIndicator,
|
|
9
|
+
LiveIndicatorProps,
|
|
10
|
+
} from './LiveIndicator';
|
|
11
|
+
import {
|
|
12
|
+
FollowerCount as DefaultFollowerCount,
|
|
13
|
+
FollowerCountProps,
|
|
14
|
+
} from './FollowerCount';
|
|
15
|
+
import { useTheme } from '../../../contexts';
|
|
16
|
+
import { useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
17
|
+
import { Z_INDEX } from '../../../constants';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Props for the HostLivestreamTopView component.
|
|
21
|
+
*/
|
|
22
|
+
export type HostLivestreamTopViewProps = {
|
|
23
|
+
/**
|
|
24
|
+
* Component to customize the Duration badge component on the host's live stream's top view.
|
|
25
|
+
*/
|
|
26
|
+
DurationBadge?: React.ComponentType<DurationBadgeProps> | null;
|
|
27
|
+
/**
|
|
28
|
+
* Component to customize the Live indicator on the host's live stream's top view.
|
|
29
|
+
*/
|
|
30
|
+
LiveIndicator?: React.ComponentType<LiveIndicatorProps> | null;
|
|
31
|
+
/**
|
|
32
|
+
* Component to customize the Follower count indicator on the host's live stream's top view.
|
|
33
|
+
*/
|
|
34
|
+
FollowerCount?: React.ComponentType<FollowerCountProps> | null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The HostLivestreamTopView component displays the top view component of the host's live stream.
|
|
39
|
+
*/
|
|
40
|
+
export const HostLivestreamTopView = ({
|
|
41
|
+
DurationBadge = DefaultDurationBadge,
|
|
42
|
+
LiveIndicator = DefaultLiveIndicator,
|
|
43
|
+
FollowerCount = DefaultFollowerCount,
|
|
44
|
+
}: HostLivestreamTopViewProps) => {
|
|
45
|
+
const { useIsCallLive, useIsCallBroadcastingInProgress } =
|
|
46
|
+
useCallStateHooks();
|
|
47
|
+
const isCallLive = useIsCallLive();
|
|
48
|
+
const isBroadcasting = useIsCallBroadcastingInProgress();
|
|
49
|
+
|
|
50
|
+
const liveOrBroadcasting = isCallLive || isBroadcasting;
|
|
51
|
+
const {
|
|
52
|
+
theme: { colors, hostLivestreamTopView },
|
|
53
|
+
} = useTheme();
|
|
54
|
+
return (
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.container,
|
|
58
|
+
{ backgroundColor: colors.static_overlay },
|
|
59
|
+
hostLivestreamTopView.container,
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
<View style={[styles.leftElement, hostLivestreamTopView.leftElement]}>
|
|
63
|
+
{DurationBadge && <DurationBadge mode="host" />}
|
|
64
|
+
</View>
|
|
65
|
+
<View
|
|
66
|
+
style={[styles.centerElement, hostLivestreamTopView.centerElement]}
|
|
67
|
+
/>
|
|
68
|
+
<View style={[styles.rightElement, hostLivestreamTopView.rightElement]}>
|
|
69
|
+
<View style={[styles.liveInfo, hostLivestreamTopView.liveInfo]}>
|
|
70
|
+
{liveOrBroadcasting && LiveIndicator && <LiveIndicator />}
|
|
71
|
+
{FollowerCount && <FollowerCount />}
|
|
72
|
+
</View>
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
container: {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
top: 0,
|
|
82
|
+
flexDirection: 'row',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
paddingVertical: 16,
|
|
85
|
+
paddingHorizontal: 8,
|
|
86
|
+
borderBottomEndRadius: 8,
|
|
87
|
+
borderBottomStartRadius: 8,
|
|
88
|
+
zIndex: Z_INDEX.IN_FRONT,
|
|
89
|
+
},
|
|
90
|
+
liveInfo: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
},
|
|
93
|
+
leftElement: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
alignItems: 'flex-start',
|
|
96
|
+
},
|
|
97
|
+
centerElement: {
|
|
98
|
+
flex: 1,
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
},
|
|
101
|
+
rightElement: {
|
|
102
|
+
flex: 1,
|
|
103
|
+
alignItems: 'flex-end',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../contexts';
|
|
4
|
+
import { useI18n } from '@stream-io/video-react-bindings';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Props for the LiveIndicator component.
|
|
8
|
+
*/
|
|
9
|
+
export type LiveIndicatorProps = {};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The LiveIndicator component displays whether the live stream is live or not.
|
|
13
|
+
*/
|
|
14
|
+
export const LiveIndicator = ({}: LiveIndicatorProps) => {
|
|
15
|
+
const {
|
|
16
|
+
theme: { colors, typefaces, liveIndicator },
|
|
17
|
+
} = useTheme();
|
|
18
|
+
const { t } = useI18n();
|
|
19
|
+
return (
|
|
20
|
+
<View
|
|
21
|
+
style={[
|
|
22
|
+
styles.container,
|
|
23
|
+
{ backgroundColor: colors.primary },
|
|
24
|
+
liveIndicator.container,
|
|
25
|
+
]}
|
|
26
|
+
>
|
|
27
|
+
<Text
|
|
28
|
+
style={[
|
|
29
|
+
styles.label,
|
|
30
|
+
{ color: colors.static_white },
|
|
31
|
+
typefaces.subtitleBold,
|
|
32
|
+
liveIndicator.label,
|
|
33
|
+
]}
|
|
34
|
+
>
|
|
35
|
+
{t('Live')}
|
|
36
|
+
</Text>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
paddingHorizontal: 8,
|
|
44
|
+
paddingVertical: 4,
|
|
45
|
+
borderTopLeftRadius: 4,
|
|
46
|
+
borderBottomLeftRadius: 4,
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
},
|
|
49
|
+
label: {
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
includeFontPadding: false,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
DurationBadge as DefaultDurationBadge,
|
|
5
|
+
DurationBadgeProps,
|
|
6
|
+
} from './DurationBadge';
|
|
7
|
+
import {
|
|
8
|
+
LiveIndicator as DefaultLiveIndicator,
|
|
9
|
+
LiveIndicatorProps,
|
|
10
|
+
} from './LiveIndicator';
|
|
11
|
+
import {
|
|
12
|
+
FollowerCount as DefaultFollowerCount,
|
|
13
|
+
FollowerCountProps,
|
|
14
|
+
} from './FollowerCount';
|
|
15
|
+
import { useTheme } from '../../../contexts';
|
|
16
|
+
import { Z_INDEX } from '../../../constants';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Props for the ViewerLivestreamTopView component.
|
|
20
|
+
*/
|
|
21
|
+
export type ViewerLivestreamTopViewProps = {
|
|
22
|
+
/**
|
|
23
|
+
* Component to customize the Duration badge component on the viewer's live stream's top view.
|
|
24
|
+
*/
|
|
25
|
+
DurationBadge?: React.ComponentType<DurationBadgeProps> | null;
|
|
26
|
+
/**
|
|
27
|
+
* Component to customize the Live indicator on the viewer's live stream's top view.
|
|
28
|
+
*/
|
|
29
|
+
LiveIndicator?: React.ComponentType<LiveIndicatorProps> | null;
|
|
30
|
+
/**
|
|
31
|
+
* Component to customize the Follower count indicator on the viewer's live stream's top view.
|
|
32
|
+
*/
|
|
33
|
+
FollowerCount?: React.ComponentType<FollowerCountProps> | null;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The ViewerLivestreamTopView component displays the top view component of the viewer's live stream.
|
|
38
|
+
*/
|
|
39
|
+
export const ViewerLivestreamTopView = ({
|
|
40
|
+
DurationBadge = DefaultDurationBadge,
|
|
41
|
+
LiveIndicator = DefaultLiveIndicator,
|
|
42
|
+
FollowerCount = DefaultFollowerCount,
|
|
43
|
+
}: ViewerLivestreamTopViewProps) => {
|
|
44
|
+
const {
|
|
45
|
+
theme: { colors, viewerLivestreamTopView },
|
|
46
|
+
} = useTheme();
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<View
|
|
50
|
+
style={[
|
|
51
|
+
styles.container,
|
|
52
|
+
{ backgroundColor: colors.static_overlay },
|
|
53
|
+
viewerLivestreamTopView.container,
|
|
54
|
+
]}
|
|
55
|
+
>
|
|
56
|
+
<View style={[styles.leftElement, viewerLivestreamTopView.leftElement]}>
|
|
57
|
+
<View style={[styles.liveInfo, viewerLivestreamTopView.liveInfo]}>
|
|
58
|
+
{LiveIndicator && <LiveIndicator />}
|
|
59
|
+
{FollowerCount && <FollowerCount />}
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
<View
|
|
63
|
+
style={[styles.centerElement, viewerLivestreamTopView.centerElement]}
|
|
64
|
+
>
|
|
65
|
+
{DurationBadge && <DurationBadge mode="viewer" />}
|
|
66
|
+
</View>
|
|
67
|
+
<View
|
|
68
|
+
style={[styles.rightElement, viewerLivestreamTopView.rightElement]}
|
|
69
|
+
/>
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
container: {
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
top: 0,
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
paddingVertical: 16,
|
|
81
|
+
paddingHorizontal: 8,
|
|
82
|
+
borderBottomEndRadius: 8,
|
|
83
|
+
borderBottomStartRadius: 8,
|
|
84
|
+
zIndex: Z_INDEX.IN_FRONT,
|
|
85
|
+
},
|
|
86
|
+
liveInfo: {
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
},
|
|
89
|
+
leftElement: {
|
|
90
|
+
flex: 1,
|
|
91
|
+
alignItems: 'flex-start',
|
|
92
|
+
},
|
|
93
|
+
centerElement: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
flexGrow: 3,
|
|
97
|
+
},
|
|
98
|
+
rightElement: {
|
|
99
|
+
flex: 1,
|
|
100
|
+
alignItems: 'flex-end',
|
|
101
|
+
},
|
|
102
|
+
});
|