subtitle fix

This commit is contained in:
tapframe 2025-09-18 13:48:09 +05:30
parent 83136ea659
commit e98012862c
8 changed files with 94 additions and 73 deletions

View file

@ -271,12 +271,10 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Nuvio/Pods-Nuvio-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MobileVLCKit/MobileVLCKit.framework/MobileVLCKit",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MobileVLCKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
@ -527,7 +525,10 @@
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@ -582,7 +583,10 @@
);
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;

View file

@ -82,7 +82,7 @@
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -493,3 +493,4 @@ extension KSPlayerView {
return nil
}
}

View file

@ -1,10 +1,5 @@
<?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">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array/>
</dict>
</plist>
<dict/>
</plist>

View file

@ -404,7 +404,6 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- MobileVLCKit (3.5.1)
- RCT-Folly (2024.10.14.00):
- boost
- DoubleConversion
@ -1885,10 +1884,6 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-vlc-media-player (1.0.38):
- MobileVLCKit (= 3.5.1)
- React
- TVVLCKit (= 3.5.1)
- React-nativeconfig (0.76.9)
- React-NativeModulesApple (0.76.9):
- glog
@ -2518,7 +2513,6 @@ DEPENDENCIES:
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
- react-native-video (from `../node_modules/react-native-video`)
- react-native-vlc-media-player (from `../node_modules/react-native-vlc-media-player`)
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
@ -2560,7 +2554,6 @@ SPEC REPOS:
- libavif
- libdav1d
- lottie-ios
- MobileVLCKit
- ReachabilitySwift
- SDWebImage
- SDWebImageAVIFCoder
@ -2736,8 +2729,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/slider"
react-native-video:
:path: "../node_modules/react-native-video"
react-native-vlc-media-player:
:path: "../node_modules/react-native-vlc-media-player"
React-nativeconfig:
:path: "../node_modules/react-native/ReactCommon"
React-NativeModulesApple:
@ -2872,7 +2863,6 @@ SPEC CHECKSUMS:
libdav1d: 23581a4d8ec811ff171ed5e2e05cd27bad64c39f
lottie-ios: a881093fab623c467d3bce374367755c272bdd59
lottie-react-native: 4ba06e2e4985c53dda6595a880f780e7ff551df1
MobileVLCKit: 144d5f565512d1147d63b0fa1379231b3fd66535
RCT-Folly: ea9d9256ba7f9322ef911169a9f696e5857b9e17
RCTDeprecation: ebe712bb05077934b16c6bf25228bdec34b64f83
RCTRequired: ca91e5dd26b64f577b528044c962baf171c6b716
@ -2910,7 +2900,6 @@ SPEC CHECKSUMS:
react-native-safe-area-context: cd916088cac5300c3266876218377518987b995e
react-native-slider: d8c35cc0162af73c9448f4b18c34d09e841cc1ab
react-native-video: bc6104529a6fde35127a1625b30d557412fdb70d
react-native-vlc-media-player: da3308dda896d4ff7abfacadb8f981752bf9b425
React-nativeconfig: 8efdb1ef1e9158c77098a93085438f7e7b463678
React-NativeModulesApple: cebca2e5320a3d66e123cade23bd90a167ffce5e
React-perflogger: 72e653eb3aba9122f9e57cf012d22d2486f33358

View file

@ -67,6 +67,9 @@ const VideoPlayer: React.FC = () => {
const navigation = useNavigation<RootStackNavigationProp>();
// KSPlayer is active only on iOS when using MKV (shouldUseAndroidPlayer is false)
const isKsPlayerActive = Platform.OS === 'ios' && !shouldUseAndroidPlayer;
const {
title = 'Episode Name',
season,
@ -3178,6 +3181,7 @@ const VideoPlayer: React.FC = () => {
ksTextTracks={ksTextTracks}
selectedTextTrack={selectedTextTrack}
useCustomSubtitles={useCustomSubtitles}
isKsPlayerActive={isKsPlayerActive}
subtitleSize={subtitleSize}
subtitleBackground={subtitleBackground}
fetchAvailableSubtitles={fetchAvailableSubtitles}

View file

@ -24,6 +24,8 @@ interface SubtitleModalsProps {
ksTextTracks: Array<{id: number, name: string, language?: string}>;
selectedTextTrack: number;
useCustomSubtitles: boolean;
// When true, KSPlayer is active (iOS MKV path). Use to gate iOS-only limitations.
isKsPlayerActive?: boolean;
subtitleSize: number;
subtitleBackground: boolean;
fetchAvailableSubtitles: () => void;
@ -71,6 +73,7 @@ export const SubtitleModals: React.FC<SubtitleModalsProps> = ({
ksTextTracks,
selectedTextTrack,
useCustomSubtitles,
isKsPlayerActive,
subtitleSize,
subtitleBackground,
fetchAvailableSubtitles,
@ -284,47 +287,82 @@ export const SubtitleModals: React.FC<SubtitleModalsProps> = ({
}}>
Built-in Subtitles
</Text>
{/* Notice about built-in subtitle limitations - only when KSPlayer active on iOS */}
{isIos && isKsPlayerActive && (
<View style={{
backgroundColor: 'rgba(255, 193, 7, 0.1)',
borderRadius: 12,
padding: sectionPad,
marginBottom: 15,
borderWidth: 1,
borderColor: 'rgba(255, 193, 7, 0.3)',
}}>
<View style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 8 }}>
<MaterialIcons name="info" size={18} color="#FFC107" />
<View style={{ flex: 1 }}>
<Text style={{
color: '#FFC107',
fontSize: isCompact ? 12 : 13,
fontWeight: '600',
marginBottom: 4,
}}>
Built-in subtitles temporarily disabled
</Text>
<Text style={{
color: 'rgba(255, 255, 255, 0.8)',
fontSize: isCompact ? 11 : 12,
lineHeight: isCompact ? 16 : 18,
}}>
Due to some React Native limitations with KSPlayer, built-in subtitle rendering is temporarily disabled. Please use external subtitles instead for the best experience.
</Text>
</View>
</View>
</View>
)}
<View style={{ gap: 8 }}>
{ksTextTracks.map((track) => {
const isSelected = selectedTextTrack === track.id && !useCustomSubtitles;
// Debug logging for subtitle selection
if (__DEV__ && ksTextTracks.length > 0) {
console.log('[SubtitleModals] Track:', track.id, track.name, 'Selected:', selectedTextTrack, 'isSelected:', isSelected, 'useCustom:', useCustomSubtitles);
}
return (
<TouchableOpacity
key={track.id}
style={{
backgroundColor: isSelected ? 'rgba(59, 130, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)',
borderRadius: 16,
padding: sectionPad,
borderWidth: 1,
borderColor: isSelected ? 'rgba(59, 130, 246, 0.3)' : 'rgba(255, 255, 255, 0.1)',
}}
onPress={() => {
selectTextTrack(track.id);
setSelectedOnlineSubtitleId(null);
}}
activeOpacity={0.7}
>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
<Text style={{
color: '#FFFFFF',
fontSize: isCompact ? 14 : 15,
fontWeight: '500',
flex: 1,
}}>
{getTrackDisplayName(track)}
</Text>
{isSelected && (
<MaterialIcons name="check" size={20} color="#3B82F6" />
)}
</View>
</TouchableOpacity>
);
})}
</View>
{(!isIos || (isIos && !isKsPlayerActive)) && (
<View style={{ gap: 8 }}>
{ksTextTracks.map((track) => {
const isSelected = selectedTextTrack === track.id && !useCustomSubtitles;
// Debug logging for subtitle selection
if (__DEV__ && ksTextTracks.length > 0) {
console.log('[SubtitleModals] Track:', track.id, track.name, 'Selected:', selectedTextTrack, 'isSelected:', isSelected, 'useCustom:', useCustomSubtitles);
}
return (
<TouchableOpacity
key={track.id}
style={{
backgroundColor: isSelected ? 'rgba(59, 130, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)',
borderRadius: 16,
padding: sectionPad,
borderWidth: 1,
borderColor: isSelected ? 'rgba(59, 130, 246, 0.3)' : 'rgba(255, 255, 255, 0.1)',
}}
onPress={() => {
selectTextTrack(track.id);
setSelectedOnlineSubtitleId(null);
}}
activeOpacity={0.7}
>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
<Text style={{
color: '#FFFFFF',
fontSize: isCompact ? 14 : 15,
fontWeight: '500',
flex: 1,
}}>
{getTrackDisplayName(track)}
</Text>
{isSelected && (
<MaterialIcons name="check" size={20} color="#3B82F6" />
)}
</View>
</TouchableOpacity>
);
})}
</View>
)}
</View>
)}

View file

@ -155,15 +155,5 @@ export const detectMkvComprehensive = async (
export const isMkvStream = (streamUri: string, streamHeaders?: Record<string, string>): boolean => {
const result = detectMkvStream(streamUri, streamHeaders);
// Debug logging in development
if (__DEV__ && streamUri) {
console.log('[MKV Detection]', {
uri: streamUri.substring(0, 100) + (streamUri.length > 100 ? '...' : ''),
isMkv: result.isMkv,
method: result.method,
confidence: result.confidence
});
}
return result.isMkv;
};