From fb8b65e61bfd47c9bea28b7b1bd81a686c897e76 Mon Sep 17 00:00:00 2001 From: tapframe Date: Sun, 12 Oct 2025 10:44:13 +0530 Subject: [PATCH] trailerplayer stuck after finishing fix --- build-and-publish-app-release.sh | 0 src/components/metadata/HeroSection.tsx | 12 +++++++++++- src/components/video/TrailerPlayer.tsx | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) mode change 100644 => 100755 build-and-publish-app-release.sh diff --git a/build-and-publish-app-release.sh b/build-and-publish-app-release.sh old mode 100644 new mode 100755 diff --git a/src/components/metadata/HeroSection.tsx b/src/components/metadata/HeroSection.tsx index 8a0a811e..eb8c9c53 100644 --- a/src/components/metadata/HeroSection.tsx +++ b/src/components/metadata/HeroSection.tsx @@ -859,7 +859,7 @@ const HeroSection: React.FC = memo(({ }, [trailerOpacity, thumbnailOpacity]); // Handle trailer end - seamless transition back to thumbnail - const handleTrailerEnd = useCallback(() => { + const handleTrailerEnd = useCallback(async () => { logger.info('HeroSection', 'Trailer ended - transitioning back to thumbnail'); setTrailerPlaying(false); @@ -867,6 +867,16 @@ const HeroSection: React.FC = memo(({ setTrailerReady(false); setTrailerPreloaded(false); + // If trailer is in fullscreen, dismiss it first + try { + if (trailerVideoRef.current) { + await trailerVideoRef.current.dismissFullscreenPlayer(); + logger.info('HeroSection', 'Dismissed fullscreen player after trailer ended'); + } + } catch (error) { + logger.warn('HeroSection', 'Error dismissing fullscreen player:', error); + } + // Smooth fade transition: trailer out, thumbnail in trailerOpacity.value = withTiming(0, { duration: 500 }); thumbnailOpacity.value = withTiming(1, { duration: 500 }); diff --git a/src/components/video/TrailerPlayer.tsx b/src/components/video/TrailerPlayer.tsx index 0fe7240a..5ce62332 100644 --- a/src/components/video/TrailerPlayer.tsx +++ b/src/components/video/TrailerPlayer.tsx @@ -288,6 +288,11 @@ const TrailerPlayer = React.forwardRef(({ if (videoRef.current && isComponentMounted) { return videoRef.current.presentFullscreenPlayer(); } + }, + dismissFullscreenPlayer: () => { + if (videoRef.current && isComponentMounted) { + return videoRef.current.dismissFullscreenPlayer(); + } } }));