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;
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]}>
{/* Removed preload images for performance - let FastImage cache handle it naturally */}
{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
useEffect(() => {
if (trailerReady && settings?.showTrailers && isFocused && !globalTrailerPlaying && !startedOnReadyRef.current) {
startedOnReadyRef.current = true;
logger.info('HeroSection', 'Trailer ready - auto-starting playback');
setTrailerPlaying(true);
isPlayingSV.value = 1;
// Check scroll position - only auto-start if user hasn't scrolled past the hero section
try {
const y = (scrollY as any).value || 0;
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
const handleFullscreenToggle = useCallback(async () => {

View file

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

View file

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

View file

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