best way to get duration of video from website

  • Replies:0
ali zolfaghari
  • Forum posts: 15

Feb 20, 2015, 9:48:54 AM via 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 :

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

Reply