Skip to content

Commit

Permalink
fix: clear audio noti
Browse files Browse the repository at this point in the history
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
  • Loading branch information
bggRGjQaUbCoE committed Mar 1, 2025
1 parent c98dbcc commit 00ea891
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/plugin/pl_player/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,6 @@ class PlPlayerController {
return;
}
_playerCount.value = 0;
videoPlayerServiceHandler.clear();
Utils.channel.setMethodCallHandler(null);
pause();
try {
Expand Down Expand Up @@ -1560,6 +1559,7 @@ class PlPlayerController {
_videoPlayerController = null;
}
_instance = null;
videoPlayerServiceHandler.clear();
} catch (err) {
debugPrint(err.toString());
}
Expand Down
8 changes: 6 additions & 2 deletions lib/services/audio_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
}

Future<void> setPlaybackState(PlayerStatus status, bool isBuffering) async {
if (!enableBackgroundPlay || PlPlayerController.instanceExists().not) {
if (!enableBackgroundPlay ||
_item.isEmpty ||
PlPlayerController.instanceExists().not) {
return;
}

Expand Down Expand Up @@ -192,7 +194,9 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
}

onPositionChange(Duration position) {
if (!enableBackgroundPlay) return;
if (!enableBackgroundPlay ||
_item.isEmpty ||
PlPlayerController.instanceExists().not) return;

playbackState.add(playbackState.value.copyWith(
updatePosition: position,
Expand Down

0 comments on commit 00ea891

Please sign in to comment.