Skip to content

Commit

Permalink
Update AppxVideoPlayer.tsx - Added full screen feature on double clic…
Browse files Browse the repository at this point in the history
…k on video iframe

I was facing some issues, and, wanted a feature, to make the video go to full screen on double click, just like YouTube as clicking on that little icon multiple times was quite annoyoing.
So, I have added this feature to make video go full screen on double click.
  • Loading branch information
adityasharmawork authored Feb 3, 2025
1 parent a7ed763 commit 16dd2b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/AppxVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,16 @@ export const AppxVideoPlayer = ({
src={url}
className="w-full rounded-lg aspect-video"
allowFullScreen
onDoubleClick={(e) => { // Full screen on double click
if (e.currentTarget.requestFullscreen) {
e.currentTarget.requestFullscreen();
} else if (e.currentTarget.mozRequestFullScreen) { // Firefox
e.currentTarget.mozRequestFullScreen();
} else if (e.currentTarget.webkitRequestFullscreen) { // Chrome, Safari, and Opera
e.currentTarget.webkitRequestFullscreen();
} else if (e.currentTarget.msRequestFullscreen) { // IE/Edge
e.currentTarget.msRequestFullscreen();
}
}}
></iframe >;
};

0 comments on commit 16dd2b3

Please sign in to comment.