Skip to content

Bug: Duplicate API calls to save progress on VideoPlayer teardown #15

Description

@windoze95

File: lib/screens/video_player_screen.dart
Lines: ~289 & 318

Description:
The dispose() method synchronously calls _api.updateProgress(...) without awaiting, causing an unawaited network request that outlives the context. Concurrently, if the user explicitly triggers a back navigation via _navigateBack(), it also calls await _api.updateProgress(...).

This leads to redundant, identical API requests to the backend when exiting a video, and relies on an anti-pattern (unawaited Futures during widget disposal) that can silently drop progress saves if the network client shuts down.

Impact: Redundant network load and unreliable watch progress saving.

Suggested Fix:
Consolidate the progress saving logic. Make sure it's only called once when dismissing the player, using a safe background task or route observer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions