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:
Michael committed 2026-01-01 18:26:05 +01:00
1 parent 79ad1243fa
commit c165ff5d40
2 files changed
+26 -4

No files matched your search

+24 -4
View File
@@ -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');
}
}
+2
View File
@@ -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') {