Skip to content

Commit

Permalink
Change Video Player to Plyr Player
Browse files Browse the repository at this point in the history
  • Loading branch information
kaamil-ahamadh committed Nov 19, 2022
1 parent 1774f1c commit c23d172
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
16 changes: 16 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,20 @@ input {
left: 16px;
bottom: 25px;
}

.related-videos {
margin-top: 5vh;
}
}

@media screen and (min-width: 1200px) {
.related-videos {
margin-top: 25vh;
}
}

@media screen and (min-width: 1400px) {
.related-videos {
margin-top: 35vh;
}
}
18 changes: 15 additions & 3 deletions src/components/VideoPlayCard.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
import React from "react";
import Plyr from "plyr-react";
import "plyr-react/plyr.css";

const VideoPlayCard = ({ id, title, description, channelName }) => {
return (
<div className="card-play-video">
<div className="play-video-container">
<div>
<iframe
{/* <iframe
width="100%"
// height="280px"
src={`https://www.youtube.com/embed/${id}`}
title="YouTube Video Player"
frameBorder="0"
className="iframe"
></iframe>
></iframe> */}
<Plyr
source={{
type: "video",
sources: [
{
src: id,
provider: "youtube",
},
],
}}
/>
</div>
</div>
<div className="play-video-details">
Expand Down
6 changes: 3 additions & 3 deletions src/screens/VideoDetailsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ const VideoDetailsScreen = () => {
return (
<>
{video?.length > 0 && relatedVideos?.length > 0 ? (
<>
<div className="video-player-container">
<VideoPlayCard
id={id}
title={video[0].snippet.title}
description={video[0].snippet.description}
channelName={video[0].snippet.channelTitle}
/>
<div>
<div className="related-videos">
<br />
<br />
<br />
Expand All @@ -45,7 +45,7 @@ const VideoDetailsScreen = () => {
return <VideoCardResults data={video} key={index} />;
})}
</div>
</>
</div>
) : (
<div>Video Loading...</div>
)}
Expand Down

0 comments on commit c23d172

Please sign in to comment.