简体   繁体   中英

Android MediaPlayer wrong track duration

The problem is MP plays less time that track duration is. So track ends before it should in few seconds. I've got this bug only on some long tracks (one hour and more). Any suggestions? Thanks.

It is different duration values from MediaStore.Audio.Media.DURATION and MediaPlayer.getDuration() . Using only the last one solved my problem. Also should set the follow code in MP onCompletion() : mp.seekTo(mp.getDuration()) .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM