Fixed trailer keeps Playing issue even after opening Streamscreen

This commit is contained in:
tapframe 2025-09-04 19:20:02 +05:30
parent 9c533e3c52
commit 3653879596
3 changed files with 11 additions and 4 deletions

View file

@ -93,8 +93,8 @@ android {
applicationId 'com.nuvio.app'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 7
versionName "0.6.0-beta.7"
versionCode 8
versionName "0.6.0-beta.8"
}
splits {

View file

@ -104,7 +104,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
// Theme defaults
themeId: 'default',
customThemes: [],
useDominantBackgroundColor: true,
useDominantBackgroundColor: false,
// Home screen poster customization
posterSize: 'medium',
posterBorderRadius: 12,

View file

@ -40,6 +40,7 @@ import { NavigationProp } from '@react-navigation/native';
import { RootStackParamList } from '../navigation/AppNavigator';
import { useSettings } from '../hooks/useSettings';
import { MetadataLoadingScreen } from '../components/loading/MetadataLoadingScreen';
import { useTrailer } from '../contexts/TrailerContext';
// Import our optimized components and hooks
import HeroSection from '../components/metadata/HeroSection';
@ -71,6 +72,7 @@ const MetadataScreen: React.FC = () => {
const { settings } = useSettings();
const { currentTheme } = useTheme();
const { top: safeAreaTop } = useSafeAreaInsets();
const { pauseTrailer } = useTrailer();
// Optimized state management - reduced state variables
const [isContentReady, setIsContentReady] = useState(false);
@ -349,6 +351,9 @@ const MetadataScreen: React.FC = () => {
const handleShowStreams = useCallback(() => {
const { watchProgress } = watchProgressData;
// Ensure trailer stops immediately before navigating to Streams
try { pauseTrailer(); } catch {}
// Helper to build episodeId from episode object
const buildEpisodeId = (ep: any): string => {
return ep.stremioId || `${id}:${ep.season_number}:${ep.episode_number}`;
@ -445,6 +450,8 @@ const MetadataScreen: React.FC = () => {
// Optimize navigation with requestAnimationFrame
requestAnimationFrame(() => {
// Ensure trailer stops immediately before navigating to Streams
try { pauseTrailer(); } catch {}
navigation.navigate('Streams', {
id,
type,
@ -452,7 +459,7 @@ const MetadataScreen: React.FC = () => {
episodeThumbnail: episode.still_path || undefined
});
});
}, [navigation, id, type, isScreenFocused]);
}, [navigation, id, type, isScreenFocused, pauseTrailer]);
const handleBack = useCallback(() => {
if (isScreenFocused) {