-3

I am making a media player where I am showing videos from the remote server(e.g. youtube). I have shown a list of videos but I am unable to get the length of videos. (I have searched on this site but I got answers regarding how to get time duration of the video which is locally stored. I am giving the link to one of such question. How to get length in milliseconds of video from URL without video view in Android?)

Satish_Mhetre
  • 192
  • 1
  • 2
  • 17

1 Answers1

0
MediaPlayer mp= new MediaPlayer();
mp.setDataSource(context,uri);
int durartion = mp.getDuration();
zys
  • 1,306
  • 3
  • 18
  • 37