Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a voice message using flutter?

Tags:

flutter

Actually I need to send a voice message to my contacts using flutter.I have searched a lot.But I didn't get any idea on this.Is there any way to do this.?

like image 330
Sathya Avatar asked Feb 21 '19 05:02

Sathya


2 Answers

if you want to share a voice message in a chat(e.g firebase chat) you can use flutter_sound, send a voice file to your cloud, and you can play it again with flutter_sound too.

like image 165
Ali Azimoshan Avatar answered Oct 01 '22 19:10

Ali Azimoshan


You can use the audio_recorder package:

https://pub.dev/packages/audio_recorder

// Import package
import 'package:audio_recorder/audio_recorder.dart';

// Check permissions before starting
bool hasPermissions = await AudioRecorder.hasPermissions;

// Get the state of the recorder
bool isRecording = await AudioRecorder.isRecording;

// Start recording
await AudioRecorder.start(path: _controller.text, audioOutputFormat: AudioOutputFormat.AAC);

// Stop recording
Recording recording = await AudioRecorder.stop();
print("Path : ${recording.path},  Format : ${recording.audioOutputFormat},  Duration : ${recording.duration},  Extension : ${recording.extension},");
like image 31
Bakhouche Akram Avatar answered Oct 01 '22 19:10

Bakhouche Akram