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

Android™ Development

Reply
Contributor
Posts: 16
Registered: ‎01-16-2013
My Device: BB10 Dev Alpha
My Carrier: Free
Accepted Solution

Streaming with MediaPlayer

Hi,

 

I'm testing an Android to Blackberry 10 port on an application that uses the android.media.MediaPlayer to play streaming audio. When I launch the application and start playing the stream, it starts, but stops after less than a second.

 

Therefore, I checked the Unsupported API page (http://developer.blackberry.com/android/apisupport/unsupportedapi_blackberry10_media.html) and I saw that "MediaPlayer.setAudioStreamType" was in the list. Does that mean that audio streaming is not supported at all ? Or should I be able to play streaming audio on a ported application ? If so, is there any special trick to apply to get the sound playing for as long as the streaming continues ?

 

Thanks for your help

Retired
Posts: 159
Registered: ‎11-21-2008
My Device: BlackBerry 10
My Carrier: Rogers

Re: Streaming with MediaPlayer

Hello,

 

Unfortunately "MediaPlayer.setAudioStreamType" is not currently support, but I'm not sure how that would effect your application if it started to stream, but than stop. Have you performed a verification of your application to make sure there are not any other other unsupported features that might be causing issues?

 

Thanks,

 

Matt Whiteman
Product Manager, Android, BlackBerry Java & Simulators
Contributor
Posts: 16
Registered: ‎01-16-2013
My Device: BB10 Dev Alpha
My Carrier: Free

Re: Streaming with MediaPlayer

Thanks for your answer,

 

Indeed, this method doesn't seem to be the problem, since I made a small app that only reads one stream, and it works fine.

 

I'm trying to figure what difference is with the main application. The actual code to start the stream is the same :

 

player.reset();

player.setDataSource(stream_http_url);

player.prepare();

player.start();

 

I ran "Blackberry Tools / Verify apk" in my eclipse and Nothing is displayed after the check is done (I take it that it is a good sign ?)

Contributor
Posts: 16
Registered: ‎01-16-2013
My Device: BB10 Dev Alpha
My Carrier: Free

Re: Streaming with MediaPlayer

Here's the solution, in case someone has the same problem :

 

After some testing, I have seen that the URL I get for the music stream returns an HTTP redirection (302).

When I use the final URL (after the redirection), the music plays fine, but if I use the original URL, the music plays for less than a second before stopping. I don't really understand why an HTTP redirection would make the MediaPlayer behave this way, but that is the problem when using the MediaPlayer on Blackberry 10.

 

By the way, the same URL with the original Android player works fine, so if some RIM developers see this, this should be checked in the Android wrapper on Blackberry 10. Thanks !