Search code examples
androidandroid-studiowarningsshoutcastinternet-radio

Android MediaPlayer W/MediaPlayer﹕ info/warning (703, 203)


I want to make radio player example but i have some errors. I can't fix it.

My Source Code

String url = ""; //Shoutcast Radio URL
    mp = new MediaPlayer();
    mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
    try {
        mp.setDataSource(url);
        mp.prepare();
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SecurityException e) {
        // TODO Auto-generated catch block
        Log.e(TAG, "SecurityException");
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        Log.e(TAG, "IllegalStateException");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        Log.e(TAG, "IOException");
    }

My Error (Logcat)

E/MediaPlayer﹕ Should have subtitle controller already set
W/MediaPlayer﹕ info/warning (703, 203)
W/MediaPlayer﹕ info/warning (701, 0)
W/MediaPlayer﹕ info/warning (702, 0)
W/MediaPlayer﹕ info/warning (702, 0)

Solution

  • The "Should have subtitle controller already set" text is just a warning not an error. It references to the new implementation of MediaPlayer in Android Kitkat 4.4 (they added subtitles capabilities for videos, but for some reason it tries to use subtitles even if the media is just audio).

    So you can just ignore that warning.

    If it doesn't play you can try to use the OnPreparedListener just after mp.prepare(); with mp.start();:

    mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            mp.start();
        }
    });