我正在制作一个应用程序,该应用程序在调用一个函数时会播放不同的声音:
public void playAudio(int id){
mPlayer = MediaPlayer.create(getApplicationContext(), id);
mPlayer.start();
}
该函数的调用方式如下:
playAudio(R.raw.sound)
(此音频为MP3格式)
当我运行此命令时(没有功能,直接在需要的地方运行),它工作正常,使用了一点后,它停止工作并发出以下错误:
D/AudioSystem: getIoDescriptor: ioHandle = 13, index = -2, mIoDescriptors = 0x748a1e6950
D/AudioSystem: getIoDescriptor: ioHandle = 21, index = -2, mIoDescriptors = 0x748a1e6950
D/AudioSystem: getIoDescriptor: ioHandle = 29, index = -2, mIoDescriptors = 0x748a1e6950
getIoDescriptor: ioHandle = 93, index = -2, mIoDescriptors = 0x748a1e6950
D/AudioSystem: getIoDescriptor: ioHandle = 101, index = -2, mIoDescriptors = 0x748a1e6950
E/ExtMediaPlayer-JNI: QCMediaPlayer could not be located....
D/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
E/ExtMediaPlayer-JNI: QCMediaPlayer could not be located....
D/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
I/MediaPlayer: constructor
I/MediaPlayer: setListener
D/MediaPlayer-JNI: MediaExPlayer mediaplayer NOT present
I/MediaPlayer: MediaPlayer::setAudioSessionId(7369)
I/MediaPlayer: setDataSource(69, 6395068, 35730)
此错误不会使程序崩溃,只是不会播放任何音频。我还使用三星的文档尝试了SoundPool:https://developer.samsung.com/galaxy/others/playing-audio-and-video-in-android 我还阅读了其他StackOverflow问题,但仍然没有解决方案。而且,在您回答之前,请先了解此完成的工作,它在使用该应用几次后才随机停止。
预先感谢, 杰克