fix(tv): misc improvements
This commit is contained in:
@@ -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)');
|
||||
|
||||
Reference in New Issue
Block a user