Skip to content

Commit

Permalink
Create YoutubeRenderer.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysingh2219 committed Apr 16, 2024
1 parent 7ff5d5f commit 4f1310f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/components/YoutubeRenderer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';

interface Props {
videoURL: string;
width: string;
height: string;
style?: React.CSSProperties;
}

export const YoutubeRenderer = ({ width, height, videoURL, style }: Props) => {
if (!videoURL) {
return null;
}
return (
<iframe
width={width}
height={height}
src={videoURL}
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerPolicy="strict-origin-when-cross-origin"
allowFullScreen
style={style}
></iframe>
);
};

// Example Usage:
/* <YoutubeRenderer
width="1280"
height="720"
videoURL={'https://www.youtube.com/embed/IJkYipYNEtI?si=lJKtCZFohqFn1l5z'}
/>; */

export default YoutubeRenderer;

0 comments on commit 4f1310f

Please sign in to comment.