@wereform/pkgm-video 1.0.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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @begenone/pkgm-video
2
+
3
+ This package manages **video-related logic** in the BEGENONE app.
4
+
5
+ ## Overview
6
+
7
+ Everything that involves videos — uploading, displaying, formatting, and retrieving metadata — is handled here.
8
+
9
+ ## Features
10
+
11
+ - 📦 Fetch video lists (feeds, channel-specific, trending)
12
+ - 📹 Display video player with metadata
13
+ - ⏱ Duration, title, and preview management
14
+ - 🧠 Handles video encoding status and thumbnail fallback
15
+
16
+ ## Usage
17
+
18
+ Any screen that shows videos — including feeds, Shorts, and channel pages — imports logic or components from this package.
19
+
20
+ ## Tech Stack
21
+
22
+ - Axios for API calls
23
+ - React Native Video or Expo AV
24
+ - Shared utilities from `@begenone/pkgm-shared`
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ["module:metro-react-native-babel-preset"],
3
+ };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.Thumbnail=Thumbnail;var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-video\\src\\components\\Thumbnail.jsx";function Thumbnail(_ref){var thumbnailURL=_ref.thumbnailURL,thumbHeight=_ref.thumbHeight;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:"auto"},children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:thumbnailURL||"https://begenone-images.s3.us-east-1.amazonaws.com/let+Me+Love+you.jpg"},style:{width:"100%",height:thumbHeight,aspectRatio:16/9,borderRadius:5}})});}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoPlayer=VideoPlayer;var _expo=require("expo");var _expoVideo=require("expo-video");var _reactNative=require("react-native");var _VideoPlayerStyles=require("../styles/VideoPlayerStyles");var _react=require("react");var _native=require("@react-navigation/native");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-video\\src\\components\\VideoPlayer.jsx";function VideoPlayer(_ref){var videoSource=_ref.videoSource;var _useWindowDimensions=(0,_reactNative.useWindowDimensions)(),width=_useWindowDimensions.width;var playerRef=(0,_react.useRef)(null);var player=(0,_expoVideo.useVideoPlayer)(videoSource,function(p){p.loop=true;p.play();playerRef.current=p;});(0,_native.useFocusEffect)((0,_react.useCallback)(function(){if(playerRef.current){playerRef.current.play();}return function(){if(playerRef.current){playerRef.current.pause();}};},[]));(0,_expo.useEvent)(player,"playingChange");return(0,_jsxRuntime.jsx)(_reactNative.View,{style:_VideoPlayerStyles.VideoPlayerStyles.contentContainer,children:(0,_jsxRuntime.jsx)(_expoVideo.VideoView,{style:[_VideoPlayerStyles.VideoPlayerStyles.video,{width:width,height:width*(9/16)}],player:player,allowsPictureInPicture:true})});}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoTestScreen=void 0;var _reactNative=require("react-native");var _pkgmShared=require("@wereform/pkgm-shared");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-video\\src\\components\\VideoTestScreen.jsx";var VideoTestScreen=exports.VideoTestScreen=function VideoTestScreen(){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{children:"Video Test Screen"}),(0,_jsxRuntime.jsx)(_pkgmShared.SampleButton,{title:"Press From Shared!",onPress:function onPress(){return alert("Works!");}})]});};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"VideoCardHorizontalLayout",{enumerable:true,get:function get(){return _VideoCardHorizontalLayout.VideoCardHorizontalLayout;}});Object.defineProperty(exports,"VideoCardLayout",{enumerable:true,get:function get(){return _VideoCardLayout.VideoCardLayout;}});Object.defineProperty(exports,"VideoPlayer",{enumerable:true,get:function get(){return _VideoPlayer.VideoPlayer;}});Object.defineProperty(exports,"VideoViewLayout",{enumerable:true,get:function get(){return _VideoViewLayout.VideoViewLayout;}});var _VideoCardLayout=require("./layout/VideoCardLayout");var _VideoPlayer=require("./components/VideoPlayer");var _VideoViewLayout=require("./layout/VideoViewLayout");var _VideoCardHorizontalLayout=require("./layout/VideoCardHorizontalLayout");
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoCardHorizontalLayout=VideoCardHorizontalLayout;var _reactNative=require("react-native");var _Thumbnail=require("../components/Thumbnail");var _pkgmShared=require("@wereform/pkgm-shared");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-video\\src\\layout\\VideoCardHorizontalLayout.jsx";function VideoCardHorizontalLayout(_ref){var eyeIcon=_ref.eyeIcon,timeAgo=_ref.timeAgo,viewsText=_ref.viewsText,titleText=_ref.titleText,contentThumbUrl=_ref.contentThumbUrl,navigateToVideo=_ref.navigateToVideo;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:navigateToVideo,style:{flexDirection:"row",padding:8},children:[(0,_jsxRuntime.jsx)(_Thumbnail.Thumbnail,{thumbHeight:90,thumbnailURL:contentThumbUrl}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1,marginLeft:12},children:[(0,_jsxRuntime.jsx)(_pkgmShared.CustomizedTitle,{title:titleText||"This is a dummy text title for the video",fontSize:18,textColor:"white",style:{width:"100%"}}),(0,_jsxRuntime.jsx)(_pkgmShared.DateViews,{eyeIcon:eyeIcon,timeAgo:timeAgo,viewsText:viewsText,containerStyles:{flexDirection:"column",justifyContent:"start",height:40},dateContainerStyles:{paddingBottom:4},dateTextStyles:{fontSize:12},viewsTextStyles:{fontSize:12}})]})]});}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoCardLayout=void 0;var _reactNative=require("react-native");var _VideoCardLayoutStyles=require("../styles/VideoCardLayoutStyles");var _pkgmShared=require("@wereform/pkgm-shared");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-video\\src\\layout\\VideoCardLayout.jsx";var VideoCardLayout=exports.VideoCardLayout=function VideoCardLayout(_ref){var timeAgo=_ref.timeAgo,viewsText=_ref.viewsText,titleText=_ref.titleText,userNameText=_ref.userNameText,contentThumbUrl=_ref.contentThumbUrl,channelLogo=_ref.channelLogo,containerStyles=_ref.containerStyles,dateViewsContainerStyle=_ref.dateViewsContainerStyle,userImageStyles=_ref.userImageStyles,titleNameContainerStyles=_ref.titleNameContainerStyles,userNameTextStyles=_ref.userNameTextStyles,titleTextStyles=_ref.titleTextStyles,thumbnailImageStyles=_ref.thumbnailImageStyles,customMetaDataStyles=_ref.customMetaDataStyles,navigateToVideo=_ref.navigateToVideo;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.container,containerStyles],onPress:navigateToVideo,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:_VideoCardLayoutStyles.VideoCardLayoutStyles.imageWrapper,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:contentThumbUrl||"https://begenone-images.s3.us-east-1.amazonaws.com/let+Me+Love+you.jpg"},style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.image,thumbnailImageStyles]})}),(0,_jsxRuntime.jsx)(_pkgmShared.DateViews,{timeAgo:timeAgo,viewsText:viewsText,containerStyles:dateViewsContainerStyle}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.metaData,customMetaDataStyles],children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:channelLogo||"https://begenone-images.s3.us-east-1.amazonaws.com/default-user-photo.jpg"},style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.userImage,userImageStyles]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.titleNameContainer,titleNameContainerStyles],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.titleText,titleTextStyles],numberOfLines:2,children:titleText||"This is a Default Title Text in case of nothing being passed in."}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_VideoCardLayoutStyles.VideoCardLayoutStyles.userNameText,userNameTextStyles],children:userNameText||"Default Username"})]})]})]});};
File without changes
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoViewLayout=VideoViewLayout;var _reactNative=require("react-native");var _VideoPlayer=require("../components/VideoPlayer");var _pkgmShared=require("@wereform/pkgm-shared");var _vectorIcons=require("@expo/vector-icons");var _VideoCardLayout=require("./VideoCardLayout");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="F:\\WeReform Corporation\\Products\\BEGENONE\\App\\mobile\\packages\\begenone-pkgm-video\\src\\layout\\VideoViewLayout.jsx";function VideoViewLayout(_ref){var _this=this;var videoSource=_ref.videoSource,CustomizedTitleText=_ref.CustomizedTitleText,MenuChannelMetaTimeAgo=_ref.MenuChannelMetaTimeAgo,MenuChannelMetaViews=_ref.MenuChannelMetaViews,MenuChannelMetaUserName=_ref.MenuChannelMetaUserName,MenuChannelMetaSubCount=_ref.MenuChannelMetaSubCount,MenuChannelMetaChannelLogo=_ref.MenuChannelMetaChannelLogo,suggestedVideos=_ref.suggestedVideos;console.log("SUGGESTED VIDEOS FROM VIDEO VIEWS LAYOUT: =>\n"+JSON.stringify(suggestedVideos[0].videos,null,2));return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_jsxRuntime.jsx)(_VideoPlayer.VideoPlayer,{videoSource:videoSource})}),(0,_jsxRuntime.jsx)(_pkgmShared.CustomizedTitle,{title:CustomizedTitleText,fontSize:22,fontFamily:"Inter",textColor:"white",style:{paddingTop:18,paddingLeft:22,paddingRight:22,paddingBottom:18,alignSelf:"start"},textStyle:{lineHeight:28}}),(0,_jsxRuntime.jsx)(_pkgmShared.MenuInteraction,{likeIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"thumbs-up-outline",size:24,color:"white"}),dislikeIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"thumbs-down-outline",size:24,color:"white"}),shareIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"arrow-redo-outline",size:24,color:"white"}),commentIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"chatbubble-ellipses-outline",size:24,color:"white"}),containerStyles:{marginLeft:12}}),(0,_jsxRuntime.jsx)(_pkgmShared.MenuChannelMeta,{calendarIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"calendar-clear-outline",size:18,color:"white"}),timeAgo:MenuChannelMetaTimeAgo,eyeIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"eye-outline",size:18,color:"white"}),viewsText:MenuChannelMetaViews,userName:MenuChannelMetaUserName,subscribersCount:MenuChannelMetaSubCount,channelLogo:MenuChannelMetaChannelLogo,containerStyles:{marginTop:12}}),suggestedVideos[0].videos.map(function(video){var _video$channel;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:24},children:(0,_jsxRuntime.jsx)(_VideoCardLayout.VideoCardLayout,{titleText:video.title,contentThumbUrl:video.thumbUrl,userNameText:((_video$channel=video.channel)==null?void 0:_video$channel.name)||"Unknown",channelLogo:video.channelLogo,timeAgo:video.videoTimeAgo,viewsText:String(video.views),calendarIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"calendar-clear-outline",size:18,color:"white"}),eyeIcon:(0,_jsxRuntime.jsx)(_vectorIcons.Ionicons,{name:"eye-outline",size:18,color:"white"})},video._id)},video._id);})]});}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoCardLayoutStyles=void 0;var _globalStyles=require("./globalStyles");var VideoCardLayoutStyles=exports.VideoCardLayoutStyles={container:{width:"auto",flexDirection:"column",marginRight:12,marginLeft:12,marginBottom:40},imageWrapper:{width:"100%"},image:{width:"100%",resizeMode:"contain",aspectRatio:16/9,borderRadius:_globalStyles.globalStyles.borders.borderPrimary100},metaData:{flexDirection:"row",marginTop:16,paddingLeft:8,paddingRight:8},userImage:{width:40,height:40,borderRadius:_globalStyles.globalStyles.borders.borderPrimary50},titleNameContainer:{width:"100%",flexDirection:"column",paddingLeft:16,flexShrink:1},titleText:{fontSize:22,paddingBottom:12,lineHeight:30,fontWeight:"bold",color:"#fff"},userNameText:{color:_globalStyles.globalStyles.colors.colorPrimary400,fontWeight:"bold"}};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.VideoPlayerStyles=void 0;var _reactNative=require("react-native");var VideoPlayerStyles=exports.VideoPlayerStyles=_reactNative.StyleSheet.create({contentContainer:{alignItems:"center",justifyContent:"flex-start"},video:{},controlsContainer:{padding:10}});
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.globalStyles=void 0;var _reactNative=require("react-native");var globalStyles=exports.globalStyles=_reactNative.StyleSheet.create({colors:{colorPrimary50:"rgba(21, 21, 21, .7)",colorPrimary100:"#151515",colorPrimary200:"#252525",colorPrimary300:"#3C3C3C",colorPrimary350:"rgba(60,60,60,.2)",colorPrimary400:"#7F7F7F",colorPrimary500:"#D3D3D3",colorPrimary600:"#ff6600ff",colorPrimary700:"#FF8800"},borders:{borderPrimary50:8,borderPrimary100:10,borderPrimary200:12,borderPrimary300:15,borderPrimary400:30}});
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@wereform/pkgm-video",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "scripts": {
6
+ "build": "babel src --out-dir dist --extensions .js,.jsx"
7
+ },
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "peerDependencies": {
12
+ "@expo/vector-icons": "*",
13
+ "expo": "*",
14
+ "expo-video": "*",
15
+ "react": "*",
16
+ "react-native": "*"
17
+ },
18
+ "dependencies": {
19
+ "@wereform/pkgm-api": "^1.0.0",
20
+ "@wereform/pkgm-shared": "^1.0.0",
21
+ "@expo/vector-icons": "^15.0.3"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/cli": "^7.28.3",
25
+ "@babel/core": "^7.28.5",
26
+ "@babel/preset-env": "^7.28.5",
27
+ "metro-react-native-babel-preset": "^0.77.0"
28
+ }
29
+ }
package/packageJSON.md ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@begenone/pkgm-video",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "babel src --out-dir dist --extensions .js,.jsx"
8
+ },
9
+ "peerDependencies": {
10
+ "@expo/vector-icons": "_",
11
+ "expo": "_",
12
+ "expo-video": "_",
13
+ "react": "_",
14
+ "react-native": "_"
15
+ },
16
+ "dependencies": {
17
+ "@begenone/pkgm-api": "workspace:_",
18
+ "@begenone/pkgm-shared": "workspace:\*",
19
+ "@expo/vector-icons": "^15.0.3"
20
+ },
21
+ "devDependencies": {
22
+ "@babel/cli": "^7.28.3",
23
+ "@babel/core": "^7.28.5",
24
+ "@babel/preset-env": "^7.28.5",
25
+ "metro-react-native-babel-preset": "^0.77.0"
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ import { Image, View } from "react-native";
2
+
3
+ export function Thumbnail({ thumbnailURL, thumbHeight }) {
4
+ return (
5
+ <View style={{ width: "auto" }}>
6
+ <Image
7
+ source={{
8
+ uri:
9
+ thumbnailURL ||
10
+ "https://begenone-images.s3.us-east-1.amazonaws.com/let+Me+Love+you.jpg",
11
+ }}
12
+ style={{
13
+ width: "100%",
14
+ height: thumbHeight,
15
+ aspectRatio: 16 / 9,
16
+ borderRadius: 5,
17
+ }}
18
+ />
19
+ </View>
20
+ );
21
+ }
@@ -0,0 +1,47 @@
1
+ import { useEvent } from "expo";
2
+ import { useVideoPlayer, VideoView } from "expo-video";
3
+ import { View, useWindowDimensions } from "react-native";
4
+ import { VideoPlayerStyles } from "../styles/VideoPlayerStyles";
5
+ import { useCallback, useRef } from "react";
6
+ import { useFocusEffect } from "@react-navigation/native";
7
+
8
+ export function VideoPlayer({ videoSource }) {
9
+ const { width } = useWindowDimensions(); // Dynamically get device width
10
+
11
+ const playerRef = useRef(null);
12
+
13
+ const player = useVideoPlayer(videoSource, p => {
14
+ p.loop = true;
15
+ p.play();
16
+ playerRef.current = p; // store instance
17
+ });
18
+
19
+ useFocusEffect(
20
+ useCallback(() => {
21
+ if (playerRef.current) {
22
+ playerRef.current.play();
23
+ }
24
+
25
+ return () => {
26
+ if (playerRef.current) {
27
+ playerRef.current.pause();
28
+ // Optional: fully unload the video
29
+ // playerRef.current.unloadAsync?.();
30
+ }
31
+ };
32
+ }, [])
33
+ );
34
+
35
+ useEvent(player, "playingChange");
36
+
37
+ return (
38
+ <View style={VideoPlayerStyles.contentContainer}>
39
+ <VideoView
40
+ style={[VideoPlayerStyles.video, { width, height: width * (9 / 16) }]} // 16:9 ratio
41
+ player={player}
42
+ // allowsFullscreen
43
+ allowsPictureInPicture
44
+ />
45
+ </View>
46
+ );
47
+ }
@@ -0,0 +1,14 @@
1
+ import { View, Text } from "react-native";
2
+ import { SampleButton } from "@wereform/pkgm-shared";
3
+
4
+ export const VideoTestScreen = () => {
5
+ return (
6
+ <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
7
+ <Text>Video Test Screen</Text>
8
+ <SampleButton
9
+ title="Press From Shared!"
10
+ onPress={() => alert("Works!")}
11
+ />
12
+ </View>
13
+ );
14
+ };
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { VideoCardLayout } from "./layout/VideoCardLayout";
2
+ export { VideoPlayer } from "./components/VideoPlayer";
3
+ export { VideoViewLayout } from "./layout/VideoViewLayout";
4
+ export { VideoCardHorizontalLayout } from "./layout/VideoCardHorizontalLayout";
@@ -0,0 +1,52 @@
1
+ import { Text, TouchableOpacity, View } from "react-native";
2
+ import { Thumbnail } from "../components/Thumbnail";
3
+ import { CustomizedTitle, DateViews } from "@wereform/pkgm-shared";
4
+
5
+ export function VideoCardHorizontalLayout({
6
+ eyeIcon,
7
+ timeAgo,
8
+ viewsText,
9
+ titleText,
10
+ contentThumbUrl,
11
+ navigateToVideo,
12
+ }) {
13
+ return (
14
+ <TouchableOpacity
15
+ onPress={navigateToVideo}
16
+ style={{
17
+ flexDirection: "row",
18
+ padding: 8,
19
+ }}
20
+ >
21
+ <Thumbnail thumbHeight={90} thumbnailURL={contentThumbUrl} />
22
+ <View style={{ flex: 1, marginLeft: 12 }}>
23
+ <CustomizedTitle
24
+ title={titleText || "This is a dummy text title for the video"}
25
+ fontSize={18}
26
+ textColor="white"
27
+ style={{ width: "100%" }}
28
+ />
29
+
30
+ <DateViews
31
+ eyeIcon={eyeIcon}
32
+ timeAgo={timeAgo}
33
+ viewsText={viewsText}
34
+ containerStyles={{
35
+ flexDirection: "column",
36
+ justifyContent: "start",
37
+ height: 40,
38
+ }}
39
+ dateContainerStyles={{
40
+ paddingBottom: 4,
41
+ }}
42
+ dateTextStyles={{
43
+ fontSize: 12,
44
+ }}
45
+ viewsTextStyles={{
46
+ fontSize: 12,
47
+ }}
48
+ />
49
+ </View>
50
+ </TouchableOpacity>
51
+ );
52
+ }
@@ -0,0 +1,75 @@
1
+ import { Image, Text, TouchableOpacity, View } from "react-native";
2
+ import { VideoCardLayoutStyles } from "../styles/VideoCardLayoutStyles";
3
+ import { DateViews } from "@wereform/pkgm-shared";
4
+
5
+ export const VideoCardLayout = ({
6
+ timeAgo,
7
+ viewsText,
8
+ titleText,
9
+ userNameText,
10
+ contentThumbUrl,
11
+ channelLogo,
12
+ containerStyles,
13
+ dateViewsContainerStyle,
14
+ userImageStyles,
15
+ titleNameContainerStyles,
16
+ userNameTextStyles,
17
+ titleTextStyles,
18
+ thumbnailImageStyles,
19
+ customMetaDataStyles,
20
+ navigateToVideo,
21
+ }) => {
22
+ return (
23
+ <View
24
+ style={[VideoCardLayoutStyles.container, containerStyles]}
25
+ onPress={navigateToVideo}
26
+ >
27
+ <View style={VideoCardLayoutStyles.imageWrapper}>
28
+ <Image
29
+ source={{
30
+ uri:
31
+ contentThumbUrl ||
32
+ "https://begenone-images.s3.us-east-1.amazonaws.com/let+Me+Love+you.jpg",
33
+ }}
34
+ style={[VideoCardLayoutStyles.image, thumbnailImageStyles]}
35
+ />
36
+ </View>
37
+
38
+ <DateViews
39
+ timeAgo={timeAgo}
40
+ viewsText={viewsText}
41
+ containerStyles={dateViewsContainerStyle}
42
+ />
43
+
44
+ <View style={[VideoCardLayoutStyles.metaData, customMetaDataStyles]}>
45
+ <Image
46
+ source={{
47
+ uri:
48
+ channelLogo ||
49
+ "https://begenone-images.s3.us-east-1.amazonaws.com/default-user-photo.jpg",
50
+ }}
51
+ style={[VideoCardLayoutStyles.userImage, userImageStyles]}
52
+ />
53
+ <View
54
+ style={[
55
+ VideoCardLayoutStyles.titleNameContainer,
56
+ titleNameContainerStyles,
57
+ ]}
58
+ >
59
+ <Text
60
+ style={[VideoCardLayoutStyles.titleText, titleTextStyles]}
61
+ numberOfLines={2}
62
+ >
63
+ {titleText ||
64
+ "This is a Default Title Text in case of nothing being passed in."}
65
+ </Text>
66
+ <Text
67
+ style={[VideoCardLayoutStyles.userNameText, userNameTextStyles]}
68
+ >
69
+ {userNameText || "Default Username"}
70
+ </Text>
71
+ </View>
72
+ </View>
73
+ </View>
74
+ );
75
+ };
File without changes
@@ -0,0 +1,107 @@
1
+ import { ScrollView, View } from "react-native";
2
+ import { VideoPlayer } from "../components/VideoPlayer";
3
+ import {
4
+ CustomizedTitle,
5
+ MenuChannelMeta,
6
+ MenuInteraction,
7
+ } from "@wereform/pkgm-shared";
8
+ import { Ionicons } from "@expo/vector-icons";
9
+ import { VideoCardLayout } from "./VideoCardLayout";
10
+
11
+ export function VideoViewLayout({
12
+ videoSource,
13
+ CustomizedTitleText,
14
+ MenuChannelMetaTimeAgo,
15
+ MenuChannelMetaViews,
16
+ MenuChannelMetaUserName,
17
+ MenuChannelMetaSubCount,
18
+ MenuChannelMetaChannelLogo,
19
+ suggestedVideos,
20
+ }) {
21
+ console.log(
22
+ "SUGGESTED VIDEOS FROM VIDEO VIEWS LAYOUT: =>\n" +
23
+ JSON.stringify(suggestedVideos[0].videos, null, 2)
24
+ );
25
+ return (
26
+ <ScrollView>
27
+ <View>
28
+ <VideoPlayer videoSource={videoSource} />
29
+ </View>
30
+ <CustomizedTitle
31
+ title={CustomizedTitleText}
32
+ fontSize={22}
33
+ fontFamily="Inter"
34
+ textColor="white"
35
+ style={{
36
+ paddingTop: 18,
37
+ paddingLeft: 22,
38
+ paddingRight: 22,
39
+ paddingBottom: 18,
40
+ alignSelf: "start",
41
+ }}
42
+ textStyle={{
43
+ lineHeight: 28,
44
+ }}
45
+ />
46
+
47
+ <MenuInteraction
48
+ likeIcon={<Ionicons name="thumbs-up-outline" size={24} color="white" />}
49
+ dislikeIcon={
50
+ <Ionicons name="thumbs-down-outline" size={24} color="white" />
51
+ }
52
+ shareIcon={
53
+ <Ionicons name="arrow-redo-outline" size={24} color="white" />
54
+ }
55
+ commentIcon={
56
+ <Ionicons
57
+ name="chatbubble-ellipses-outline"
58
+ size={24}
59
+ color="white"
60
+ />
61
+ }
62
+ containerStyles={{
63
+ marginLeft: 12,
64
+ }}
65
+ />
66
+
67
+ <MenuChannelMeta
68
+ calendarIcon={
69
+ <Ionicons name="calendar-clear-outline" size={18} color="white" />
70
+ }
71
+ timeAgo={MenuChannelMetaTimeAgo}
72
+ eyeIcon={<Ionicons name="eye-outline" size={18} color="white" />}
73
+ viewsText={MenuChannelMetaViews}
74
+ userName={MenuChannelMetaUserName}
75
+ subscribersCount={MenuChannelMetaSubCount}
76
+ channelLogo={MenuChannelMetaChannelLogo}
77
+ containerStyles={{
78
+ marginTop: 12,
79
+ }}
80
+ />
81
+
82
+ {suggestedVideos[0].videos.map(video => {
83
+ return (
84
+ <View style={{ marginTop: 24 }} key={video._id}>
85
+ <VideoCardLayout
86
+ key={video._id}
87
+ titleText={video.title}
88
+ contentThumbUrl={video.thumbUrl}
89
+ userNameText={video.channel?.name || "Unknown"}
90
+ channelLogo={video.channelLogo}
91
+ timeAgo={video.videoTimeAgo}
92
+ viewsText={String(video.views)}
93
+ calendarIcon={
94
+ <Ionicons
95
+ name="calendar-clear-outline"
96
+ size={18}
97
+ color="white"
98
+ />
99
+ }
100
+ eyeIcon={<Ionicons name="eye-outline" size={18} color="white" />}
101
+ />
102
+ </View>
103
+ );
104
+ })}
105
+ </ScrollView>
106
+ );
107
+ }
@@ -0,0 +1,54 @@
1
+ import { globalStyles } from "./globalStyles";
2
+
3
+ export const VideoCardLayoutStyles = {
4
+ container: {
5
+ width: "auto",
6
+ flexDirection: "column",
7
+ marginRight: 12,
8
+ marginLeft: 12,
9
+ marginBottom: 40,
10
+ },
11
+ imageWrapper: {
12
+ width: "100%",
13
+ },
14
+
15
+ image: {
16
+ width: "100%",
17
+ resizeMode: "contain",
18
+ aspectRatio: 16 / 9,
19
+ borderRadius: globalStyles.borders.borderPrimary100,
20
+ },
21
+
22
+ metaData: {
23
+ flexDirection: "row",
24
+ marginTop: 16,
25
+ paddingLeft: 8,
26
+ paddingRight: 8,
27
+ },
28
+
29
+ userImage: {
30
+ width: 40,
31
+ height: 40,
32
+ borderRadius: globalStyles.borders.borderPrimary50,
33
+ },
34
+
35
+ titleNameContainer: {
36
+ width: "100%",
37
+ flexDirection: "column",
38
+ paddingLeft: 16,
39
+ flexShrink: 1,
40
+ },
41
+
42
+ titleText: {
43
+ fontSize: 22,
44
+ paddingBottom: 12,
45
+ lineHeight: 30,
46
+ fontWeight: "bold",
47
+ color: "#fff",
48
+ },
49
+
50
+ userNameText: {
51
+ color: globalStyles.colors.colorPrimary400,
52
+ fontWeight: "bold",
53
+ },
54
+ };
@@ -0,0 +1,16 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ export const VideoPlayerStyles = StyleSheet.create({
4
+ contentContainer: {
5
+ // flex: 1,
6
+ alignItems: "center",
7
+ justifyContent: "flex-start",
8
+ // backgroundColor: "#000",
9
+ },
10
+ video: {
11
+ // borderRadius: 10,
12
+ },
13
+ controlsContainer: {
14
+ padding: 10,
15
+ },
16
+ });
@@ -0,0 +1,28 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ export const globalStyles = StyleSheet.create({
4
+ colors: {
5
+ colorPrimary50: "rgba(21, 21, 21, .7)",
6
+ colorPrimary100: "#151515",
7
+
8
+ colorPrimary200: "#252525",
9
+
10
+ colorPrimary300: "#3C3C3C",
11
+ colorPrimary350: "rgba(60,60,60,.2)",
12
+
13
+ colorPrimary400: "#7F7F7F",
14
+
15
+ colorPrimary500: "#D3D3D3",
16
+
17
+ colorPrimary600: "#ff6600ff",
18
+
19
+ colorPrimary700: "#FF8800",
20
+ },
21
+ borders: {
22
+ borderPrimary50: 8,
23
+ borderPrimary100: 10,
24
+ borderPrimary200: 12,
25
+ borderPrimary300: 15,
26
+ borderPrimary400: 30,
27
+ },
28
+ });