fix: WakeLock calls now get called properly (#177)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2024-12-12 23:28:23 +01:00 committed by GitHub
parent 5acce21261
commit c6080824d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View file

@ -146,11 +146,6 @@ class MediaControlsWrapper extends BaseAudioHandler {
updatePosition: value.position,
));
smtc?.setPosition(value.position);
if (value.playing) {
WakelockPlus.enable();
} else {
WakelockPlus.disable();
}
playbackState.add(playbackState.value.copyWith(
playing: value.playing,
));
@ -160,6 +155,7 @@ class MediaControlsWrapper extends BaseAudioHandler {
@override
Future<void> play() async {
WakelockPlus.enable();
_player?.play();
if (!ref.read(clientSettingsProvider).enableMediaKeys) return;
@ -248,6 +244,11 @@ class MediaControlsWrapper extends BaseAudioHandler {
playing: _player?.lastState.playing ?? false,
controls: [MediaControl.play],
));
if (playbackState.value.playing) {
WakelockPlus.enable();
} else {
WakelockPlus.disable();
}
final playerState = _player;
if (playerState != null) {
ref

View file

@ -156,7 +156,7 @@ class LibMPV extends BasePlayer {
: Video(
key: key,
controller: _controller!,
wakelock: true,
wakelock: false,
fill: Colors.transparent,
fit: fit,
subtitleViewConfiguration: const SubtitleViewConfiguration(visible: false),