atom feed2 messages in com.googlegroups.android-developers[android-developers] Re: Media Player
FromSent OnAttachments
veerAug 25, 2010 4:46 am 
Jeremy WadsackAug 26, 2010 3:23 pm 
Subject:[android-developers] Re: Media Player
From:Jeremy Wadsack (jere@gmail.com)
Date:Aug 26, 2010 3:23:36 pm
List:com.googlegroups.android-developers

If the URL is an mp3 stream (shoutcast streaming server), then my understanding (and experience) is that this was not supported before 2.2. In 2.2 the new Stagefright player now supports reading from shoutcast streams. [http://developer.android.com/sdk/android-2.2- highlights.htm]

For support on older platforms, you can create a local proxy that changes the response protocol from ICY (shoutcast) to HTTP, which the mediaplayer will support.

See an example in the NPR Android App source code: http://code.google.com/p/npr-android-app/source/browse/trunk/Npr/src/org/npr/android/news/StreamProxy.java

On Aug 25, 4:46 am, veer <veer@gmail.com> wrote:

Hi all, I'm really stuck up with this.

Our team recently bought an android 1.6 device. I know android 1.6 media player had some issues, But i need to make it work for 1.6, as thats the only device i have for demos.

My code is as below

MediaPlayer mp = new MediaPlayer(); mp.setDataSource(URL); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.prepare(); mp.start();

this code always fails at mp.prepare();

This is a problem only with Android 1.6 Android 2.2 it works fine..

ERROR:

D/PlayerDriver( 30): buffering (3) D/PlayerDriver( 30): buffering (12) D/PlayerDriver( 30): buffering (15) D/PlayerDriver( 30): buffering (18) D/PlayerDriver( 30): buffering (21) D/PlayerDriver( 30): buffering (25) D/PlayerDriver( 30): buffering (28) D/PlayerDriver( 30): buffering (31) D/PlayerDriver( 30): buffering (35) E/PlayerDriver( 30): Command PLAYER_INIT completed with an error or info PVMFFailure E/MediaPlayer( 200): error (1, -1) W/System.err( 200): java.io.IOException: Prepare failed.: status=0x1 W/System.err( 200): at android.media.MediaPlayer.prepare(Native Method) W/System.err( 200): at com.tcs.channels.mobile.ChannelsHome.playAudio(ChannelsHome.java:608)

I NEED THIS WORKING ON 1.6 HAS ANYONE BEEN SUCSESSFULL ANY HELP WUD BE HIGHLY APPRECIATED.

I have tried setting content type to audio/mpeg, tried writing the file to SD card first then playing it.. Everythin works on 2.2 but not on 1.6..