• 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

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();
            }
        });
 
Back
Top Bottom