MediaPlayer no longer working on the emulator since r10?

后端 未结 5 841
猫巷女王i
猫巷女王i 2020-12-10 12:33
protected MediaPlayer _mediaPlayer;  

protected void playFromResource(int resId)     
    {     
    if (_mediaPlayer != null)         
        {         
        _         


        
相关标签:
5条回答
  • 2020-12-10 12:44

    I had this problem on my MacBook Pro and found that I had to turn off my Bluetooth before launching the emulator.

    0 讨论(0)
  • 2020-12-10 12:55

    Be sure you read MediaPlayer State Diagram and that you perform all requested actions when you close your MediaPlayer object; if you don't stop, reset and realeas it, next time you try to use it, it will be in an incoherent state so that you cannot start it.

    For details: http://developer.android.com/reference/android/media/MediaPlayer.html

    0 讨论(0)
  • 2020-12-10 13:05

    Looks like the issue is only on my computer. I just tryed it on another computer and it work fine. I had some issues when I upgraded to r10 of ADT. Maybe there is something wrong in my development setup.

    0 讨论(0)
  • 2020-12-10 13:06

    I see this problem on mac os as well. In my case it happens when you enable "snapshot" for the emulator.
    http://code.google.com/p/android/issues/detail?id=14953
    You will have to delete the emulator and make a new one without "snapshot" enabled.

    0 讨论(0)
  • 2020-12-10 13:06

    Launching the emulator manually helps in my case.

    emulator program can be found inside android-sdk/tools/.

    So the final command will be something like:

    android-sdk/tools/emulator -avd my_cool_emulator_name

    0 讨论(0)
提交回复
热议问题