I want to get my audio file in my appwrite storage, I am using the getFileView , when we trigger this method it will return a buffer of our audio file. Next is I am using audio_player package in flutter. How can I load my audio file as buffer then?
hi
In web, those methods give you URL. You then use any client to download it as buffer - but since you are using Flutter, let me see how it could be done in it
sorry for late reply, I already fix it this issue thank you
Hey @Mosh Ontong - you can let me know your issue
This is how I get the audo files from my appwrite storage
final id = e['\$id'];
final storage = Storage(ref.read(appwriteClientProvider));
final url = await storage.getFileView(bucketId: kAudioBucketId, fileId: id);
final audioItem = AudioLanguage.fromDocument(e);
return audioItem.copyWith(
audioFileBytes: url,
And this is the summary of my AudioLanguage model btw
const AudioLanguage({
required this.id,
required this.name,
required this.vocabularyId,
required this.sexVoice,
this.audioFileBytes,
this.bitrate,
this.sampleRate,
this.duration,
this.channel,
});
final String id;
final String name;
final String vocabularyId;
final Uint8List? audioFileBytes;
final Sex sexVoice;
final int? channel;
final int? sampleRate;
final double? bitrate;
final double? duration;
is there another way to get the view as url of my audio, just the image shows to us,
ms @joeyouss
To add more information
Basically, I am using the audio_player package in flutter. Though they have this setSource(ByteSource(value)). But according to their documentation
the ByteSource is only some platforms. I am actually creating a flutter windows, it seems that ByteSource is not compatible in flutter windows. That is why, I want to find another way like I want to get the exact url of my audio file
I am actually using this but this is not safe, though we can set up the permission of the bucket but the problem is that when I accessing that url with a permision that only user can access. It gives me unauthorized access. Thats why I think we have to create another method that can get the url
Thank you for sharing it here @Mosh Ontong . getFileView actually gives the data (file) https://github.com/appwrite/sdk-for-flutter/blob/master/lib/services/storage.dart#L203 - it gives you a Uint8list and whatever library you are using should be able to take that as input - I see you are using ByteSource but it has a limitation so you might want to use URLsource provided in audio_player? but you would need the file URL for which I recommend: https://github.com/appwrite/appwrite/discussions/3474
Recommended threads
- I am using s3 for app storage but is it ...
_APP_STORAGE_DEVICE=s3 puts everything to the s3 storage but i need to be able to keep the function builds and site in the local and not waste the cloud storage...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- RowList: The value of total is coming as...
RowList: The value of total is coming as a String, so it throws an error because it’s not parsed into an int. Error: TypeError: \"37\": type 'String' is not a ...