mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-23 15:08:07 +02:00
feat: Implement IPTV player screen with web iframe integration for live and VOD streams, utilizing player_lite.html for live TV.
This commit is contained in:
1 parent
79ad1243fa
commit
c165ff5d40
2 files changed
+26
-4
No files matched your search
@@ -217,10 +217,30 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _sendMessage(Map<String, dynamic> message) {
|
void _sendMessage(Map<String, dynamic> message) {
|
||||||
if (_isInitialized) {
|
if (!_isInitialized) return;
|
||||||
final iframe =
|
|
||||||
html.document.getElementById(_viewId) as html.IFrameElement?;
|
// Try finding by ID first
|
||||||
iframe?.contentWindow?.postMessage(message, '*');
|
var iframe = html.document.getElementById(_viewId) as html.IFrameElement?;
|
||||||
|
|
||||||
|
// If not found, try finding by src pattern (fallback for Shadow DOM or ID issues)
|
||||||
|
if (iframe == null) {
|
||||||
|
final iframes = html.document.getElementsByTagName('iframe');
|
||||||
|
for (final frame in iframes) {
|
||||||
|
if (frame is html.IFrameElement &&
|
||||||
|
(frame.src?.contains('player_lite.html') == true ||
|
||||||
|
frame.src?.contains('player.html') == true)) {
|
||||||
|
iframe = frame;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iframe != null) {
|
||||||
|
print('[PlayerScreen] Sending message to iframe: $message');
|
||||||
|
iframe.contentWindow?.postMessage(message, '*');
|
||||||
|
} else {
|
||||||
|
print(
|
||||||
|
'[PlayerScreen] Error: Could not find iframe to send message: $message');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -476,6 +476,8 @@
|
|||||||
const data = event.data;
|
const data = event.data;
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|
||||||
|
log('Received message from parent: ' + JSON.stringify(data));
|
||||||
|
|
||||||
if (data.type === 'play') {
|
if (data.type === 'play') {
|
||||||
video.play().catch(e => log('Play command failed: ' + e));
|
video.play().catch(e => log('Play command failed: ' + e));
|
||||||
} else if (data.type === 'pause') {
|
} else if (data.type === 'pause') {
|
||||||
|
|||||||
Reference in new issue
Block a user