fix(ios): Rebuild decode pipeline and restore hwdec on iOS resume from background#1961
Open
5ext9fca wants to merge 5 commits into
Open
fix(ios): Rebuild decode pipeline and restore hwdec on iOS resume from background#19615ext9fca wants to merge 5 commits into
5ext9fca wants to merge 5 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses the iOS-specific playback regression reported in #1960 by moving foreground-resume handling into the shared player controller and rebuilding the decode pipeline so hardware decoding can be restored after the app returns from background.
Changes:
- Update
PLVideoPlayerlifecycle handling to pause on background and delegate iOS foreground recovery to the controller. - Add
PlPlayerController.onAppResumed()and an iOS-only hwdec recovery path that reopens the current media at the saved position. - Preserve the simpler non-iOS resume behavior while keeping existing pause-on-background behavior for the no-background-play case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
lib/plugin/pl_player/view/view.dart |
Changes app lifecycle handling so iOS resume flows through controller-driven recovery instead of direct play(). |
lib/plugin/pl_player/controller.dart |
Adds the iOS hwdec recovery routine that reapplies decoder settings, reopens media, restores playback state, and conditionally resumes playback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1960
Summary
On iOS, returning the app to the foreground could leave hardware decode in a bad state. This change rebuilds the decode path on resume by reapplying hwdec, reopening the current item at the saved position, restoring playback speed and UI position, and resuming playback when appropriate.
Details
PlPlayerController: Add_recoverIosHwdecAfterResume(guarded by platform,hwdec, non-emptycurrent, and a re-entrancy flag) and a publiconAppResumed({shouldResumePlayback})entry point.PLVideoPlayerlifecycle: OnAppLifecycleState.resumed, callonAppResumedon iOS (non-blocking). Non‑iOS still uses a simple play() when playback had been paused due to backgrounding. Pause-on-background behavior is unchanged for the “don’t continue in background” case.Test plan