0

I am trying to play a video file in Android activity but not able to do this

I am using the following code.

try
  {

    VideoView video = (VideoView)findViewById(R.id.videoView);

     String url="http://demofouracelimited.com/modigynw/
    videos/VID_20140730_144814_1407834444.3gp"

   String url1="http://download.itcuties.com/teaser/itcuties-teaser-480.mp4"

    video.setVideoPath(url); //  not playing
    // video.setVideoPath(url1); playing

      video.start();
 }
  catch(Exception ex)
  {
    ex.printStackTrace();    
   }

can you help me to fix problem in this task

adesh singh
  • 1,727
  • 9
  • 38
  • 70

1 Answers1

0

There is a public void setVideoURI (Uri uri). Have you tried using Uri.parse(url) to see if the video plays?

Is there anything in the logcat?

Also, is it necessary to use a VideoView? Will using the MediaPlayer suit your need? :)

An SO User
  • 24,612
  • 35
  • 133
  • 221
  • hmm piyush the video is being played with the second url but not with first one url and not throwing any error – adesh singh Aug 21 '14 at 12:24
  • Check this http://stackoverflow.com/questions/4818047/how-to-play-3gp-video-file-in-android – Piyush Aug 21 '14 at 12:31
  • @adeshsingh if you refer to the [supported formats](http://developer.android.com/guide/appendix/media-formats.html) for MediaPlayer, `3gp` is supported straight out of the box :) – An SO User Aug 21 '14 at 13:01