diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index 370cb369..2298dc73 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -2132,6 +2132,7 @@ class VideoPlayerScreenState extends State with WidgetsBindin _startLiveTimelineUpdates(); } catch (e) { appLogger.e('Failed to switch channel', error: e); + if (mounted) showErrorSnackBar(context, e.toString()); } finally { _isSwitchingChannel = false; } diff --git a/lib/services/plex_client.dart b/lib/services/plex_client.dart index e6f82b79..86ce8913 100644 --- a/lib/services/plex_client.dart +++ b/lib/services/plex_client.dart @@ -2339,6 +2339,13 @@ class PlexClient { final container = _getMediaContainer(response); if (container == null) return null; + final containerStatus = container['status']; + if (containerStatus != null && containerStatus != 0 && containerStatus != 200) { + final msg = container['message'] ?? 'Unknown error'; + appLogger.w('Tune channel error: $msg (status: $containerStatus)'); + throw Exception(msg); + } + // Metadata is nested: MediaSubscription[0].MediaGrabOperation[0].Metadata Map? metadataJson; final subscriptions = container['MediaSubscription'] as List?; @@ -2358,7 +2365,7 @@ class PlexClient { metadataJson ??= (container['Metadata'] as List?)?.firstOrNull as Map?; if (metadataJson == null) { - appLogger.w('Tune channel: no metadata in response (keys: ${container.keys.toList()}, subscriptions: ${subscriptions?.length}, firstSub: ${subscriptions?.firstOrNull})'); + appLogger.w('Tune channel failed: ${container['message'] ?? 'no metadata'} (status: ${container['status']}, keys: ${container.keys.toList()})'); return null; }