MediaPlayer : Should have subtitle controller already set: KitKat

前端 未结 5 1065
萌比男神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:56

    Looking at a previous discussion on StackOverflow, and the referenced Android commit where this was introduced, the code above might not completely initialize the MediaPlayer object.

    The KitKat example code for media playback suggests that you should call:

    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    

    immediately after you construct the MediaPlayer, and before you call its setDataSource method.

提交回复
热议问题