-
Notifications
You must be signed in to change notification settings - Fork 156
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
bugfix - 228 - add setReleaseMode method for manage player state #269
Conversation
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.
Some files look unformatted in native android and ios. Please format those
lib/src/base/utils.dart
Outdated
/// This enum is meant to be used as a parameter of setReleaseMode method. | ||
/// | ||
/// It represents the behavior of AudioPlayer when an audio is finished or stopped. | ||
enum ReleaseMode{ |
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.
Let's not change the name of the enum because then it will be a bigger breaking change
fun setReleaseMode(result: MethodChannel.Result, releaseModeType : Int?){ | ||
try{ | ||
releaseModeType?.let { | ||
when (releaseModeType) { |
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.
This looks much better than previous
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.
Thank you
2309e6f
to
9dab1fd
Compare
lib/src/base/utils.dart
Outdated
///Release all resources, just like calling release method. | ||
/// | ||
/// In Android, the media player is quite resource-intensive, and this will | ||
/// let it go. Data will be buffered again when needed (if it's a remote file, |
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 don't support remote files so remove it.
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.
Or even better can replace this whole docs with ours
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.
Also don't change the enum name
///Set the release Mode. | ||
/// | ||
/// Check[FinishMode]'s doc to understand the difference between the modes. | ||
Future<void> setReleaseMode(FinishMode finishMode)async{ |
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.
Make named parameter with default value and format
…eMode method for manage player state
9dab1fd
to
c3d93b2
Compare
pause, | ||
|
||
///Stops player and disposes it(a PlayerController won't be disposed). | ||
stop |
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 are we removing this?
lib/src/base/utils.dart
Outdated
///Release all resources, just like calling release method. | ||
/// | ||
/// In Android, the media player is quite resource-intensive, and this will | ||
/// let it go. Data will be buffered again when needed (if it's a remote file, |
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.
Also don't change the enum name
ios/Classes/Utils.swift
Outdated
@@ -78,3 +73,9 @@ public extension RangeReplaceableCollection where Iterator.Element: ExpressibleB | |||
self.init(repeating: 0, count: count) | |||
} | |||
} | |||
|
|||
enum FinishMode : Int{ | |||
case release = 0 |
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.
Use same name as old flutter side name
android/src/main/kotlin/com/simform/audio_waveforms/AudioPlayer.kt
Outdated
Show resolved
Hide resolved
9b33ed5
to
2befda3
Compare
ea827a9
to
53d30c1
Compare
Update the code as per reviewer suggestion
53d30c1
to
819055d
Compare
This merge is a breaking change due to the removal of finishMode as a parameter. Some packages that rely on this parameter now breaks (e.g. chatview). I suggest to add this back and call setFinishMode as a hotfix. This should be flagged with @deprecated instead so that it can be removed in the next major release. Most packages will not expect a breaking change without bumping the major version. |
BugFix - 228 - Add setRelease Mode as per the requirement