简体   繁体   English

Android-顺序音频播放?

[英]Android - Sequential audio playback?

Tried both soundpool and mediaplayer but cant quite manage to get sound files to play back correctly in sequence without overlap.. Need to be able to playback three randomly selected audio files in sequence without overlap. 试过了声音池和媒体播放器,但无法设法使声音文件按顺序正确播放而没有重叠。.需要能够按顺序播放三个随机选择的音频文件而不会重叠。 Any examples of using soundpool to play back audio sequentially? 有使用音池顺序播放音频的示例吗? would be very much appreciated.. seems like such a simple thing is overly complicated.. 将不胜感激..似乎如此简单的事情过于复杂。

I would rather suggest use MediaPlayer instead of using SoundPool , since purpose of using SoundPool is generally to play multiple files concurrently (which causes overlapping.) 我宁愿建议使用MediaPlayer而不是SoundPool ,因为使用SoundPool目的通常是同时播放多个文件(这会导致重叠)。

Just use a MediaPlayer object and apply the OnCompletionListener to it. 只需使用MediaPlayer对象,然后将OnCompletionListener应用于它即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM