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

View file

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

View file

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

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> </plist>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array/>
</dict>
</plist>

View file

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

View file

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

View file

@ -24,6 +24,8 @@ interface SubtitleModalsProps {
ksTextTracks: Array<{id: number, name: string, language?: string}>; ksTextTracks: Array<{id: number, name: string, language?: string}>;
selectedTextTrack: number; selectedTextTrack: number;
useCustomSubtitles: boolean; useCustomSubtitles: boolean;
// When true, KSPlayer is active (iOS MKV path). Use to gate iOS-only limitations.
isKsPlayerActive?: boolean;
subtitleSize: number; subtitleSize: number;
subtitleBackground: boolean; subtitleBackground: boolean;
fetchAvailableSubtitles: () => void; fetchAvailableSubtitles: () => void;
@ -71,6 +73,7 @@ export const SubtitleModals: React.FC<SubtitleModalsProps> = ({
ksTextTracks, ksTextTracks,
selectedTextTrack, selectedTextTrack,
useCustomSubtitles, useCustomSubtitles,
isKsPlayerActive,
subtitleSize, subtitleSize,
subtitleBackground, subtitleBackground,
fetchAvailableSubtitles, fetchAvailableSubtitles,
@ -284,47 +287,82 @@ export const SubtitleModals: React.FC<SubtitleModalsProps> = ({
}}> }}>
Built-in Subtitles Built-in Subtitles
</Text> </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 }}> {(!isIos || (isIos && !isKsPlayerActive)) && (
{ksTextTracks.map((track) => { <View style={{ gap: 8 }}>
const isSelected = selectedTextTrack === track.id && !useCustomSubtitles; {ksTextTracks.map((track) => {
// Debug logging for subtitle selection const isSelected = selectedTextTrack === track.id && !useCustomSubtitles;
if (__DEV__ && ksTextTracks.length > 0) { // Debug logging for subtitle selection
console.log('[SubtitleModals] Track:', track.id, track.name, 'Selected:', selectedTextTrack, 'isSelected:', isSelected, 'useCustom:', useCustomSubtitles); if (__DEV__ && ksTextTracks.length > 0) {
} console.log('[SubtitleModals] Track:', track.id, track.name, 'Selected:', selectedTextTrack, 'isSelected:', isSelected, 'useCustom:', useCustomSubtitles);
return ( }
<TouchableOpacity return (
key={track.id} <TouchableOpacity
style={{ key={track.id}
backgroundColor: isSelected ? 'rgba(59, 130, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)', style={{
borderRadius: 16, backgroundColor: isSelected ? 'rgba(59, 130, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)',
padding: sectionPad, borderRadius: 16,
borderWidth: 1, padding: sectionPad,
borderColor: isSelected ? 'rgba(59, 130, 246, 0.3)' : 'rgba(255, 255, 255, 0.1)', borderWidth: 1,
}} borderColor: isSelected ? 'rgba(59, 130, 246, 0.3)' : 'rgba(255, 255, 255, 0.1)',
onPress={() => { }}
selectTextTrack(track.id); onPress={() => {
setSelectedOnlineSubtitleId(null); selectTextTrack(track.id);
}} setSelectedOnlineSubtitleId(null);
activeOpacity={0.7} }}
> activeOpacity={0.7}
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}> >
<Text style={{ <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
color: '#FFFFFF', <Text style={{
fontSize: isCompact ? 14 : 15, color: '#FFFFFF',
fontWeight: '500', fontSize: isCompact ? 14 : 15,
flex: 1, fontWeight: '500',
}}> flex: 1,
{getTrackDisplayName(track)} }}>
</Text> {getTrackDisplayName(track)}
{isSelected && ( </Text>
<MaterialIcons name="check" size={20} color="#3B82F6" /> {isSelected && (
)} <MaterialIcons name="check" size={20} color="#3B82F6" />
</View> )}
</TouchableOpacity> </View>
); </TouchableOpacity>
})} );
</View> })}
</View>
)}
</View> </View>
)} )}

View file

@ -155,15 +155,5 @@ export const detectMkvComprehensive = async (
export const isMkvStream = (streamUri: string, streamHeaders?: Record<string, string>): boolean => { export const isMkvStream = (streamUri: string, streamHeaders?: Record<string, string>): boolean => {
const result = detectMkvStream(streamUri, streamHeaders); 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; return result.isMkv;
}; };