Skip to content

Commit

Permalink
Linking to videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyannnnn committed May 27, 2024
1 parent 68304be commit 58f1c0d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 19 deletions.
10 changes: 10 additions & 0 deletions src/Components/Feed/Feed.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@
}
.card p{
font-size: 14px;
}


#loader{
height: 100vh;
color: red;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
}
5 changes: 4 additions & 1 deletion src/Components/Feed/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const Feed = ({ Catagory }) => {
}
};




useEffect(() => {
fetchData();
}, [Catagory]);
Expand All @@ -35,7 +38,7 @@ const Feed = ({ Catagory }) => {
</Link>
))
) : (
<p>Loading videos...</p>
<p id='loader'>Loading videos...</p>
)}
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import upload_icon from '../../assets/upload.png'
import more_icon from '../../assets/more.png'
import notification_icon from '../../assets/notification.png'
import hero from '../../assets/hero.jpg'
import { Link } from 'react-router-dom'
const Navbar = ({setSidebar}) => {
return (
<nav className='flex-div'>
<div className='nav-left flex-div'>
<img id='menu-logo' src={menu_icon} onClick={()=>setSidebar(prev => prev === false ? true :false )} alt="" />
<img id='hero-logo' src={herologo} alt="" />
<Link to='/'><img id='hero-logo' src={herologo} alt="" /></Link>
</div>
<div className="nav-middle flex-div">
<div className="search-box flex-div ">
Expand Down
3 changes: 2 additions & 1 deletion src/Components/PlayVideo/PlayVideo.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.play-video{
flex-basis: 69%;
}
.play-video video{
.play-video iframe{
width: 100%;
height: 37vw;
}
.play-video h3{
margin-top: 10px;
Expand Down
12 changes: 9 additions & 3 deletions src/Components/PlayVideo/PlayVideo.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import './PlayVideo.css'
import video1 from '../../assets/video.mp4'
import like from '../../assets/like.png'
Expand All @@ -8,10 +8,16 @@ import save from '../../assets/save.png'
import hero from '../../assets/hero.jpg'
import user_profile from '../../assets/user_profile.jpg'

const PlayVideo = () => {
const PlayVideo = ({videoId}) => {

useEffect(()=>{
console.log("Videopage Is realoading !!!!");
})

return (
<div className="play-video">
<video src={video1} controls muted autoPlay></video>
{/* <video src={video1} controls muted autoPlay></video> */}
<iframe src={`https://www.youtube.com/embed/${videoId}?autoplay=1`} frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowFullScreen></iframe>
<div className="play-video-info">
<p>150 M viwes &bull; 2 days ago</p>
<div>
Expand Down
20 changes: 9 additions & 11 deletions src/Data.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
export const API_KEY = 'AIzaSyBCqueFuzCscUq9ccWsu-YsiiMUN57b84I';

export const valuechanger=(value)=>{
if(value>=1000000){
return Math.floor(value/1000000)+'M'
export const valuechanger = (value) => {
if (value >= 1000000) {
return Math.floor(value / 1000000) + 'M';
} else if (value >= 100000) {
return Math.floor(value / 100000) + 'L';
} else if (value >= 1000) {
return Math.floor(value / 1000) + 'K';
} else {
return value.toString(); // Return value as a string for consistency
}
else if(1000000>value>=1000){
return Math.floor(value/1000)+'K'
}
else{
return value
}


}
7 changes: 5 additions & 2 deletions src/Pages/Video/Video.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import React from 'react'
import '../Video/Video.css'
import PlayVideo from '../../Components/PlayVideo/PlayVideo'
import Recomended from '../../Components/Recomended/Recomended'
import { useParams } from 'react-router-dom'

const Video = () => {
const{videoId,catagoryId}=useParams();

return (
<div className="play-container">
<PlayVideo/>
<Recomended/>
<PlayVideo videoId={videoId} />
<Recomended catagoryId={catagoryId} />
</div>
)
}
Expand Down

0 comments on commit 58f1c0d

Please sign in to comment.