mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-24 07:28:05 +02:00
fix(mobile): fix orientation reset with IndexedStack, support HLS in Lite player, and optimize fullscreen
This commit is contained in:
1 parent
39f4205d68
commit
441597354e
3 files changed
+46
-35
No files matched your search
@@ -285,17 +285,36 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
|
|
||||||
void _toggleFullscreen() {
|
void _toggleFullscreen() {
|
||||||
try {
|
try {
|
||||||
if (html.document.fullscreenElement != null) {
|
final doc = html.document;
|
||||||
html.document.exitFullscreen();
|
final isFullscreen = doc.fullscreenElement != null ||
|
||||||
|
(doc as dynamic).webkitFullscreenElement != null ||
|
||||||
|
(doc as dynamic).mozFullScreenElement != null;
|
||||||
|
|
||||||
|
if (isFullscreen) {
|
||||||
|
if (doc.exitFullscreen != null) {
|
||||||
|
doc.exitFullscreen();
|
||||||
|
} else if ((doc as dynamic).webkitExitFullscreen != null) {
|
||||||
|
(doc as dynamic).webkitExitFullscreen();
|
||||||
|
} else if ((doc as dynamic).mozCancelFullScreen != null) {
|
||||||
|
(doc as dynamic).mozCancelFullScreen();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final element = html.document.documentElement;
|
final element = doc.documentElement;
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
element.requestFullscreen();
|
if (element.requestFullscreen != null) {
|
||||||
|
element.requestFullscreen();
|
||||||
|
} else if ((element as dynamic).webkitRequestFullscreen != null) {
|
||||||
|
(element as dynamic).webkitRequestFullscreen();
|
||||||
|
} else if ((element as dynamic).mozRequestFullScreen != null) {
|
||||||
|
(element as dynamic).mozRequestFullScreen();
|
||||||
|
} else {
|
||||||
|
// Fallback: Message the player if browser API fails
|
||||||
|
_sendMessage({'type': 'request_fullscreen'});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('[PlayerScreen] Fullscreen error: $e');
|
print('[PlayerScreen] Fullscreen error: $e');
|
||||||
// Fallback: Message the player to try internal fullscreen
|
|
||||||
_sendMessage({'type': 'request_fullscreen'});
|
_sendMessage({'type': 'request_fullscreen'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,25 +25,6 @@ class _MobileDashboardScreenState extends ConsumerState<MobileDashboardScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Determine which tab to show
|
|
||||||
Widget currentTab;
|
|
||||||
switch (_currentIndex) {
|
|
||||||
case 0:
|
|
||||||
currentTab = MobileLiveTVTab(playlist: widget.playlist);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
currentTab = MobileMoviesTab(playlist: widget.playlist);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
currentTab = MobileSeriesTab(playlist: widget.playlist);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
currentTab = const MobileSettingsTab();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
currentTab = MobileLiveTVTab(playlist: widget.playlist);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Theme(
|
return Theme(
|
||||||
data: MobileTheme.darkTheme,
|
data: MobileTheme.darkTheme,
|
||||||
child: MobileScaffold(
|
child: MobileScaffold(
|
||||||
@@ -53,7 +34,15 @@ class _MobileDashboardScreenState extends ConsumerState<MobileDashboardScreen> {
|
|||||||
_currentIndex = index;
|
_currentIndex = index;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: currentTab,
|
child: IndexedStack(
|
||||||
|
index: _currentIndex,
|
||||||
|
children: [
|
||||||
|
MobileLiveTVTab(playlist: widget.playlist),
|
||||||
|
MobileMoviesTab(playlist: widget.playlist),
|
||||||
|
MobileSeriesTab(playlist: widget.playlist),
|
||||||
|
const MobileSettingsTab(),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-10
@@ -452,11 +452,16 @@
|
|||||||
log('Stream type: ' + streamType);
|
log('Stream type: ' + streamType);
|
||||||
const lowerUrl = streamUrl.toLowerCase();
|
const lowerUrl = streamUrl.toLowerCase();
|
||||||
|
|
||||||
// LIVE TV: Direct MPEG-TS playback with mpegts.js
|
// LIVE TV: Try HLS first if URL contains m3u8, otherwise mpegts
|
||||||
if (streamType === 'live') {
|
if (streamType === 'live') {
|
||||||
log('Live TV mode - using mpegts.js direct');
|
if (lowerUrl.includes('.m3u8') || lowerUrl.includes('/playlist.m3u8')) {
|
||||||
showLoading('Connecting to live stream...');
|
log('Live TV mode - HLS detected, using HLS.js');
|
||||||
await playWithMpegTS(streamUrl, true);
|
await playWithHLS(streamUrl);
|
||||||
|
} else {
|
||||||
|
log('Live TV mode - using mpegts.js direct');
|
||||||
|
showLoading('Connecting to live stream...');
|
||||||
|
await playWithMpegTS(streamUrl, true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,12 +505,10 @@
|
|||||||
video.currentTime = parseFloat(data.value);
|
video.currentTime = parseFloat(data.value);
|
||||||
}
|
}
|
||||||
} else if (data.type === 'request_fullscreen') {
|
} else if (data.type === 'request_fullscreen') {
|
||||||
if (video.requestFullscreen) {
|
const el = document.documentElement;
|
||||||
video.requestFullscreen();
|
const requestMethod = el.requestFullscreen || el.webkitRequestFullscreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
|
||||||
} else if (video.webkitRequestFullscreen) {
|
if (requestMethod) {
|
||||||
video.webkitRequestFullscreen();
|
requestMethod.call(el).catch(e => log('Fullscreen error: ' + e));
|
||||||
} else if (video.msRequestFullscreen) {
|
|
||||||
video.msRequestFullscreen();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user