我的背景音乐循环不"环路QUOT;好 [英] My background loop music doesn't "loop" good

查看:185
本文介绍了我的背景音乐循环不"环路QUOT;好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个背景音乐循环。但它好好尝试循环不好,还有每次循环结束时间第二是半音乐内部消除。
MP3文件是完美的,但也不是没有任何音乐的第二次。
难道是故障的MediaPlayer的?

I have a background music loop. But it doens't loop well, there's a half second whithout music every time the loop is ending. The mp3 file is perfect, there isn't any second without music. Is it fault of MediaPlayer?

推荐答案

与杰利贝恩(Android版4.1),你可以开始做MediaPlayers的链接。当前正在播放的MediaPlayer已完成之前,调用<一个href=\"http://developer.android.com/reference/android/media/MediaPlayer.html#setNextMediaPlayer%28android.media.MediaPlayer%29\"相对=nofollow> setNextMediaPlayer 和当前的是为了避免间隙结束后的下一个的MediaPlayer将自动尽快开始

Starting with Jellybean (Android 4.1) you can do "chaining" of MediaPlayers. Before the currently playing MediaPlayer has finished, call setNextMediaPlayer, and the next MediaPlayer will automatically start as soon as possible after the current one has finished in order to avoid gaps.

请注意,你不允许设置当前播放的MediaPlayer实例作为下一个。因此,在使用这个循环为一首歌曲令你不得不创造2 MediaPlayer的实例,他们之间的同一数据源和备用。

Note that you're not allowed to set the currently playing MediaPlayer instance as the next one. So in order to use this for looping a song you'd have to create 2 MediaPlayer instances with the same data source and alternate between them.

这篇关于我的背景音乐循环不&QUOT;环路QUOT;好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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