Audio Direct Stream: Maximizing the User Base (Decoding Problem)

I would like to create a real-time stream (radio) based application. Here are some links that I can start with: 1) mp3 , 2) aac (" http://79.143.70.114:8000/detifm-64k.aac ").

Unfortunately, these links could not be played by MediaPlayer on devices with Android 2.x. I am a little confused by this situation, as this piece of documentation claims that the live streaming HTTP / HTTPS protocol is partially supported by Android 2.x - for example, my device (Samsung I9001) cannot play links from above, but it can play this one, which also an mp3 stream as indicated. On other devices, such as the Samsung GTS 5830, even the most recent link cannot be played.

My goal is to maximize the user base - what can I do to achieve it?

Firstly, I am not very familiar with the encoding / decoding technologies, but I think there are different ways to encode the same mp3, since mp3 cannot be played while " http://188.138.112.71:9018/ " (City Beat Radio) can. Therefore, I need to know which encoding types are more suitable for Android and find out which one will be supported by most devices. It says: “Mono / Stereo 8-320 Kbps constant (CBR) or variable bit rate (VBR)” - is that all I need to know? How about playing live on the Samsung GTS 5830?

Secondly, decoding is hardware dependent. I saw a library called Vitamio that solves the problem of playing the first link, but I don’t like the idea that the user has to download additional third-party software. In addition, there is MoboPlayer , which can also play the first link. This is because they use software decoding - I wonder if there is any software decoding library that I can include in my project. I think writing your own decoder would be tedious, but your suggestions are welcome.

-, , RTSP, Android, mp3, . , ? mp3- rstp?

, . (mp3) java.io.IOException: Prepare failed.: status=0xFFFFFFF6, ([aac] [2]) - java.io.IOException: Prepare failed.: status=0x1

mMediaPlayer = new MediaPlayer();
    try {
        mMediaPlayer
            .setDataSource(
                this,
                Uri.parse("http://radio02-cn03.akadostream.ru:8114/detifm192.mp3"));
        mMediaPlayer.setOnPreparedListener(mOnPreparedListener);
        mMediaPlayer.setOnErrorListener(mOnErrorListener);
        //mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        mMediaPlayer.prepare();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (NotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

private OnPreparedListener mOnPreparedListener = new OnPreparedListener() {

    @Override
    public void onPrepared(MediaPlayer mplayer) {
        mplayer.start();
    }
};

UPD

LOGCAT (mp3) Samsung I9001:

08-28 13: 38: 45.522: E/MediaPlayer (31713): msg = 3, ext1 = 0, ext2 = 0 08-28 13: 38: 45.542: E/MediaPlayer (31713): msg = 200, ext1 = 1, ext2 = 26 08-28 13: 38: 45.542: W/MediaPlayer (31713): / (1, 26) 08-28 13: 38: 45.552: E/MediaPlayer (31713): msg = 100, ext1 = -10, ext2 = -10 08-28 13: 38: 45.552: E/MediaPlayer (31713): (-10, -10) 08-28 13: 38: 45.562: W/System.err(31713): java.io.IOException: failed: status = 0xFFFFFFF6 08-28 13: 38: 45.562: W/System.err(31713):    android.media.MediaPlayer.prepare( ) 08-28 13: 38: 45,562: W/System.err(31713): com.example.sampleradioapp.MainActivity.onCreate(MainActivity.java:53) 08-28 13: 38: 45,562: W/System.err(31713): android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 08-28 13: 38: 45,562: W/System.err(31713): android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 08-28 13: 38: 45,562: W/System.err(31713): android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 08-28 13: 38: 45,562: W/System.err(31713): android.app.ActivityThread.access $1500 (ActivityThread.java:117) 08-28 13: 38: 45,562: W/System.err(31713): android.app.ActivityThread $H.handleMessage(ActivityThread.java:935) 08-28 13: 38: 45,562: W/System.err(31713): android.os.Handler.dispatchMessage(Handler.java:99) 08-28 13: 38: 45,562: W/System.err(31713): android.os.Looper.loop(Looper.java:130) 08-28 13: 38: 45.562: W/System.err(31713): android.app.ActivityThread.main(ActivityThread.java:3687) 08-28 13: 38: 45,562: W/System.err(31713): java.lang.reflect.Method.invokeNative( ) 08-28 13: 38: 45,562: W/System.err(31713): java.lang.reflect.Method.invoke(Method.java:507) 08-28 13: 38: 45.592: W/System.err(31713): com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:867) 08-28 13: 38: 45,592: W/System.err(31713): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 08-28 13: 38: 45,592: W/System.err(31713): dalvik.system.NativeStart.main( ) 08-28 13: 38: 45.622: I/MediaPlayer (31713): (1,26)

LOGCAT (mp3) Samsung GTS 5830:

08-28 13: 15: 54.119: I/MediaPlayer (24178): uri: http://radio02-cn03.akadostream.ru:8114/detifm192.mp3 08-28 13: 15: 54.119: I/MediaPlayer (24178): null 08-28 13: 15: 54.119: D/MediaPlayer (24178): , 08-28 13: 16: 05.139: E/MediaPlayer (24178): (1, -2147483648) 08-28 13: 16: 05.249: E/MediaPlayer (24178): (1, -2147483648)

LOGCAT (aac) Samsung I9001:

08-28 13: 40: 46.681: E/MediaPlayer (31748): msg = 100, ext1 = 1, ext2 = -2147483648 08-28 13: 40: 46.681: E/MediaPlayer (31748): (1, -2147483648) 08-28 13: 40: 46,681: W/System.err(31748): java.io.IOException: : status = 0x1 08-28 13: 40: 46.681: W/System.err(31748): android.media.MediaPlayer.prepare( ) 08-28 13: 40: 46,681: W/System.err(31748): com.example.sampleradioapp.MainActivity.onCreate(MainActivity.java:53) 08-28 13: 40: 46,691: W/System.err(31748): android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 08-28 13: 40: 46,691: W/System.err(31748): android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 08-28 13: 40: 46,691: W/System.err(31748): android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 08-28 13: 40: 46,691: W/System.err(31748): android.app.ActivityThread.access $1500 (ActivityThread.java:117) 08-28 13: 40: 46,691: W/System.err(31748): android.app.ActivityThread $H.handleMessage(ActivityThread.java:935) 08-28 13: 40: 46,691: W/System.err(31748): android.os.Handler.dispatchMessage(Handler.java:99) 08-28 13: 40: 46,701: W/System.err(31748): android.os.Looper.loop(Looper.java:130) 08-28 13: 40: 46.701: W/System.err(31748): android.app.ActivityThread.main(ActivityThread.java:3687) 08-28 13: 40: 46,701: W/System.err(31748): java.lang.reflect.Method.invokeNative( ) 08-28 13: 40: 46,701: W/System.err(31748): java.lang.reflect.Method.invoke(Method.java:507) 08-28 13: 40: 46.701: W/System.err(31748): com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:867) 08-28 13: 40: 46.701: W/System.err(31748): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 08-28 13: 40: 46,701: W/System.err(31748): dalvik.system.NativeStart.main( )

LOGCAT (aac) Samsung GTS 5830:

08-28 13: 19: 03.929: I/MediaPlayer (24352): 08-28 13: 19: 03.929: D/MediaPlayer (24352): , 08-28 13: 19: 29.119: E/MediaPlayer (24352): (1, -2147483648) 08-28 13: 19: 29.119: W/System.err(24352): java.io.IOException: : status = 0x1 08-28 13: 19: 29.119: W/System.err(24352): android.media.MediaPlayer.prepare( ) 08-28 13: 19: 29.119: W/System.err(24352): com.example.sampleradioapp.MainActivity.onCreate(MainActivity.java:53) 08-28 13: 19: 29.119: W/System.err(24352): android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 08-28 13: 19: 29.119: W/System.err(24352): android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 08-28 13: 19: 29.119: W/System.err(24352): android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 08-28 13: 19: 29.119: W/System.err(24352): android.app.ActivityThread.access $1500 (ActivityThread.java:117) 08-28 13: 19: 29.119: W/System.err(24352): android.app.ActivityThread $H.handleMessage(ActivityThread.java:935) 08-28 13: 19: 29.119: W/System.err(24352): android.os.Handler.dispatchMessage(Handler.java:99) 08-28 13: 19: 29.119: W/System.err(24352): android.os.Looper.loop(Looper.java:130) 08-28 13: 19: 29.119: W/System.err(24352): android.app.ActivityThread.main(ActivityThread.java:3687) 08-28 13: 19: 29.119: W/System.err(24352): java.lang.reflect.Method.invokeNative( ) 08-28 13: 19: 29.119: W/System.err(24352): java.lang.reflect.Method.invoke(Method.java:507) 08-28 13: 19: 29.129: W/System.err(24352): com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:867) 08-28 13: 19: 29.129: W/System.err(24352): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 08-28 13: 19: 29.129: W/System.err(24352): dalvik.system.NativeStart.main( )

.

+5
1
hi this may helps you

streaminlike

And Set MediaPlayer as
private void initializeMediaPlayer() {
        player = new MediaPlayer();
        try {
            player.setDataSource("http://usa8-vn.mixstream.net:8138");
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
+1

All Articles