'How to convert Recorded Audio Uri/Url into a File of .Mp3 extension in Flutter web
using package Flutter Sound i am able to record an audio and can play the audio by the audio URL/Uri but after playing audio what i need is to convert that audio into a file with extension of mp3 and upload it to the firebase storage. or is there some kind of a solution that i can upload a Uri and can Play the audio in future form firebase. here is my code.... For Recording
FlutterSoundRecorder recorder = new FlutterSoundRecorder();
recorder.openAudioSession();
recorder.startRecorder(codec: Codec.opusWebM,toFile: 'newRecord');
Playing Audio
player.openAudioSession();
player.startPlayer(fromURI: "newRecord");
Uploading File
fileUrl= await recorder.getRecordURL(path: 'newRecord').then((value)async
{
fb.StorageReference storageRef =
fb.storage().ref().child("newRecord.mp3");
fb.UploadTask uploadTask=storageRef.put(value);
fb.UploadTaskSnapshot uploadTaskSnapshot = await
storageRef.put(value).future;
var downloadUrl = (await uploadTaskSnapshot.ref.getDownloadURL());
//final String url = downloadUrl as String ;
print(downloadUrl);
});
file get uploaded but its a damaged file and i cannot download and play the audio. if any one can guide me please put an answer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
