added vlc playback speed control

This commit is contained in:
tapframe 2025-10-24 20:47:14 +05:30
parent 665ff06ad1
commit 1ba0a49778
5 changed files with 27 additions and 10 deletions

View file

@ -253,7 +253,7 @@ const HeroCarousel: React.FC<HeroCarouselProps> = ({ items, loading = false }) =
if (!hasData) return null; if (!hasData) return null;
return ( return (
<Animated.View entering={FadeIn.duration(350).easing(Easing.out(Easing.cubic))}> <Animated.View entering={FadeIn.duration(150).easing(Easing.out(Easing.cubic))}>
<Animated.View style={[styles.container as ViewStyle]}> <Animated.View style={[styles.container as ViewStyle]}>
{/* Removed preload images for performance - let FastImage cache handle it naturally */} {/* Removed preload images for performance - let FastImage cache handle it naturally */}
{settings.enableHomeHeroBackground && data[activeIndex] && ( {settings.enableHomeHeroBackground && data[activeIndex] && (

View file

@ -1157,12 +1157,28 @@ const HeroSection: React.FC<HeroSectionProps> = memo(({
// Auto-start trailer when ready on initial entry if enabled // Auto-start trailer when ready on initial entry if enabled
useEffect(() => { useEffect(() => {
if (trailerReady && settings?.showTrailers && isFocused && !globalTrailerPlaying && !startedOnReadyRef.current) { if (trailerReady && settings?.showTrailers && isFocused && !globalTrailerPlaying && !startedOnReadyRef.current) {
startedOnReadyRef.current = true; // Check scroll position - only auto-start if user hasn't scrolled past the hero section
logger.info('HeroSection', 'Trailer ready - auto-starting playback'); try {
setTrailerPlaying(true); const y = (scrollY as any).value || 0;
isPlayingSV.value = 1; const pauseThreshold = heroHeight.value * 0.7;
if (y < pauseThreshold) {
startedOnReadyRef.current = true;
logger.info('HeroSection', 'Trailer ready - auto-starting playback');
setTrailerPlaying(true);
isPlayingSV.value = 1;
} else {
logger.info('HeroSection', 'Trailer ready but user scrolled past - not auto-starting');
// Mark as started to prevent retry
startedOnReadyRef.current = true;
}
} catch (_e) {
// Fallback if scroll position unavailable - don't auto-start to be safe
logger.info('HeroSection', 'Trailer ready but scroll position unavailable - not auto-starting');
startedOnReadyRef.current = true;
}
} }
}, [trailerReady, settings?.showTrailers, isFocused, globalTrailerPlaying, setTrailerPlaying]); }, [trailerReady, settings?.showTrailers, isFocused, globalTrailerPlaying, setTrailerPlaying, scrollY, heroHeight]);
// Handle fullscreen toggle // Handle fullscreen toggle
const handleFullscreenToggle = useCallback(async () => { const handleFullscreenToggle = useCallback(async () => {

View file

@ -3323,6 +3323,7 @@ const AndroidVideoPlayer: React.FC = () => {
ref={vlcPlayerRef} ref={vlcPlayerRef}
source={processedStreamUrl} source={processedStreamUrl}
volume={volume} volume={volume}
playbackSpeed={playbackSpeed}
zoomScale={zoomScale} zoomScale={zoomScale}
resizeMode={resizeMode} resizeMode={resizeMode}
onLoad={(data) => { onLoad={(data) => {

View file

@ -16,6 +16,7 @@ try {
interface VlcVideoPlayerProps { interface VlcVideoPlayerProps {
source: string; source: string;
volume: number; volume: number;
playbackSpeed: number;
zoomScale: number; zoomScale: number;
resizeMode: 'contain' | 'cover' | 'none'; resizeMode: 'contain' | 'cover' | 'none';
onLoad: (data: any) => void; onLoad: (data: any) => void;
@ -46,6 +47,7 @@ export interface VlcPlayerRef {
const VlcVideoPlayer = forwardRef<VlcPlayerRef, VlcVideoPlayerProps>(({ const VlcVideoPlayer = forwardRef<VlcPlayerRef, VlcVideoPlayerProps>(({
source, source,
volume, volume,
playbackSpeed,
zoomScale, zoomScale,
resizeMode, resizeMode,
onLoad, onLoad,
@ -342,7 +344,7 @@ const VlcVideoPlayer = forwardRef<VlcPlayerRef, VlcVideoPlayerProps>(({
volume={Math.round(Math.max(0, Math.min(1, volume)) * 100)} volume={Math.round(Math.max(0, Math.min(1, volume)) * 100)}
mute={false} mute={false}
repeat={false} repeat={false}
rate={1} rate={playbackSpeed}
autoplay={false} autoplay={false}
onFirstPlay={handleFirstPlay} onFirstPlay={handleFirstPlay}
onPositionChanged={handlePositionChanged} onPositionChanged={handlePositionChanged}

View file

@ -631,20 +631,18 @@ const HomeScreen = () => {
const heroStyleToUse = isTablet ? 'legacy' : settings.heroStyle; const heroStyleToUse = isTablet ? 'legacy' : settings.heroStyle;
return heroStyleToUse === 'carousel' ? ( return heroStyleToUse === 'carousel' ? (
<HeroCarousel <HeroCarousel
key={`carousel-${featuredContentSource}`}
items={allFeaturedContent || (featuredContent ? [featuredContent] : [])} items={allFeaturedContent || (featuredContent ? [featuredContent] : [])}
loading={featuredLoading} loading={featuredLoading}
/> />
) : ( ) : (
<FeaturedContent <FeaturedContent
key={`featured-${showHeroSection}-${featuredContentSource}`}
featuredContent={featuredContent} featuredContent={featuredContent}
isSaved={isSaved} isSaved={isSaved}
handleSaveToLibrary={handleSaveToLibrary} handleSaveToLibrary={handleSaveToLibrary}
loading={featuredLoading} loading={featuredLoading}
/> />
); );
}, [isTablet, settings.heroStyle, showHeroSection, featuredContentSource, featuredLoading]); }, [isTablet, settings.heroStyle, showHeroSection, featuredContentSource, allFeaturedContent, featuredContent, isSaved, handleSaveToLibrary, featuredLoading]);
const memoizedThisWeekSection = useMemo(() => <ThisWeekSection />, []); const memoizedThisWeekSection = useMemo(() => <ThisWeekSection />, []);
const memoizedContinueWatchingSection = useMemo(() => <ContinueWatchingSection ref={continueWatchingRef} />, []); const memoizedContinueWatchingSection = useMemo(() => <ContinueWatchingSection ref={continueWatchingRef} />, []);