Getting Started
Getting Started..
Playback
1. FlutterSoundPlayer instanciation
import 'package:flauto/flutter_sound.dart';
...
FlutterSoundPlayer _myPlayer = FlutterSoundPlayer();2. Open and close the audio session
@override
void initState() {
super.initState();
// Be careful : openAudioSession return a Future.
// Do not access your FlutterSoundPlayer or FlutterSoundRecorder before the completion of the Future
_myPlayer.openAudioSession().then((value) {
setState(() {
_mPlayerIsInited = true;
});
});
}
@override
void dispose() {
// Be careful : you must `close` the audio session when you have finished with it.
_myPlayer.closeAudioSession();
_myPlayer = null;
super.dispose();
}3. Play your sound
Recording
1. FlutterSoundRecorder instanciation
2. Open and close the audio session
3. Record something
Last updated
Was this helpful?