player: Add stop method.

This commit is contained in:
Elias Projahn 2020-04-21 17:33:16 +02:00
parent 92828849f9
commit be1a41a90e
2 changed files with 10 additions and 0 deletions

View file

@ -47,6 +47,11 @@ public class MusicusPlayerPlugin: FlutterPlugin, MethodCallHandler {
} else if (call.method == "pause") {
mediaPlayer?.pause()
result.success(null)
} else if (call.method == "stop") {
uri = null
mediaPlayer?.release()
mediaPlayer = null
result.success(null)
} else {
result.notImplemented()
}

View file

@ -40,4 +40,9 @@ class MusicusPlayer {
Future<void> pause() async {
await _channel.invokeMethod('pause');
}
/// Stop the player.
Future<void> stop() async {
await _channel.invokeMethod('stop');
}
}