Skip to content

Bug: Offline playback fails when device has no network connection #17

@windoze95

Description

@windoze95

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions