Having 2 Mediaplayer objects playing in sync - Android

孤街醉人 提交于 2019-12-14 04:22:35

问题


In my android game I want to have a rhythm Mediaplayer object and a lead Mediaplayer object playing in sync. However at the moment the rhythm is a slight bit behind the playback of the lead Mediaplayer object. Is there a way I can make it so that both are started at the same time, for instance using Runnables etc?!

It's quite crucial that they play in sync with each other as you can imagine! Many thanks


回答1:


Try using SoundPool which seems to be created just for this kind of task. An example.

Also for the sounds that are synced to user actions use Jet sounds.



来源:https://stackoverflow.com/questions/4100318/having-2-mediaplayer-objects-playing-in-sync-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!