plugins
plugins copied to clipboard
[video_player] fix misvalue at `isPlaying` after unplug earphone
- [ ] add tests
- [ ] add Android platform channel code (if necessary)
This PR fixes the following open issue:
- https://github.com/flutter/flutter/issues/49081
This bug exists because there's no response from both FLTVideoPlayerPlugin and FLTVideoPlayer when a route change happens.
The proposed solution is to:
- add a route change notification from
AVAudioSession; - send the notification to the dart layer as a
EventSink; - then fire
pause()from the dart layer.
Example app before this PR:
- when disconnecting the earphone, the video stops running, but the video_player state is maintained as
isPlaying - then, by tapping at a first time at the player, the
isPlayingstate goes fromtruetofalse; - the "play" button is shown;
- then, by tapping a second time, the
isPlayingstate goes fromfalsetotrue; - the video reproduces again.
https://user-images.githubusercontent.com/10662585/171498096-f278b9ff-1bd5-481c-a690-550f586f7a4a.mov
Example app after this PR:
- when disconnecting the earphone, the video stops running, and the
isPlayingstate is set to false; - notice that the "play" button is shown right away;
- then, by tapping at a first time at the player, the
isPlayingstate goes fromfalsetotrue; - the video reproduces again.
https://user-images.githubusercontent.com/10662585/171498791-b9582a8d-7278-4f54-9c8e-ef771e1c15ab.mov
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [ ] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use
dart format.) - [x] I signed the CLA.
- [x] The title of the PR starts with the name of the plugin surrounded by square brackets, e.g.
[shared_preferences] - [x] I listed at least one issue that this PR fixes in the description above.
- [ ] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [ ] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style. - [ ] I updated/added relevant documentation (doc comments with
///). - [ ] I added new tests to check the change I am making, or this PR is test-exempt.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
@miguelfs Thanks for your contribution! Will you be able to continue working on this?
Hi, @Hixie. Thanks for the feedback :)
I've been busy lately, so I don't think I'll be able to finish it soon :/
Since this is marked as a draft and hasn't been updated in several months I'm going to close it to clean out our review queue. Please don't hesitate to submit a new PR if you decide to revisit this. Thanks!