diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index bc6faea..a8b09b8 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -40,7 +40,7 @@ import { stremioService } from '../../services/stremioService'; import { shouldUseKSPlayer } from '../../utils/playerSelection'; import axios from 'axios'; import * as Brightness from 'expo-brightness'; -import { LibVlcPlayerView } from 'expo-libvlc-player'; +// Do not statically import Android-only native modules; resolve at runtime on Android // Map VLC resize modes to react-native-video resize modes const getVideoResizeMode = (resizeMode: ResizeModeType) => { @@ -97,6 +97,18 @@ const AndroidVideoPlayer: React.FC = () => { logger.log(`[AndroidVideoPlayer] Player selection: ${playerType} (${reason})`); }, [useVLC, forceVlc]); + // Resolve VLC view dynamically to avoid iOS loading the Android native module + const LibVlcPlayerViewComponent: any = useMemo(() => { + if (Platform.OS !== 'android') return null; + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const mod = require('expo-libvlc-player'); + return mod?.LibVlcPlayerView || null; + } catch { + return null; + } + }, []); + // Check if the stream is HLS (m3u8 playlist) const isHlsStream = (url: string) => { @@ -2877,7 +2889,8 @@ const AndroidVideoPlayer: React.FC = () => { > {useVLC && !forceVlcRemount ? ( <> - { logger.warn('[AndroidVideoPlayer][VLC] onESAdded parse error', e); } }} - /> + />) : null} ) : (