mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-31 11:08:26 +01:00
fix: Android PiP support fully working
- fixed black screen on re-entering - ensured screen stays alive when video is playing - PiP button states now reflect media status
This commit is contained in:
@@ -327,29 +327,6 @@ export default function page() {
|
||||
: 0;
|
||||
}, [item]);
|
||||
|
||||
const [appState, setAppState] = useState(AppState.currentState);
|
||||
|
||||
useEffect(() => {
|
||||
const handleAppStateChange = (nextAppState: AppStateStatus) => {
|
||||
// Handle app going to the background
|
||||
if (nextAppState.match(/inactive|background/)) {
|
||||
_setShowControls(false);
|
||||
}
|
||||
setAppState(nextAppState);
|
||||
};
|
||||
|
||||
// Use AppState.addEventListener and return a cleanup function
|
||||
const subscription = AppState.addEventListener(
|
||||
"change",
|
||||
handleAppStateChange
|
||||
);
|
||||
|
||||
return () => {
|
||||
// Cleanup the event listener when the component is unmounted
|
||||
subscription.remove();
|
||||
};
|
||||
}, [appState, isPipStarted, isPlaying]);
|
||||
|
||||
// Preselection of audio and subtitle tracks.
|
||||
if (!settings) return null;
|
||||
let initOptions = [`--sub-text-scale=${settings.subtitleSize}`];
|
||||
@@ -456,7 +433,7 @@ export default function page() {
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
{videoRef.current && (
|
||||
{videoRef.current && !isPipStarted && (
|
||||
<Controls
|
||||
mediaSource={stream?.mediaSource}
|
||||
item={item}
|
||||
|
||||
Reference in New Issue
Block a user