fix(tv): misc improvements

This commit is contained in:
edde746
2026-02-13 00:01:54 +01:00
parent 7745b5a2f8
commit 426f6ab6ba
8 changed files with 116 additions and 88 deletions
+7 -1
View File
@@ -892,6 +892,7 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
_startLiveTimelineUpdates();
} catch (e) {
appLogger.e('Failed to start live TV playback', error: e);
_sendLiveTimeline('stopped');
if (mounted) {
showErrorSnackBar(context, e.toString());
_handleBackButton();
@@ -1654,7 +1655,8 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
void _startLiveTimelineUpdates() {
_liveTimelineTimer?.cancel();
_liveTimelineTimer = Timer.periodic(const Duration(seconds: 10), (_) {
_sendLiveTimeline('playing');
final state = player?.state.playing == true ? 'playing' : 'paused';
_sendLiveTimeline(state);
});
// Send initial heartbeat immediately
_sendLiveTimeline('playing');
@@ -1714,6 +1716,10 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
_isSwitchingChannel = true;
// Stop old session heartbeats and notify server
_stopLiveTimelineUpdates();
await _sendLiveTimeline('stopped');
final channel = channels[newIndex];
final channelId = channel.identifier ?? channel.key;
appLogger.d('Switching to channel: ${channel.displayName} ($channelId)');