3

On Android Lollipop on Samsung Galaxy Note 4 (just updated a few weeks ago from 4.4.4) prepareAsync() takes almost exactly 20seconds to load live stream. On 4.4.4 it would only take 2-3 seconds and no error (see below). This seems to be a problem only for live streams. Pre recorded mp3's are ok.

Here is a test:

    String url = "http://vprclassical.streamguys.net:80/vprclassical128.mp3"
    MediaPlayer mediaPlayer = new MediaPlayer();
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mediaPlayer.setOnPreparedListener(
            new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mediaPlayer) {
                    mediaPlayer.start();
                }
            });
    try {
        mediaPlayer.setDataSource(getApplicationContext(),
                Uri.parse(url));
        mediaPlayer.prepareAsync();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Here is the logcat:

05-13 00:47:09.148  26922-26922/? I/MediaPlayer﹕ Need to enable context aware info
05-13 00:47:09.148  26922-26922/? V/MediaPlayer-JNI﹕ native_setup
05-13 00:47:09.148  26922-26922/? V/MediaPlayer﹕ constructor
05-13 00:47:09.148  26922-26922/? V/MediaPlayer﹕ setListener
05-13 00:47:09.148  26922-26922/? E/MediaPlayer-JNI﹕ QCMediaPlayer mediaplayer NOT present
05-13 00:47:09.148  26922-26922/? V/MediaPlayer-JNI﹕ setAudioStreamType: 3
05-13 00:47:09.148  26922-26922/? V/MediaPlayer﹕ MediaPlayer::setAudioStreamType
05-13 00:47:09.158  26922-26922/? D/MediaPlayer﹕ setDataSource IOException happend :
    java.io.FileNotFoundException: No content provider: http://vprclassical.streamguys.net:80/vprclassical128.mp3
            at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1074)
            at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:927)
            at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:854)
            at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1100)
            at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1063)
            at daford.com.testprepareasync.MainActivity.onCreate(MainActivity.java:42)
            at android.app.Activity.performCreate(Activity.java:6295)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2777)
            at android.app.ActivityThread.access$900(ActivityThread.java:179)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1462)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:5972)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
05-13 00:47:09.158  26922-26922/? D/MediaPlayer﹕ Couldn't open file on client side, trying server side
05-13 00:47:09.158  26922-26922/daford.com.testprepareasync V/MediaPlayer﹕ setVideoSurfaceTexture
05-13 00:47:09.158  26922-26922/daford.com.testprepareasync V/MediaPlayer﹕ prepareAsync
05-13 00:47:09.158  26922-26922/daford.com.testprepareasync D/Activity﹕ performCreate Call secproduct feature valuefalse
05-13 00:47:09.158  26922-26922/daford.com.testprepareasync D/Activity﹕ performCreate Call debug elastic valuetrue
05-13 00:47:09.158  26922-26936/daford.com.testprepareasync D/MediaHTTPConnection﹕ filterOutInternalHeaders: key=User-Agent, val= Samsung SM-N910T stagefright/Beyonce/1.1.9 (Linux;Android 5.0.1)
05-13 00:47:09.168  26922-26932/daford.com.testprepareasync D/MediaHTTPConnection﹕ proxy null port 0
05-13 00:47:09.178  26922-26951/daford.com.testprepareasync D/OpenGLRenderer﹕ Render dirty regions requested: true
05-13 00:47:09.188  26922-26932/daford.com.testprepareasync I/System.out﹕ (HTTPLog)-Static: SBServiceAPI: getService class android.os.ServiceManager
05-13 00:47:09.188  26922-26932/daford.com.testprepareasync I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-13 00:47:09.188  26922-26932/daford.com.testprepareasync I/System.out﹕ (HTTPLog)-Static: isShipBuild true
05-13 00:47:09.188  26922-26932/daford.com.testprepareasync I/System.out﹕ (HTTPLog)-Thread-5219-671715901: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
05-13 00:47:09.188  26922-26932/daford.com.testprepareasync I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
05-13 00:47:09.198  26922-26951/daford.com.testprepareasync I/Adreno﹕ EGLInit: QTI Build: 03/11/15, 56bfead,
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/OpenGLRenderer﹕ Initialized EGL, version 1.4
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (611)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
05-13 00:47:09.208  26922-26951/daford.com.testprepareasync I/Adreno﹕ GetNativeFormatFromQctPixelFormat: Invalid qct format (612)
05-13 00:47:09.218  26922-26951/daford.com.testprepareasync D/OpenGLRenderer﹕ Get maximum texture size. GL_MAX_TEXTURE_SIZE is 16384
05-13 00:47:09.218  26922-26951/daford.com.testprepareasync D/OpenGLRenderer﹕ Enabling debug mode 0
05-13 00:47:09.248  26922-26922/daford.com.testprepareasync I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@2a4fcf93 time:2871668
05-13 00:47:09.268  26922-26932/daford.com.testprepareasync I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
05-13 00:47:09.428  26922-26932/daford.com.testprepareasync V/MediaHTTPConnection﹕ mTotalSize is -1
05-13 00:47:09.428  26922-26956/daford.com.testprepareasync D/MediaHTTPConnection﹕ setReadTimeOut =  30000ms

--- Here is the delay --- (Note the line above, what is setReadTimeOut and how do you control it and is it relavent?)

05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ message received msg=200, ext1=973, ext2=0
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync W/MediaPlayer﹕ info/warning (973, 0)
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ callback application
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ back from callback
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ message received msg=1, ext1=0, ext2=0
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ prepared
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ callback application
05-13 00:47:30.168  26922-26936/daford.com.testprepareasync V/MediaPlayer﹕ back from callback
John Smith
  • 3,493
  • 3
  • 25
  • 52
  • This seems to be a problem for others - [here is one attempted solution](https://stackoverflow.com/questions/29886405/android-mediaplayer-errors-after-update-to-5-0) that may or may not work for you. The `KnoxVpnUidStorageknoxVpnSupported API value returned is false` line also looks curious to me. – Ken Y-N May 13 '15 at 08:08
  • [Here is another attempted solution](https://stackoverflow.com/questions/29023132/over-10-seconds-to-load-an-audiostream-with-mediaplayer-on-samsung-galaxy-s5-and). – Ken Y-N May 13 '15 at 08:10
  • Ken Y-N (Thanks for fixing my entry.) I saw that post but I'm already using Uri.parse(). I actually had that problem with 4.x and posted a question ;) – John Smith May 13 '15 at 08:11
  • 1
    Thanks again. Prepare causes the same delay as prepareAsync(); – John Smith May 13 '15 at 08:14
  • Just thought I would say that this seems to be fixed on the Marshmallow update on my Galaxy Note 4. The delay is only a few seconds now. – John Smith Jul 07 '16 at 16:50

0 Answers0