I want to loop a music in my app so I use the following code:
mediaPlayer = MediaPlayer.create(this, R.raw.music);
mediaPlayer.setVolume(8f, 8f);
mediaPlayer.start();
mediaPlayer.setLooping(true);
I've try to start and then setLooping, the problem still there.
mediaPlayer = MediaPlayer.create(this, R.raw.music);
mediaPlayer.setVolume(8f, 8f);
mediaPlayer.setLooping(true);
mediaPlayer.start();
But when the music ends it don't restart and my app slows rapidly until total freeze, but there is no crash. If I look at the log there is a huge succession of :
MediaPlayer_Java: MEDIA_PAUSED
MediaPlayer_Java: MEDIA_STARTED
My phone is a Xperia M4 Aqua.
Thank you for your help !
mediaPlayer.setLooping(true);
在启动媒体播放器之前
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.