0

I have set up my app using these:

https://github.com/googlesamples/android-UniversalMusicPlayer/blob/master/mobile/src/main/java/com/example/android/uamp/ui/FullScreenPlayerActivity.java

https://gist.github.com/ianhanniballake/15dce0b233b4f4b23ef8

The duration is displayed as 10, which I believe is because dividing 10000 in putLong(MediaMetadataCompat.METADATA_KEY_DURATION, 10000); by 1000 in mEnd.setText(DateUtils.formatElapsedTime(duration/1000)); to get seconds format. But why 10000?

How do I get the original duration of the track being played?

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
V1 Kr
  • 177
  • 1
  • 3
  • 18

2 Answers2

0

Time in long is normally in milliseconds, so you should divide by 1,000 (not 10,000) to get the amount of seconds.

pantos27
  • 629
  • 4
  • 13
0

Ok, the problem was instead of 10000, I should have returned the media duration from the service itself. like player.getDuration() 10000 was (i guess) just an example by ianhanniballake

Rohan Pawar
  • 1,875
  • 22
  • 40
V1 Kr
  • 177
  • 1
  • 3
  • 18