flutter_simple_record_and_player: ^1.0.0+0.1
iOS Make sure you add the following key to Info.plist for iOS
<key>NSMicrophoneUsageDescription</key>
<string>xxxxxx</string>
SimpleSoundRecordAndPlayer _recordAndPlayer = new SimpleSoundRecordAndPlayer();
try {
String path='/cached/demo.mp3';
_recordAndPlayer.startRecord(path, (error) {
print(error);
});
} catch (e) {
print(e);
}
},
_recordAndPlayer.stopRecord;
_recordAndPlayer.recordListPath.last
_recordAndPlayer.play(s, isLocal: true);
_recordAndPlayer?.pausePlay();
_recordAndPlayer?.stopPlay();
_recordAndPlayer.play(
'http://music.163.com/song/media/outer/url?id=1447126763.mp3',
isLocal: false)
_recordAndPlayer.clearDiskCache();
_recordAndPlayer.onAudioPlayerPositionChanged.listen((event) {
setState(() {
currentTime = '${event.inMinutes}:${event.inSeconds}';
});
});
_audioPlayer.onPlayerStateChanged.listen((event) {
print('状态变更:${event.toString()}');
});