trailerplayer stuck after finishing fix

This commit is contained in:
tapframe 2025-10-12 10:44:13 +05:30
parent 03bded3775
commit fb8b65e61b
3 changed files with 16 additions and 1 deletions

0
build-and-publish-app-release.sh Normal file → Executable file
View file

View file

@ -859,7 +859,7 @@ const HeroSection: React.FC<HeroSectionProps> = 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<HeroSectionProps> = 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 });

View file

@ -288,6 +288,11 @@ const TrailerPlayer = React.forwardRef<any, TrailerPlayerProps>(({
if (videoRef.current && isComponentMounted) {
return videoRef.current.presentFullscreenPlayer();
}
},
dismissFullscreenPlayer: () => {
if (videoRef.current && isComponentMounted) {
return videoRef.current.dismissFullscreenPlayer();
}
}
}));