Android 应用程序上循环声音的问题
我遇到了一些问题。我正在尝试在我的 Android 应用程序中连续循环播放声音。
使用媒体播放器: MP3 播放正常,但末尾有一个文件中不存在的间隙。我读到它与解码器有关,并且 ogg 应该可以工作。 尝试使用ogg,但仍然得到间隙,这绝对不在文件中。
使用 SoundPool 类和 ogg(使用这个家伙有趣的类:http ://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html),
声音开始,几分之一秒后,它重新启动。所以我在每个文件的开头都会有半秒的卡顿,没有 进一步前进,因为总是要回到起点。
媒体播放器及其循环音频的能力真的有问题吗?奇怪的口吃音池怎么样?
非常感谢您的帮助!
A bit of a problem has presented itself to me. I am trying to play a sound continously looping in my android app.
With MediaPlayer:
MP3 plays alright, but there is a gap at the end which does not exist in the file. I read it had to do with the decoder, and that ogg should work.
Tried using ogg, but still get the gap, which is definitely not on the file.
With SoundPool classes and ogg (using this fellow's interesting class: http://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html),
the sound starts, and a fraction of a second later, it restarts. so I get a stutering half a second of the beginning of every file, without
advancing further, because it is always going back to the beginning.
Is there something really wrong with media player and it's ability to loop audio? How about the freakishy stuttering soundpool?
Thank you very much for any assistance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用以下代码来循环声音(其中声音扩展名为 .ogg),而不是使用声音池,让我们尝试使用媒体播放器,这是我用来循环音频的代码,它对我来说效果很好,让我们尝试一下,
I use the following code to looping soung (where sound with extension .ogg), instead of using sound pool lets try with Media player,This is the code i used to looping audio its work fine for me lets have a try,