mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-27 11:17:25 +01:00
player: Publish position and duration information
A new method getPosition was introduced and the setUri method returns the duration of the new track now.
This commit is contained in:
parent
524a6d9994
commit
eb7b45c39e
2 changed files with 20 additions and 9 deletions
|
|
@ -40,10 +40,13 @@ public class MusicusPlayerPlugin: FlutterPlugin, MethodCallHandler {
|
|||
channel.invokeMethod("onComplete", null)
|
||||
}
|
||||
|
||||
result.success(null)
|
||||
result.success(mediaPlayer?.getDuration())
|
||||
} else if (call.method == "play") {
|
||||
mediaPlayer?.start()
|
||||
result.success(null)
|
||||
} else if (call.method == "getPosition") {
|
||||
// TODO: Check, if mediaPlayer is in a valid state.
|
||||
result.success(mediaPlayer?.getCurrentPosition())
|
||||
} else if (call.method == "pause") {
|
||||
mediaPlayer?.pause()
|
||||
result.success(null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue