Any interface to MediaPlayer.Audio ?

stolm

New member
Joined
Sep 10, 2020
Messages
3
Hello;

Been developing in Monkey/Cerberus for a while, and in thinking about a current issue that I was having, though I would see if Cerberus could deal with it.

I have an Android Card stereo, with a largish external SDD chucked full of my encoded CD collection. The goal was to write a quick MP3 player app that would just randomly grab files from the SDD and play them one after another (alternatively, I can generate a random playlist and use that).

However, in order to do these things, it seems like the MediaPlayer.Audio interface needs to be used, and other than the ability to dump an MP3 file in the data directory and play that (no issues), I have not been able to get Cerberus to find any MP3 files in the /Music directory, let alone play one (using the specific path to it).

So is this sort of functionality possible with Cerberus (access to the MediaPlayer database)? And if so is it documented anywhere?

Alternative option: Does Monkey/Cerberus have a code pass through pragma? Titanium has this where you can specify "target code" that is not translated, but merely copied in place to the target source file.
 
Last edited:

stolm

New member
Joined
Sep 10, 2020
Messages
3
Can you post the loading command?

Something simple like this:
String filepath = Environment.getExternalStorageDirectory()+"/SD Card/Music/samplefile.mp3";
mediaplayer = new MediaPlayer();
mediaplayer.setDataSource(filepath);
mediaplayer.prepare();
mediaplayer.start();

Would work as the next step (hard coded mp3 file). However I would eventually like to get it so that it is using the content resolver (as explained here: https://developer.android.com/training/data-storage/shared/media) to access the shared media resources.
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,042
So is this sort of functionality possible with Cerberus (access to the MediaPlayer database)? And if so is it documented anywhere?
No, not out of the box. But with an external function, I can't see why not.

Alternative option: Does Monkey/Cerberus have a code pass through pragma? Titanium has this where you can specify "target code" that is not translated, but merely copied in place to the target source file.
No, CX doesn't have that. If you need to use native code, create a native function and access it as an external function from CX.
The BRL modules are good examples on how to do this.

So your problem is to read the content of the mediaPlayer database or just the playback?
 

stolm

New member
Joined
Sep 10, 2020
Messages
3
I think just reading the database, provided that once I get the info, I can do everything with it through the mojo.audio interface

No, not out of the box. But with an external function, I can't see why not.


No, CX doesn't have that. If you need to use native code, create a native function and access it as an external function from CX.
The BRL modules are good examples on how to do this.

So your problem is to read the content of the mediaPlayer database or just the playback?
 
Top Bottom