Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ To use this plugin :

```dart
//...
AudioPlayer audioPlugin = new AudioPlayer();
AudioPlayer audioPlayer = new AudioPlayer();
AudioPlayerState audioPlayerState = new AudioPlayerState();
//...
```

Expand All @@ -43,18 +44,18 @@ AudioPlayer audioPlugin = new AudioPlayer();
```dart
Future<void> play() async {
await audioPlayer.play(kUrl);
setState(() => playerState = PlayerState.playing);
setState(() => audioPlayerState = AudioPlayerState.PLAYING);
}

Future<void> pause() async {
await audioPlayer.pause();
setState(() => playerState = PlayerState.paused);
setState(() => audioPlayerState = AudioPlayerState.PAUSED);
}

Future<void> stop() async {
await audioPlayer.stop();
setState(() {
playerState = PlayerState.stopped;
audioPlayerState = AudioPlayerState.STOPPED;
position = new Duration();
});
}
Expand Down Expand Up @@ -82,7 +83,7 @@ _audioPlayerStateSubscription = audioPlayer.onPlayerStateChanged.listen((s) {
}
}, onError: (msg) {
setState(() {
playerState = PlayerState.stopped;
audioPlayerState = AudioPlayerState.stopped;
duration = new Duration(seconds: 0);
position = new Duration(seconds: 0);
});
Expand Down