-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ✨ Add a method to pause all players at once #372
base: main
Are you sure you want to change the base?
Conversation
@@ -140,15 +140,16 @@ class AudioPlayer( | |||
} | |||
|
|||
|
|||
fun pause(result: MethodChannel.Result) { | |||
fun pause(result: MethodChannel.Result, isPauseAllPlayer: Boolean = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this boolean?
ios/Classes/AudioPlayer.swift
Outdated
@@ -91,10 +91,12 @@ class AudioPlayer: NSObject, AVAudioPlayerDelegate { | |||
} | |||
|
|||
|
|||
func pausePlayer(result: @escaping FlutterResult) { | |||
func pausePlayer(result: @escaping FlutterResult, isPauseAllPlayer: Bool = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^
26deec9
to
ef20485
Compare
ef20485
to
ba326d8
Compare
```dart | ||
playerController.pauseAllPlayers(); | ||
``` | ||
There could be any number of players but you can just call this function from any **one** player and it will pause all the players. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just write, this function works similar to stopAllPlayer.
example/lib/main.dart
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this changes
stopListening() | ||
player?.pause() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add try catch
@@ -129,26 +129,19 @@ class AudioPlayer( | |||
} | |||
} | |||
|
|||
fun stop(result: MethodChannel.Result) { | |||
fun stop() { | |||
stopListening() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add try catch
.forEach((playKey, controller) { | ||
controller._setPlayerState(PlayerState.stopped); | ||
}); | ||
} | ||
PlatformStreams.instance.playerControllerFactory.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need clear since we aren't releasing player.
pubspec.yaml
Outdated
@@ -1,6 +1,6 @@ | |||
name: audio_waveforms | |||
description: A Flutter package that allow you to generate waveform while recording audio or from audio file. | |||
version: 1.2.0 | |||
version: 1.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update to 1.3.0
ba326d8
to
e9850d7
Compare
Fixed 325