From 3ef5f164784d7247de0d5cd4b61ce008c6123302 Mon Sep 17 00:00:00 2001 From: Gianni Ferullo Date: Fri, 2 Aug 2024 18:38:41 -0400 Subject: [PATCH 1/3] fix loop video when using SSR --- packages/react-components/src/components/video/video.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-components/src/components/video/video.tsx b/packages/react-components/src/components/video/video.tsx index e65c4c6f..c1856de9 100644 --- a/packages/react-components/src/components/video/video.tsx +++ b/packages/react-components/src/components/video/video.tsx @@ -167,15 +167,15 @@ const Video = ({ } }, [onWaiting]) const _onEnded = useCallback(() => { - // helps prevent two ended events when changing media - if (!hasPlayingFired.current) { - return - } if (loop && videoEl.current) { videoEl.current.play() } onLoop?.(loopNumber.current) loopNumber.current = loopNumber.current + 1 + // helps prevent two ended events when changing media + if (!hasPlayingFired.current) { + return + } onEnded?.() }, [onEnded, loop, onLoop]) const _onEndFullscreen = useCallback(() => onEndFullscreen?.(), [onEndFullscreen]) From cd4fd521009dfe04eb81f95a29b71656520931ee Mon Sep 17 00:00:00 2001 From: Gianni Ferullo Date: Sat, 3 Aug 2024 14:47:55 -0400 Subject: [PATCH 2/3] option to hide the title --- packages/react-components/src/components/video/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-components/src/components/video/index.tsx b/packages/react-components/src/components/video/index.tsx index 9de09b8d..54d00510 100644 --- a/packages/react-components/src/components/video/index.tsx +++ b/packages/react-components/src/components/video/index.tsx @@ -15,6 +15,8 @@ type Props = { controls?: boolean // if controls is true, hides progress bar hideProgressBar?: boolean + // if controls is true, hides the title + hideTitle?: boolean // if controls is true, hides mute hideMute?: boolean // hide attribution @@ -112,6 +114,7 @@ const VideoPlayer = (props: ComponentProps) => { hideMute, hideAttribution, hideProgressBar, + hideTitle, className, persistentControls, gif, @@ -193,7 +196,7 @@ const VideoPlayer = (props: ComponentProps) => { {showControls && } - {isLargePlayer && ( + {!hideTitle && isLargePlayer && ( { e.preventDefault() From 7eb17c5c20a965146f077899290072c9eb8caa81 Mon Sep 17 00:00:00 2001 From: Gianni Ferullo <giannif@gmail.com> Date: Mon, 5 Aug 2024 13:42:39 -0400 Subject: [PATCH 3/3] changeset --- .changeset/silly-dots-juggle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/silly-dots-juggle.md diff --git a/.changeset/silly-dots-juggle.md b/.changeset/silly-dots-juggle.md new file mode 100644 index 00000000..1e2198b6 --- /dev/null +++ b/.changeset/silly-dots-juggle.md @@ -0,0 +1,5 @@ +--- +'@giphy/react-components': minor +--- + +video player tweaks: hide title / fix SSR loop error