android - 4,5秒后流音乐中断

标签 android audio

我正在使用这种方法播放声音:

int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, 1f); 

播放短声音没有问题。但是,如果我播放时间较长的音乐,则会在4.5秒时中断。与往常一样,不会显示任何错误或通知。

最佳答案

假设您正在使用SoundPool,这几乎是基本行为,仅适用于小片段。

Soundpool plays only first 5 secs of file. Why?

我遇到了同样的问题,如果您想播放更长的声音,则需要使用MediaPlayer

关于android - 4,5秒后流音乐中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27175693/

相关文章:

java - Android Activity 下载文件

android - 如何滚动内容?

android - 如何更改 Fabric 仪表板中的 Android 应用程序包名称以进行 crashlytics

image - 图像集合内的音频集合

java - 在 Java 中将 WMA 和 AAC 转换为 MP3

Android:停止功能监听点击和恢复

android - 如何将 ADT 证书导出到 Facebook?

android - 如何使用 repo 下载 eclair 源

java.io.IOException : mark/reset not supported

javascript - Web Audio API : how can I detect speech and record until silence, 带或不带一键通按钮