views:

843

answers:

4

i am biginner in android development and try to play video from link but it's give error "sorry,we can't play this video" i tride so many links but for all links its show same error.

My code it follwing

public class VideoDemo extends Activity {

    private static final String path ="http://demo.digi-corp.com/S2LWebservice/Resources/SampleVideo.mp4";

private VideoView video; private MediaController ctlr; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); getWindow().setFormat(PixelFormat.TRANSLUCENT); setContentView(R.layout.videoview);

        video = (VideoView) findViewById(R.id.video);
        video.setVideoPath(path);

        ctlr = new MediaController(this);
        ctlr.setMediaPlayer(video);
        video.setMediaController(ctlr);
        video.requestFocus();
 }

}

thansk in advance

A: 

logcat show following error message

04-12 15:04:54.245: ERROR/PlayerDriver(554): HandleErrorEvent: PVMFErrTimeout

priyanka
+1  A: 

Try this:

String LINK = "type_here_the_link";
setContentView(R.layout.mediaplayer);
VideoView videoView = (VideoView) findViewById(R.id.video);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(LINK);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
George
+2  A: 

It has something to do with your link and content. Try the following two links:

    String path="http://www.ted.com/talks/download/video/8584/talk/761";
    String path1="http://commonsware.com/misc/test2.3gp";

    Uri uri=Uri.parse(path1);

    VideoView video=(VideoView)findViewById(R.id.VideoView01);
    video.setVideoURI(uri);
    video.start();

Start with "path1", it is a small light weight video stream and then try the "path", it is a higher resolution than "path1", a perfect high resolution for the mobile phone.

A: 

How to determine that a given link is video or a weblink...as all link dont have extension as .mp4 or .3gp etc....viz http://www.youtube.com/results?search_query=comedy&aq=f (is a weblink) [http://www.youtube.com/watch?v=vt4X7zFfv4k][1] (is a video link) In order to call respective view as video or webview...

Placidnick