player switch logic fix ios

This commit is contained in:
tapframe 2025-09-18 16:26:43 +05:30
parent abfccd0e36
commit 6070ed1dce
4 changed files with 101 additions and 106 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
@ -61,10 +61,6 @@
<string>This app does not require microphone access.</string> <string>This app does not require microphone access.</string>
<key>RCTRootViewBackgroundColor</key> <key>RCTRootViewBackgroundColor</key>
<integer>4278322180</integer> <integer>4278322180</integer>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UIFileSharingEnabled</key> <key>UIFileSharingEnabled</key>
<true/> <true/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
@ -95,5 +91,5 @@
<string>Dark</string> <string>Dark</string>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
</dict> </dict>
</plist> </plist>

View file

@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict/>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array/>
</dict>
</plist> </plist>

View file

@ -2586,6 +2586,8 @@ const AndroidVideoPlayer: React.FC = () => {
imdbId, imdbId,
backdrop, backdrop,
availableStreams, availableStreams,
// Ensure KSPlayer is chosen even if URL/headers do not reveal MKV
forceVlc: true,
}); });
}, 50); }, 50);
return; return;

View file

@ -51,13 +51,15 @@ const VideoPlayer: React.FC = () => {
// Detect if stream is MKV format // Detect if stream is MKV format
const isMkvFile = isMkvStream(uri, headers); const isMkvFile = isMkvStream(uri, headers);
// Use AndroidVideoPlayer for Android devices and non-MKV files on iOS // Honor forceVlc from navigation params for iOS, or fallback to MKV detection
// Use KSPlayer only for MKV files on iOS const forceVlc = ((route.params as any)?.forceVlc === true);
const shouldUseAndroidPlayer = Platform.OS === 'android' || (Platform.OS === 'ios' && !isMkvFile); // Use AndroidVideoPlayer for Android devices. On iOS, use KSPlayer when MKV or forced.
const shouldUseAndroidPlayer = Platform.OS === 'android' || (Platform.OS === 'ios' && !(isMkvFile || forceVlc));
safeDebugLog("Player selection logic", { safeDebugLog("Player selection logic", {
platform: Platform.OS, platform: Platform.OS,
isMkvFile, isMkvFile,
forceVlc,
shouldUseAndroidPlayer shouldUseAndroidPlayer
}); });