Description
The app is unable to play fully downloaded offline videos if the device is disconnected from the internet.
In lib/screens/video_player_screen.dart (~line 68), _initPlayer correctly checks if the video is available offline and initializes VideoPlayerController.file(File(localPath)). However, it immediately makes a network request to fetch the resume position:
// Resume from saved position if available
final video = await _api.getVideo(widget.videoId);
If the device has no network, _api.getVideo throws a SocketException. This skips the controller.play() call, falls through to the catch (e) block, and renders a "Failed to load video" error state, defeating the purpose of offline downloads.
Suggested Fix
Wrap the _api.getVideo call in a try/catch block. If it fails (due to being offline), fallback to playing the video from the beginning (position 0), or fetch the locally cached watch position from the Hive box.
File Path
lib/screens/video_player_screen.dart
Description
The app is unable to play fully downloaded offline videos if the device is disconnected from the internet.
In
lib/screens/video_player_screen.dart(~line 68),_initPlayercorrectly checks if the video is available offline and initializesVideoPlayerController.file(File(localPath)). However, it immediately makes a network request to fetch the resume position:If the device has no network,
_api.getVideothrows aSocketException. This skips thecontroller.play()call, falls through to thecatch (e)block, and renders a "Failed to load video" error state, defeating the purpose of offline downloads.Suggested Fix
Wrap the
_api.getVideocall in atry/catchblock. If it fails (due to being offline), fallback to playing the video from the beginning (position 0), or fetch the locally cached watch position from the Hive box.File Path
lib/screens/video_player_screen.dart