playByState method
void
playByState()
Implementation
void playByState() async {
switch (_playbackState) {
case PlaybackState.readyToPlay:
if (await isPlaying()) {
pause();
} else {
play();
}
break;
case PlaybackState.play:
pause();
break;
case PlaybackState.pause:
play();
break;
case PlaybackState.loading:
if (await isPlaying()) {
pause();
} else {
play();
}
break;
case PlaybackState.finish:
restart();
break;
}
}