audioplayers
audioplayers copied to clipboard
Ability to load asset from another asset bundle
Checklist
- [X] I made sure that the issue I am raising doesn't already exist
Use case / Problem
Whilst when adding using asset from another asset bundle general syntax is packages/<package-name>/assets/<actual-path>
. The AudioCache
is having hardcoded prefix assets/
. Although it can be modified using the AudioCache
singleton instance, it is not a good idea to modify prefix every-time before loading the asset. Ideally, we should have the ability to pass the prefix in AssetSource.
Proposal / Solution
We should have the ability to pass the prefix in AssetSource.
Example Code
No response
Affected platforms
Android, iOS, web, Windows, Linux, macOS
Platform details
No response
Audio Files/URLs/Sources
No response
Mockups
No response
Related issues / more information
No response
Working on PR
yeah
Hey thank you for your proposal. I don't quite get the benefit. I think you can just do:
AudioCache.instance = AudioCache(prefix: '');
And for every new AudioPlayer do:
AudioPlayer().setSource(AssetSource('packages/<package-name>/assets/<actual-path>'));
Providing a prefix in the AssetSource is just like adding the prefix right in front of your uri. I think it doesn't really simplify or reduce the code, one has to write.
See: https://github.com/bluefireteam/audioplayers/blob/main/getting_started.md#audiocache
In our case we had to do:
AudioCache.instance = AudioCache(prefix: '');
audioPlayer.audioCache = AudioCache.instance;