【问题标题】:WAV file MediaPlayerWAV 文件媒体播放器
【发布时间】:2011-06-30 15:07:44
【问题描述】:

我正在尝试从 SD 卡播放 WAV 文件。它适用于某些手机(Nexus S、Nexus One 等),但不适用于 Xperia Mini 系列。

代码:

// On some phones, this line works, but on Xperia Mini 
// series phones MediaPlayer.create()
// returns null from this line below.
MediaPlayer mp = MediaPlayer.create(this, Uri.fromFile(new File(filePath)));

The LogCat error message can be found here.

有什么想法吗?它当然适用于某些手机,但其他手机只是拒绝 wav 文件。

【问题讨论】:

    标签: android


    【解决方案1】:

    似乎与这个问题(和解决方案)相同: Android - play sound on button click - Null pointer exception

    【讨论】:

    • 问题有点不同。我什至不能在 MediaPlayer 对象上调用 mp.start(),当我这样做时,它给了我一个 NPE。
    • 啊!愚蠢的我!我自己录制的 wav 文件格式错误。感谢您的贡献!
    猜你喜欢
    • 2013-03-17
    • 1970-01-01
    • 2019-07-23
    • 1970-01-01
    • 1970-01-01
    • 2016-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多