Android Streaming Wav Audio Error: MediaPlayer Prepare failed: status=0x1

Home - Android Streaming Wav Audio Error: MediaPlayer Prepare failed: status=0x1

Girly Saputri Staff asked 3 years ago

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:

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: 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.

————TEST APP———————— package com.shaneahern.streamtest; import; import; import; import; import android.os.Bundle; import android.util.Log;

public class BareBonesStreamTestActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);


Start your code here
String streamUrl = ""; 

    MediaPlayer mp = new MediaPlayer(); 
    Log.i("BareBonesStreamTestActivity", "MediaPlayer created"); 

    try { 
        Log.i("BareBonesStreamTestActivity", "setDataSource to " + streamUrl); 

        Log.i("BareBonesStreamTestActivity", "setAudioStreamType to AudioManager.STREAM_MUSIC"); 

        Log.i("BareBonesStreamTestActivity", "prepare succeeded, calling start"); 

    } catch (IllegalStateException e) { 
        Log.i("BareBonesStreamTestActivity", "prepare failed with IllegalStateException"); 
    } catch (IOException e) { 
        Log.i("BareBonesStreamTestActivity", "prepare failed with IOException"); 
Your Answer