mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-20 16:22:04 +00:00
some change in players
This commit is contained in:
parent
ad2e1816dc
commit
583db67853
3 changed files with 22 additions and 11 deletions
|
|
@ -956,23 +956,34 @@ const AndroidVideoPlayer: React.FC = () => {
|
||||||
setUseCustomSubtitles(true);
|
setUseCustomSubtitles(true);
|
||||||
setSelectedTextTrack(-1);
|
setSelectedTextTrack(-1);
|
||||||
logger.log(`[AndroidVideoPlayer] Loaded subtitle: ${subtitle.lang} from ${subtitle.addonName}`);
|
logger.log(`[AndroidVideoPlayer] Loaded subtitle: ${subtitle.lang} from ${subtitle.addonName}`);
|
||||||
console.log('[AndroidVideoPlayer] Subtitle loaded successfully');
|
console.log('[AndroidVideoPlayer] Subtitle loaded successfully, about to seek');
|
||||||
|
|
||||||
// Force a state update by triggering a seek
|
// Force a state update by triggering a seek
|
||||||
if (videoRef.current && duration > 0) {
|
if (videoRef.current && duration > 0 && !isSeeking.current) {
|
||||||
const currentPos = currentTime;
|
const currentPos = currentTime;
|
||||||
console.log('[AndroidVideoPlayer] Forcing a micro-seek to refresh subtitle state');
|
console.log(`[AndroidVideoPlayer] Forcing a micro-seek to refresh subtitle state from ${currentPos}s`);
|
||||||
videoRef.current.seek(currentPos);
|
seekToTime(currentPos);
|
||||||
|
|
||||||
|
// Wait for seek to complete before clearing loading state
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('[AndroidVideoPlayer] Clearing isLoadingSubtitles after seek timeout');
|
||||||
|
setIsLoadingSubtitles(false);
|
||||||
|
}, 600); // Wait longer than seekToTime's internal timeout (500ms)
|
||||||
|
} else {
|
||||||
|
console.warn(`[AndroidVideoPlayer] Cannot seek to refresh subtitles: videoRef=${!!videoRef.current}, duration=${duration}, seeking=${isSeeking.current}`);
|
||||||
|
// Clear loading state immediately if we can't seek
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsLoadingSubtitles(false);
|
||||||
|
console.log('[AndroidVideoPlayer] isLoadingSubtitles set to false (no seek)');
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('[AndroidVideoPlayer] Error loading Stremio subtitle:', error);
|
logger.error('[AndroidVideoPlayer] Error loading Stremio subtitle:', error);
|
||||||
console.log('[AndroidVideoPlayer] Subtitle loading failed:', error);
|
console.log('[AndroidVideoPlayer] Subtitle loading failed:', error);
|
||||||
} finally {
|
// Clear loading state on error
|
||||||
console.log('[AndroidVideoPlayer] Setting isLoadingSubtitles to false');
|
|
||||||
// Add a small delay to ensure state updates are processed
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setIsLoadingSubtitles(false);
|
setIsLoadingSubtitles(false);
|
||||||
console.log('[AndroidVideoPlayer] isLoadingSubtitles set to false');
|
console.log('[AndroidVideoPlayer] isLoadingSubtitles set to false (error)');
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ const VideoPlayer: React.FC = () => {
|
||||||
// Use AndroidVideoPlayer for:
|
// Use AndroidVideoPlayer for:
|
||||||
// - Android devices
|
// - Android devices
|
||||||
// - Xprime streams on any platform
|
// - Xprime streams on any platform
|
||||||
// - Non-MKV files on iOS
|
// - MKV files on iOS are now handled by VideoPlayer.tsx (VLCPlayer)
|
||||||
if (Platform.OS === 'android' || isXprimeStream || (Platform.OS === 'ios' && !isMkvFile)) {
|
if (Platform.OS === 'android' || isXprimeStream) {
|
||||||
return <AndroidVideoPlayer />;
|
return <AndroidVideoPlayer />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ export function useTraktAutosync(options: TraktAutosyncOptions) {
|
||||||
// Removed excessive logging for handlePlaybackEnd calls
|
// Removed excessive logging for handlePlaybackEnd calls
|
||||||
|
|
||||||
if (!isAuthenticated || !autosyncSettings.enabled) {
|
if (!isAuthenticated || !autosyncSettings.enabled) {
|
||||||
logger.log(`[TraktAutosync] Skipping handlePlaybackEnd: authenticated=${isAuthenticated}, enabled=${autosyncSettings.enabled}`);
|
// logger.log(`[TraktAutosync] Skipping handlePlaybackEnd: authenticated=${isAuthenticated}, enabled=${autosyncSettings.enabled}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue