I need to cache audio files and save it locally so as to remove latency while playing it. I tried using the audioplayers package but I could not cache it. Could anyone help with this caching? Previously when I followed Angela Yu's course I had played from assets folder but now I need to cache audio files from network.
Related
I want to get all the audio files to my flutter app and play them.
As you can see all the audio files are already scanned and can be found in audio directory in phones. How do I get that directly without going anywhere.
Is there a way to get it from there.
I have tried to walk in all the folders but I thought it is not the good way.
I'm looking for a way to play a multimedia file saved in the ram memory of the mobile phone in flutter !.
Apparently the video_player package does not accept files in memory but only files on ssd, asset or url. Do you know a way to do this in flutter?
Are you allowed to cache videos?
If yes, you could try using flutter_cache_manager to cache your videos and play them from the cache.
Do note that, as written in the package README:
By default the cached files are stored in the temporary directory of the app. This means the OS can delete the files any time.
Also check out this answer from a similar thread on stack overflow.
EDIT
Since it is required to not save the video on it could be an option to use the better_player, which has the option to read a video file directly from memory, using BetterPlayerDataSource.memory as the data source.
Refer to this section of the documentation for more info.
Is there any way to store data(images, audio files, titles etc) in the project folder inside Android folder. And later access it later in case of no internet?? Right now I am displaying the images and playing audio mp3 directly from API response. Any help would be highly appreciated.
I am building an audio player that downloads and plays audio files using flutter. The audio files must be kept secure from piracy. I tried to encrypt the downloaded files and decrypt them when the user asks to play. I wanted to delete the decrypted data when the app is closed but when I delete the file the background music player crashes.
Is there any standard way to achieve this in flutter?
It's hard to say without more informations (about the plugin you're using to play audio for example).
I'll take the case of AudioService.
AudioService work with a list of audio. Maybe you can try to empty this list before delete the decrypted data?
In your case, I think that your player try to read your audio after you delete it. The error may come from that point.
I am working on a unity project using vuforia and the vuforia video playback. The project involves adding a lot of mp4 files directly into the project directory because the vuforia video playback needs a local path to the video. The unity project is now up to 3.2 GB, and I just started development. Are there any ways to combat this issue of this app potentially getting way too large?
I recommend storing your larger files in an Asset Bundle. Asset Bundles allow you to store your content online, and download it when necessary (once opened after install, or after the user has paid for the content). You can access your assets locally using the Asset Bundle directory:
Application.dataPath + "/AssetBundles/" + assetBundleName
Compress the files as much as possible until you see some visible quality drop. You just need to find the best combination of video resolution and audio / video bit rates.