Commit 9e29ffead4acce46b29bf34e7617697393944478

Authored by 吴启风
1 parent 523864dd

feat:音频api调用优化

lib/utils/audio_player_util.dart
@@ -66,20 +66,20 @@ class AudioPlayerUtil extends WidgetsBindingObserver { @@ -66,20 +66,20 @@ class AudioPlayerUtil extends WidgetsBindingObserver {
66 66
67 // stop 67 // stop
68 Future<void> stop() async { 68 Future<void> stop() async {
69 - _audioPlayer.stop(); 69 + await _audioPlayer.stop();
70 } 70 }
71 71
72 // pause 72 // pause
73 Future<void> pause() async { 73 Future<void> pause() async {
74 if (_audioPlayer.state == PlayerState.playing) { 74 if (_audioPlayer.state == PlayerState.playing) {
75 - _audioPlayer.pause(); 75 + await _audioPlayer.pause();
76 } 76 }
77 } 77 }
78 78
79 // resume 79 // resume
80 Future<void> resume() async { 80 Future<void> resume() async {
81 if (_audioPlayer.state == PlayerState.paused) { 81 if (_audioPlayer.state == PlayerState.paused) {
82 - _audioPlayer.resume(); 82 + await _audioPlayer.resume();
83 } 83 }
84 } 84 }
85 85