MediaPlayer : Should have subtitle controller already set: KitKat

前端 未结 5 999
萌比男神i
萌比男神i 2020-12-23 20:34

I am having an odd issue where my audio file sometimes plays and sometimes does not play. The catch is that when it decides to not play, the DDMS gives me an:



        
5条回答
  •  醉梦人生
    2020-12-23 20:42

    This should fix your problem (did for me): Replace the line that says "player.start()" following the rest of your code with an async callback like so:

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

    This error is just a Log.e, not a real error. It shouldn't cause your player to not play, I'm guessing it's just because the player hadn't finished preparing when you try to call start().

    E/MediaPlayer﹕ Should have subtitle controller already set
    

提交回复
热议问题