自 r10 以来,MediaPlayer 不再在模拟器上工作? [英] MediaPlayer no longer working on the emulator since r10?

查看:22
本文介绍了自 r10 以来,MediaPlayer 不再在模拟器上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected MediaPlayer _mediaPlayer;  

protected void playFromResource(int resId)     
    {     
    if (_mediaPlayer != null)         
        {         
        _mediaPlayer.stop();         
        _mediaPlayer.release();
        }     
    _mediaPlayer = MediaPlayer.create(this, resId);
    _mediaPlayer.start();
    }  

此代码过去在模拟器和设备上都可以正常工作.一段时间以来(我认为是因为我更新到 ADT r10)它只适用于设备.在模拟器上不再有声音,并且应用程序在传递 on _mediaPlayer.release() 时冻结(第二次调用该函数).我能够通过将 stop()release() 替换为 reset() 来防止应用程序崩溃,但它不能解决主要问题:模拟器没有声音.

This code used to work fine on both the emulator and on devices. Since some time (I think it is since I updated to ADT r10) it only works on devices. On the emulator there is no sound anymore and the application freezes when it pass on _mediaPlayer.release() (the second time the function is called). I was able to keep the application from crashing by replacing the stop() and release() by reset() but it does not solve the main issue: There is no sound on the emulator.

在调用 start()

03-09 19:14:30.716: WARN/AudioTrack(34): 获取缓冲区超时(是CPU 挂钩?) 0x1afb8 user=00001e00, server=00000600

03-09 19:14:30.716: WARN/AudioTrack(34): obtainBuffer timed out (is the CPU pegged?) 0x1afb8 user=00001e00, server=00000600

有什么线索吗???

推荐答案

看来问题只出在我的电脑上.我刚刚在另一台电脑上试了一下,效果很好.我升级到 ADT 的 r10 时遇到了一些问题.也许我的开发设置有问题.

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.

这篇关于自 r10 以来,MediaPlayer 不再在模拟器上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆