I need to use Android's MediaPlayer class from within a libGDX application to use its setNextMediaPlayer method so that I can smoothly transition from one track to another. So I want to write a generic MusicPlayer
interface that each platform would need to implement. The desktop version would just not have a smooth transition, but the Android version would. The problem is, I'd like this interface to take a FileHandle which contains the music asset, but MediaPlayer takes either a resource ID or a URL.
The only other option I can thing of is, instead of having the interface take a FileHandle
, let each platform read their own files and either find a way to get a resource ID or a URL from the assets folder or put the music file in the res/raw
folder. The problem with this is that I'd also need to put them in the assets folder so that the desktop version (which will be using libGDX's music player) can read it. Unless there is a way to tell libGDX to read from the desktop folder so that the music file doesn't get compiled into the apk twice.
Any idea how I can solve this?