• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps best way to get duration of video from website

desatir7316

Newbie
Dec 25, 2014
35
2
hi
i want to know about duration of a video clip on a website without downloading the clip
is this code do the correct :

Java:
v = (VideoView) findViewById(R.id.videoView1);
v.setVideoPath("clip url");
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener()  {
            @Override
            public void onPrepared(MediaPlayer mp) {                       
                long duration = v.getDuration();
                Toast.makeText(getApplicationContext(), duration + "", 500).show();
            }
        });
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones