for streams you should use prepareAsync(), inplace of prepare().

Try that and reply if that helps to you.

On Jul 13, 3:42 am, nbonwit <[email protected]> wrote:
> Hello,
>
> We are streaming audio via http from ffserver/ffmpeg on Angstrom
> Linux.  The ffmpeg audio codec is PCM signed 16-bit little endian
> "pcm_s16le".  The ffmpeg stream format is "wav".  Both of these are
> claimed to be supported on Android 
> here:http://developer.android.com/guide/appendix/media-formats.html#core
>
> VLC finds and plays the stream without any problems.
> Under VLC "Codec Details", it says:
> Type: Audio, Codec: PCM S16 LE (araw)
> Channels: Stereo
> Sample rate: 48000 Hz
> Bits per sample: 16
>
> We built the simple test application below to pick up and play the
> stream in Android and get this error:
> java.io.IOException: Prepare failed.: status=0x1
>
> We checked the HTTP header using HTTP Debugger Pro.
> The Response Header items (when playing normally via VLC) are:
> [Response]: HTTP/1.0 200 OK
> Pragma: no-cache
> Content-Type: audio/x-wav
>
> We have been searching the web for help on this issue for over two
> days and have come up empty-handed.  Any help would be *greatly*
> appreciated.
>
> Thanks,
> Neville
>
> ------------TEST APP------------------------
> package com.shaneahern.streamtest;
> import java.io.IOException;
> import android.app.Activity;
> import android.media.AudioManager;
> import android.media.MediaPlayer;
> import android.os.Bundle;
> import android.util.Log;
>
> public class BareBonesStreamTestActivity extends Activity {
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>
>         String streamUrl = "http://192.168.24.123:8080/test.wav";;
>
>         MediaPlayer mp = new MediaPlayer();
>         Log.i("BareBonesStreamTestActivity", "MediaPlayer created");
>
>         try {
>             mp.setDataSource(streamUrl);
>             Log.i("BareBonesStreamTestActivity", "setDataSource to " +
> streamUrl);
>
>             mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
>             Log.i("BareBonesStreamTestActivity", "setAudioStreamType
> to AudioManager.STREAM_MUSIC");
>
>             mp.prepare();
>             Log.i("BareBonesStreamTestActivity", "prepare succeeded,
> calling start");
>
>             mp.start();
>         } catch (IllegalStateException e) {
>             Log.i("BareBonesStreamTestActivity", "prepare failed with
> IllegalStateException");
>             e.printStackTrace();
>         } catch (IOException e) {
>             Log.i("BareBonesStreamTestActivity", "prepare failed with
> IOException");
>             e.printStackTrace();
>         }
>     }
>
> }
>
> ------------ERROR LOG------------------------
> I/BareBonesStreamTestActivity(  727): MediaPlayer created
> I/StagefrightPlayer(   33): setDataSource('http://192.168.24.123:8080/
> test.wav')
> I/BareBonesStreamTestActivity(  727): setDataSource 
> tohttp://192.168.24.123:8080/test.wav
> I/BareBonesStreamTestActivity(  727): setAudioStreamType to
> AudioManager.STREAM_MUSIC
> E/MediaPlayer(  727): error (1, -2147483648)
> I/BareBonesStreamTestActivity(  727): prepare failed with IOException
> W/System.err(  727): java.io.IOException: Prepare failed.: status=0x1
> W/System.err(  727):     at android.media.MediaPlayer.prepare(Native
> Method)
> W/System.err(  727):     at
> com.shaneahern.streamtest.BareBonesStreamTestActivity.onCreate(BareBonesStr
> eamTestActivity.java: 30)
> W/System.err(  727):     at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1047)
> W/System.err(  727):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2627)
> W/System.err(  727):     at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2679)
> W/System.err(  727):     at android.app.ActivityThread.access
> $2300(ActivityThread.java:125)
> W/System.err(  727):     at android.app.ActivityThread
> $H.handleMessage(ActivityThread.java:2033)
> W/System.err(  727):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> W/System.err(  727):     at android.os.Looper.loop(Looper.java:123)
> W/System.err(  727):     at
> android.app.ActivityThread.main(ActivityThread.java:4627)
> W/System.err(  727):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> W/System.err(  727):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> W/System.err(  727):     at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:868)
> W/System.err(  727):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
> W/System.err(  727):     at dalvik.system.NativeStart.main(Native
> Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to