mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-03-11 17:45:38 +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);
|
||||
setSelectedTextTrack(-1);
|
||||
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
|
||||
if (videoRef.current && duration > 0) {
|
||||
if (videoRef.current && duration > 0 && !isSeeking.current) {
|
||||
const currentPos = currentTime;
|
||||
console.log('[AndroidVideoPlayer] Forcing a micro-seek to refresh subtitle state');
|
||||
videoRef.current.seek(currentPos);
|
||||
console.log(`[AndroidVideoPlayer] Forcing a micro-seek to refresh subtitle state from ${currentPos}s`);
|
||||
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) {
|
||||
logger.error('[AndroidVideoPlayer] Error loading Stremio subtitle:', error);
|
||||
console.log('[AndroidVideoPlayer] Subtitle loading failed:', error);
|
||||
} finally {
|
||||
console.log('[AndroidVideoPlayer] Setting isLoadingSubtitles to false');
|
||||
// Add a small delay to ensure state updates are processed
|
||||
// Clear loading state on error
|
||||
setTimeout(() => {
|
||||
setIsLoadingSubtitles(false);
|
||||
console.log('[AndroidVideoPlayer] isLoadingSubtitles set to false');
|
||||
console.log('[AndroidVideoPlayer] isLoadingSubtitles set to false (error)');
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ const VideoPlayer: React.FC = () => {
|
|||
// Use AndroidVideoPlayer for:
|
||||
// - Android devices
|
||||
// - Xprime streams on any platform
|
||||
// - Non-MKV files on iOS
|
||||
if (Platform.OS === 'android' || isXprimeStream || (Platform.OS === 'ios' && !isMkvFile)) {
|
||||
// - MKV files on iOS are now handled by VideoPlayer.tsx (VLCPlayer)
|
||||
if (Platform.OS === 'android' || isXprimeStream) {
|
||||
return <AndroidVideoPlayer />;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ export function useTraktAutosync(options: TraktAutosyncOptions) {
|
|||
// Removed excessive logging for handlePlaybackEnd calls
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue