Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Inessa
Posts: 28
Registered: ‎11-21-2012
My Device: Playbook
Accepted Solution

Why audio is so difficult?

Trying to play a simple MP3 in BB10.... just getting this error:

 

error 5 (MMR_ERROR_UNSUPPORTED_MEDIA_TYPE)

 

                        const char *ctxtname = "effect";
			const char *audioout = "audio:default";
			const char *inputtype = "track";
			char cwd[PATH_MAX];
			char inputurl[PATH_MAX];
			int audio_oid;

			mode_t mode = S_IRUSR | S_IXUSR;
			memset(cwd, FILENAME_MAX, 0);
			getcwd(cwd, PATH_MAX);
			snprintf(inputurl, PATH_MAX, "file://%s%s", cwd, "/app/native/party.mp3");
			mmr_connection_t *connection;
			mmr_context_t *ctxt;
			strm_dict_t *aoparams = NULL;

			float volume =  100.0;
			audiomixer_get_output_level(AUDIOMIXER_OUTPUT_SPEAKER, &volume);

			connection = mmr_connect( NULL );
			ctxt = mmr_context_create( connection, ctxtname, 0, mode );
			audio_oid = mmr_output_attach(ctxt, audioout, "audio");

			strm_dict_t *dictionary = strm_dict_new();
			strm_dict_t *s_volumeDictionary;
			s_volumeDictionary = strm_dict_set(dictionary, "volume", "50");
			mmr_output_parameters(ctxt, audio_oid, s_volumeDictionary);


			if (mmr_input_attach(ctxt, inputurl, inputtype) < 0 ) {
				mmrerror( ctxt, inputurl );
			}
			mmr_play(ctxt);

I have tried all the examples in the docs and some on the forums

 

 I already finished but the audio....

 

Any help? ideas?

 

 

Contributor
JimmyLord
Posts: 17
Registered: ‎07-12-2012
My Device: BB10 Alpha Device

Re: Why audio is so difficult?

At a glance, my code doesn't look much different than yours yet it works on both the playbook and bb10.  Could it be the internal format of your mp3 that doesn't work?  The mp3's I've used that work are "Audio: MPEG Audio Layer 3 44100Hz stereo 128Kbps [Audio]" according to Media Player Classic, but I haven't tried any other internal format, like VBR for example, but I can't imagine that would be an issue.

I put a copy of my code up on my website back in the summer, but I'm pretty sure my current production code is the same. Here's a link:


http://www.flatheadgames.com/pageview.php?page=18

Contributor
Inessa
Posts: 28
Registered: ‎11-21-2012
My Device: Playbook

Re: Why audio is so difficult?

Thank you Jimmy... no luck...

 

Did try your implementation and getting same error:

 

Acording to the docs:

 

MMR_ERROR_UNSUPPORTED_MEDIA_TYPEThere's no available plugin that recognizes the attached input or output media format.

 

Maybe I am missing something?

Contributor
JimmyLord
Posts: 17
Registered: ‎07-12-2012
My Device: BB10 Alpha Device

Re: Why audio is so difficult?

Just as a quick test, I replaced my .mp3 with a wav file, and that worked as well.

 

You might want to give that a shot.  If the wav works, it might be worth trying out a different mp3, it could be that the problem is with the one you are using.

Contributor
Inessa
Posts: 28
Registered: ‎11-21-2012
My Device: Playbook

Re: Why audio is so difficult?

Yes... I did try a (windows) wav file and it works! :Shifty:

 

But.... converting my mp3s to wav using adobe's audition does not, so looking for converters.

 

I will update this solution later.

 

Thank you for your help.

 

Inessa

Contributor
JimmyLord
Posts: 17
Registered: ‎07-12-2012
My Device: BB10 Alpha Device

Re: Why audio is so difficult?

I use CDex to convert things between ogg, mp3 and wav.  it's probably not the most direct solution and it's a bit cumbersome but it's been working well for me for years.

 

http://cdexos.sourceforge.net/

Contributor
Inessa
Posts: 28
Registered: ‎11-21-2012
My Device: Playbook

Re: Why audio is so difficult?

After 2 days it is working know... no mp3, just wav... either CDex or Auidition.

 

Again, thank you for your help!

 

Inessa

BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Why audio is so difficult?

mp3 is definitely supported.. if you want to send me one of your problem files, I can ask the mmultimedia lead why it won't play.

Contributor
Inessa
Posts: 28
Registered: ‎11-21-2012
My Device: Playbook

Re: Why audio is so difficult?

How can I send to you? is there a form?
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Why audio is so difficult?

don't you see an "Attachments" field to the right of the Post Message window?

I was hoping that was also available via private message, but perhaps not.. let me get you my contact info...