mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +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) {
|
||||
if (_isInitialized) {
|
||||
final iframe =
|
||||
html.document.getElementById(_viewId) as html.IFrameElement?;
|
||||
iframe?.contentWindow?.postMessage(message, '*');
|
||||
if (!_isInitialized) return;
|
||||
|
||||
// Try finding by ID first
|
||||
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;
|
||||
if (!data) return;
|
||||
|
||||
log('Received message from parent: ' + JSON.stringify(data));
|
||||
|
||||
if (data.type === 'play') {
|
||||
video.play().catch(e => log('Play command failed: ' + e));
|
||||
} else if (data.type === 'pause') {
|
||||
|
||||
Reference in new issue
Block a user