@wereform/pkgm-video 1.0.2 → 1.0.4

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.
@@ -1 +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}})});}
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}})});}
@@ -1 +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})});}
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 isFocused=(0,_native.useIsFocused)();var playerRef=(0,_react.useRef)(null);var player=(0,_expoVideo.useVideoPlayer)(videoSource,function(p){p.loop=true;p.play();playerRef.current=p;});(0,_react.useEffect)(function(){if(!player)return;if(isFocused)player.play();else player.pause();},[isFocused,player]);(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})});}
@@ -1 +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}})]})]});}
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}})]})]});}
@@ -1 +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"})]})]})]});};
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;console.log("Checking for Conent Thumbnail URL: ",contentThumbUrl);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"})]})]})]});};
@@ -1 +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);})]});}
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},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"}),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);})]});}
package/package.json CHANGED
@@ -1,33 +1,37 @@
1
- {
2
- "name": "@wereform/pkgm-video",
3
- "version": "1.0.2",
4
- "main": "dist/index.js",
5
- "files": [
6
- "dist",
7
- "README.md"
8
- ],
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "peerDependencies": {
13
- "@expo/vector-icons": "*",
14
- "expo": "*",
15
- "expo-video": "*",
16
- "react": "*",
17
- "react-native": "*"
18
- },
19
- "dependencies": {
20
- "@wereform/pkgm-api": "^1.0.7",
21
- "@wereform/pkgm-shared": "^1.0.2",
22
- "@expo/vector-icons": "^15.0.3"
23
- },
24
- "devDependencies": {
25
- "@babel/cli": "^7.28.3",
26
- "@babel/core": "^7.28.5",
27
- "@babel/preset-env": "^7.28.5",
28
- "metro-react-native-babel-preset": "^0.77.0"
29
- },
30
- "scripts": {
31
- "build": "babel src --out-dir dist --extensions .js,.jsx"
32
- }
33
- }
1
+ {
2
+ "name": "@wereform/pkgm-video",
3
+ "version": "1.0.4",
4
+ "source": "dist/index.js",
5
+ "main": "dist/index.js",
6
+ "react-native": "dist/index.js",
7
+ "files": [
8
+ "dist",
9
+ "src",
10
+ "README.md"
11
+ ],
12
+ "scripts": {
13
+ "build": "babel src --out-dir dist --extensions .js,.jsx",
14
+ "prepublishOnly": "pnpm run build"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "peerDependencies": {
20
+ "@expo/vector-icons": "*",
21
+ "expo": "*",
22
+ "expo-video": "*",
23
+ "react": "*",
24
+ "react-native": "*"
25
+ },
26
+ "dependencies": {
27
+ "@wereform/pkgm-api": "^1.0.10",
28
+ "@wereform/pkgm-shared": "^1.0.4",
29
+ "@expo/vector-icons": "^15.0.3"
30
+ },
31
+ "devDependencies": {
32
+ "@babel/cli": "^7.28.3",
33
+ "@babel/core": "^7.28.5",
34
+ "@babel/preset-env": "^7.28.5",
35
+ "metro-react-native-babel-preset": "^0.77.0"
36
+ }
37
+ }
@@ -0,0 +1,36 @@
1
+ import { Image, View } from "react-native";
2
+
3
+ /**
4
+ * Thumbnail
5
+ *
6
+ * Lightweight thumbnail renderer for video and content previews.
7
+ *
8
+ * Props:
9
+ * - thumbnailURL: string URL of the thumbnail image
10
+ * - thumbHeight: numeric height for the thumbnail container
11
+ *
12
+ * Behavior:
13
+ * - Falls back to a default image when no URL is provided
14
+ * - Maintains a fixed 16:9 aspect ratio
15
+ * - Intended for list cards and compact layouts
16
+ */
17
+
18
+ export function Thumbnail({ thumbnailURL, thumbHeight }) {
19
+ return (
20
+ <View style={{ width: "auto" }}>
21
+ <Image
22
+ source={{
23
+ uri:
24
+ thumbnailURL ||
25
+ "https://begenone-images.s3.us-east-1.amazonaws.com/let+Me+Love+you.jpg",
26
+ }}
27
+ style={{
28
+ width: "100%",
29
+ height: thumbHeight,
30
+ aspectRatio: 16 / 9,
31
+ borderRadius: 5,
32
+ }}
33
+ />
34
+ </View>
35
+ );
36
+ }
@@ -0,0 +1,59 @@
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, useEffect, useRef } from "react";
6
+ import { useIsFocused, useFocusEffect } from "@react-navigation/native";
7
+
8
+ /**
9
+ * VideoPlayer
10
+ *
11
+ * Mobile-optimized video playback component using expo-video.
12
+ *
13
+ * Props:
14
+ * - videoSource: video URI or source object compatible with useVideoPlayer
15
+ *
16
+ * Behavior:
17
+ * - Auto-plays and loops video on mount
18
+ * - Resumes playback when screen gains focus
19
+ * - Pauses playback when screen loses focus
20
+ * - Maintains responsive 16:9 aspect ratio based on device width
21
+ *
22
+ * Notes:
23
+ * - Player instance is stored via ref for lifecycle control
24
+ * - Picture-in-picture is enabled
25
+ * - Designed for full video view screens
26
+ */
27
+
28
+ export function VideoPlayer({ videoSource }) {
29
+ const { width } = useWindowDimensions(); // Dynamically get device width
30
+ const isFocused = useIsFocused();
31
+
32
+ const playerRef = useRef(null);
33
+
34
+ const player = useVideoPlayer(videoSource, p => {
35
+ p.loop = true;
36
+ p.play();
37
+ playerRef.current = p; // store instance
38
+ });
39
+
40
+ useEffect(() => {
41
+ if (!player) return;
42
+
43
+ if (isFocused) player.play();
44
+ else player.pause();
45
+ }, [isFocused, player]);
46
+
47
+ useEvent(player, "playingChange");
48
+
49
+ return (
50
+ <View style={VideoPlayerStyles.contentContainer}>
51
+ <VideoView
52
+ style={[VideoPlayerStyles.video, { width, height: width * (9 / 16) }]} // 16:9 ratio
53
+ player={player}
54
+ // allowsFullscreen
55
+ allowsPictureInPicture
56
+ />
57
+ </View>
58
+ );
59
+ }
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,71 @@
1
+ import { Text, TouchableOpacity, View } from "react-native";
2
+ import { Thumbnail } from "../components/Thumbnail";
3
+ import { CustomizedTitle, DateViews } from "@wereform/pkgm-shared";
4
+
5
+ /**
6
+ * VideoCardHorizontalLayout
7
+ *
8
+ * Compact horizontal video card used in lists or history views.
9
+ * Displays thumbnail, title, and basic metadata (date + views).
10
+ *
11
+ * Props:
12
+ * - eyeIcon: ReactNode for views icon
13
+ * - timeAgo: string representing publish time
14
+ * - viewsText: string/number of views
15
+ * - titleText: video title
16
+ * - contentThumbUrl: thumbnail image URL
17
+ * - navigateToVideo: navigation handler on press
18
+ *
19
+ * Notes:
20
+ * - Entire card is pressable
21
+ * - Uses shared UI components for consistency
22
+ */
23
+
24
+ export function VideoCardHorizontalLayout({
25
+ eyeIcon,
26
+ timeAgo,
27
+ viewsText,
28
+ titleText,
29
+ contentThumbUrl,
30
+ navigateToVideo,
31
+ }) {
32
+ return (
33
+ <TouchableOpacity
34
+ onPress={navigateToVideo}
35
+ style={{
36
+ flexDirection: "row",
37
+ padding: 8,
38
+ }}
39
+ >
40
+ <Thumbnail thumbHeight={90} thumbnailURL={contentThumbUrl} />
41
+ <View style={{ flex: 1, marginLeft: 12 }}>
42
+ <CustomizedTitle
43
+ title={titleText || "This is a dummy text title for the video"}
44
+ fontSize={18}
45
+ textColor="white"
46
+ style={{ width: "100%" }}
47
+ />
48
+
49
+ <DateViews
50
+ eyeIcon={eyeIcon}
51
+ timeAgo={timeAgo}
52
+ viewsText={viewsText}
53
+ containerStyles={{
54
+ flexDirection: "column",
55
+ justifyContent: "start",
56
+ height: 40,
57
+ }}
58
+ dateContainerStyles={{
59
+ paddingBottom: 4,
60
+ }}
61
+ dateTextStyles={{
62
+ fontSize: 12,
63
+ }}
64
+ viewsTextStyles={{
65
+ fontSize: 12,
66
+ }}
67
+ />
68
+ </View>
69
+ </TouchableOpacity>
70
+ );
71
+ }
@@ -0,0 +1,95 @@
1
+ import { Image, Text, TouchableOpacity, View } from "react-native";
2
+ import { VideoCardLayoutStyles } from "../styles/VideoCardLayoutStyles";
3
+ import { DateViews } from "@wereform/pkgm-shared";
4
+
5
+ /**
6
+ * VideoCardHorizontalLayout
7
+ *
8
+ * Compact horizontal video card used in lists or history views.
9
+ * Displays thumbnail, title, and basic metadata (date + views).
10
+ *
11
+ * Props:
12
+ * - eyeIcon: ReactNode for views icon
13
+ * - timeAgo: string representing publish time
14
+ * - viewsText: string/number of views
15
+ * - titleText: video title
16
+ * - contentThumbUrl: thumbnail image URL
17
+ * - navigateToVideo: navigation handler on press
18
+ *
19
+ * Notes:
20
+ * - Entire card is pressable
21
+ * - Uses shared UI components for consistency
22
+ */
23
+
24
+ export const VideoCardLayout = ({
25
+ timeAgo,
26
+ viewsText,
27
+ titleText,
28
+ userNameText,
29
+ contentThumbUrl,
30
+ channelLogo,
31
+ containerStyles,
32
+ dateViewsContainerStyle,
33
+ userImageStyles,
34
+ titleNameContainerStyles,
35
+ userNameTextStyles,
36
+ titleTextStyles,
37
+ thumbnailImageStyles,
38
+ customMetaDataStyles,
39
+ navigateToVideo,
40
+ }) => {
41
+ console.log("Checking for Conent Thumbnail URL: ", contentThumbUrl);
42
+ return (
43
+ <View
44
+ style={[VideoCardLayoutStyles.container, containerStyles]}
45
+ onPress={navigateToVideo}
46
+ >
47
+ <View style={VideoCardLayoutStyles.imageWrapper}>
48
+ <Image
49
+ source={{
50
+ uri:
51
+ contentThumbUrl ||
52
+ "https://begenone-images.s3.us-east-1.amazonaws.com/let+Me+Love+you.jpg",
53
+ }}
54
+ style={[VideoCardLayoutStyles.image, thumbnailImageStyles]}
55
+ />
56
+ </View>
57
+
58
+ <DateViews
59
+ timeAgo={timeAgo}
60
+ viewsText={viewsText}
61
+ containerStyles={dateViewsContainerStyle}
62
+ />
63
+
64
+ <View style={[VideoCardLayoutStyles.metaData, customMetaDataStyles]}>
65
+ <Image
66
+ source={{
67
+ uri:
68
+ channelLogo ||
69
+ "https://begenone-images.s3.us-east-1.amazonaws.com/default-user-photo.jpg",
70
+ }}
71
+ style={[VideoCardLayoutStyles.userImage, userImageStyles]}
72
+ />
73
+ <View
74
+ style={[
75
+ VideoCardLayoutStyles.titleNameContainer,
76
+ titleNameContainerStyles,
77
+ ]}
78
+ >
79
+ <Text
80
+ style={[VideoCardLayoutStyles.titleText, titleTextStyles]}
81
+ numberOfLines={2}
82
+ >
83
+ {titleText ||
84
+ "This is a Default Title Text in case of nothing being passed in."}
85
+ </Text>
86
+ <Text
87
+ style={[VideoCardLayoutStyles.userNameText, userNameTextStyles]}
88
+ >
89
+ {userNameText || "Default Username"}
90
+ </Text>
91
+ </View>
92
+ </View>
93
+ </View>
94
+ );
95
+ };
@@ -0,0 +1,130 @@
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
+ /**
12
+ * VideoViewLayout
13
+ *
14
+ * Full video viewing screen layout.
15
+ * Renders video player, title, interactions, channel metadata,
16
+ * and a list of suggested videos.
17
+ *
18
+ * Props:
19
+ * - videoSource: video stream/source
20
+ * - CustomizedTitleText: main video title
21
+ * - MenuChannelMetaTimeAgo: publish time
22
+ * - MenuChannelMetaViews: view count
23
+ * - MenuChannelMetaUserName: channel name
24
+ * - MenuChannelMetaSubCount: subscriber count
25
+ * - MenuChannelMetaChannelLogo: channel avatar
26
+ * - suggestedVideos: array of related video objects
27
+ *
28
+ * Notes:
29
+ * - Suggested videos are rendered using VideoCardLayout
30
+ * - Layout is scrollable and mobile-optimized
31
+ * - Interaction icons are visual; behavior is wired elsewhere
32
+ */
33
+
34
+ export function VideoViewLayout({
35
+ videoSource,
36
+ CustomizedTitleText,
37
+ MenuChannelMetaTimeAgo,
38
+ MenuChannelMetaViews,
39
+ MenuChannelMetaUserName,
40
+ MenuChannelMetaSubCount,
41
+ MenuChannelMetaChannelLogo,
42
+ suggestedVideos,
43
+ }) {
44
+ console.log(
45
+ "SUGGESTED VIDEOS FROM VIDEO VIEWS LAYOUT: =>\n" +
46
+ JSON.stringify(suggestedVideos[0].videos, null, 2),
47
+ );
48
+ return (
49
+ <ScrollView>
50
+ <View>
51
+ <VideoPlayer key={videoSource} videoSource={videoSource} />
52
+ </View>
53
+ <CustomizedTitle
54
+ title={CustomizedTitleText}
55
+ fontSize={22}
56
+ fontFamily="Inter"
57
+ textColor="white"
58
+ style={{
59
+ paddingTop: 18,
60
+ paddingLeft: 22,
61
+ paddingRight: 22,
62
+ paddingBottom: 18,
63
+ alignSelf: "start",
64
+ }}
65
+ textStyle={{
66
+ lineHeight: 28,
67
+ }}
68
+ />
69
+
70
+ <MenuInteraction
71
+ likeIcon={<Ionicons name="thumbs-up-outline" size={24} color="white" />}
72
+ dislikeIcon={
73
+ <Ionicons name="thumbs-down-outline" size={24} color="white" />
74
+ }
75
+ shareIcon={
76
+ <Ionicons name="arrow-redo-outline" size={24} color="white" />
77
+ }
78
+ // commentIcon={
79
+ // <Ionicons
80
+ // name="chatbubble-ellipses-outline"
81
+ // size={24}
82
+ // color="white"
83
+ // />
84
+ // }
85
+ containerStyles={{
86
+ marginLeft: 12,
87
+ }}
88
+ />
89
+
90
+ <MenuChannelMeta
91
+ calendarIcon={
92
+ <Ionicons name="calendar-clear-outline" size={18} color="white" />
93
+ }
94
+ timeAgo={MenuChannelMetaTimeAgo}
95
+ eyeIcon={<Ionicons name="eye-outline" size={18} color="white" />}
96
+ viewsText={MenuChannelMetaViews}
97
+ userName={MenuChannelMetaUserName}
98
+ subscribersCount={MenuChannelMetaSubCount}
99
+ channelLogo={MenuChannelMetaChannelLogo}
100
+ containerStyles={{
101
+ marginTop: 12,
102
+ }}
103
+ />
104
+
105
+ {suggestedVideos[0].videos.map(video => {
106
+ return (
107
+ <View style={{ marginTop: 24 }} key={video._id}>
108
+ <VideoCardLayout
109
+ key={video._id}
110
+ titleText={video.title}
111
+ contentThumbUrl={video.thumbUrl}
112
+ userNameText={video.channel?.name || "Unknown"}
113
+ channelLogo={video.channelLogo}
114
+ timeAgo={video.videoTimeAgo}
115
+ viewsText={String(video.views)}
116
+ calendarIcon={
117
+ <Ionicons
118
+ name="calendar-clear-outline"
119
+ size={18}
120
+ color="white"
121
+ />
122
+ }
123
+ eyeIcon={<Ionicons name="eye-outline" size={18} color="white" />}
124
+ />
125
+ </View>
126
+ );
127
+ })}
128
+ </ScrollView>
129
+ );
130
+ }
@@ -0,0 +1,64 @@
1
+ import { globalStyles } from "./globalStyles";
2
+
3
+ /* Video card layout styles for feed and listings */
4
+ export const VideoCardLayoutStyles = {
5
+ container: {
6
+ // Video card outer container
7
+ width: "auto",
8
+ flexDirection: "column",
9
+ marginRight: 12,
10
+ marginLeft: 12,
11
+ marginBottom: 40,
12
+ },
13
+
14
+ imageWrapper: {
15
+ // Video thumbnail wrapper
16
+ width: "100%",
17
+ },
18
+
19
+ image: {
20
+ // Video thumbnail image
21
+ width: "100%",
22
+ resizeMode: "contain",
23
+ aspectRatio: 16 / 9,
24
+ borderRadius: globalStyles.borders.borderPrimary100,
25
+ },
26
+
27
+ metaData: {
28
+ // Metadata row below thumbnail
29
+ flexDirection: "row",
30
+ marginTop: 16,
31
+ paddingLeft: 8,
32
+ paddingRight: 8,
33
+ },
34
+
35
+ userImage: {
36
+ // Channel avatar image
37
+ width: 40,
38
+ height: 40,
39
+ borderRadius: globalStyles.borders.borderPrimary50,
40
+ },
41
+
42
+ titleNameContainer: {
43
+ // Video title and author container
44
+ width: "100%",
45
+ flexDirection: "column",
46
+ paddingLeft: 16,
47
+ flexShrink: 1,
48
+ },
49
+
50
+ titleText: {
51
+ // Video title text
52
+ fontSize: 22,
53
+ paddingBottom: 12,
54
+ lineHeight: 30,
55
+ fontWeight: "bold",
56
+ color: "#fff",
57
+ },
58
+
59
+ userNameText: {
60
+ // Channel name text
61
+ color: globalStyles.colors.colorPrimary400,
62
+ fontWeight: "bold",
63
+ },
64
+ };
@@ -0,0 +1,19 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ /* Video player layout and control styles */
4
+ export const VideoPlayerStyles = StyleSheet.create({
5
+ contentContainer: {
6
+ // Player content wrapper
7
+ alignItems: "center",
8
+ justifyContent: "flex-start",
9
+ },
10
+
11
+ video: {
12
+ // Video element styling
13
+ },
14
+
15
+ controlsContainer: {
16
+ // Playback controls container
17
+ padding: 10,
18
+ },
19
+ });
@@ -0,0 +1,28 @@
1
+ import { StyleSheet } from "react-native";
2
+
3
+ /* Global design tokens for colors and border radii */
4
+ export const globalStyles = StyleSheet.create({
5
+ colors: {
6
+ // Primary background shades
7
+ colorPrimary50: "rgba(21, 21, 21, .7)",
8
+ colorPrimary100: "#151515",
9
+ colorPrimary200: "#252525",
10
+ colorPrimary300: "#3C3C3C",
11
+ colorPrimary350: "rgba(60,60,60,.2)",
12
+ colorPrimary400: "#7F7F7F",
13
+ colorPrimary500: "#D3D3D3",
14
+
15
+ // Accent and action colors
16
+ colorPrimary600: "#ff6600ff",
17
+ colorPrimary700: "#FF8800",
18
+ },
19
+
20
+ borders: {
21
+ // Standard border radius scale
22
+ borderPrimary50: 8,
23
+ borderPrimary100: 10,
24
+ borderPrimary200: 12,
25
+ borderPrimary300: 15,
26
+ borderPrimary400: 30,
27
+ },
28
+ });