安卓的Soundpool:得到通知的播放时结束 [英] Android SoundPool: get notified when end of played

查看:1671
本文介绍了安卓的Soundpool:得到通知的播放时结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这声音如此简单,我想不通,为什么我找不到答案笑

This sound so simple that I can't figure out why I can't find the answer lol

我有一个工作的声音池类(感谢的教程和一些调整,我做了),并能正常工作。

I have a working sound pool class (thanks to a tutorial and some tweaking I did), and it works fine.

现在的问题是,我希望能够随意改变我的背景音乐。 (并不总是有相同的音乐在一个循环中,但有2或3,当一个人完成我玩了2人之一)。

the problem now is that I want to be able to change my background music randomly. (not always have the same music in a loop but have 2 or 3 and when one finishes I play one of the 2 others).

问题是我找不到得到通知的方式,音乐播放完毕。

problem is I can't find a way to get notified that the music has finished playing.

任何想法?

杰森

推荐答案

它不能用的Soundpool据我可以告诉完成的。

It can't be done with SoundPool as far as I can tell.

唯一的声音选手,我知道它可以提供一个完成通知 MediaPlayer的 - 它更是一个复杂的禽兽不如的Soundpool,但允许设置一个OnCompletionListener时通知播放就完成了。

The only audio 'player' that I know which can provide a completion notification is MediaPlayer - it's more of a complex beast than SoundPool but allows setting an OnCompletionListener to be notified when playback is complete.

这篇关于安卓的Soundpool:得到通知的播放时结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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