how to play video from url how to play video from url android android

how to play video from url


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.


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


pDialog = new ProgressDialog(this);    // Set progressbar message    pDialog.setMessage("Buffering...");    pDialog.setIndeterminate(false);    pDialog.setCancelable(false);    // Show progressbar    pDialog.show();    try {        // Start the MediaController        MediaController mediacontroller = new MediaController(this);        mediacontroller.setAnchorView(mVideoView);              Uri videoUri = Uri.parse(videoUrl);        mVideoView.setMediaController(mediacontroller);        mVideoView.setVideoURI(videoUri);    } catch (Exception e) {        e.printStackTrace();    }    mVideoView.requestFocus();    mVideoView.setOnPreparedListener(new OnPreparedListener() {        // Close the progress bar and play the video        public void onPrepared(MediaPlayer mp) {            pDialog.dismiss();            mVideoView.start();        }    });    mVideoView.setOnCompletionListener(new OnCompletionListener() {        public void onCompletion(MediaPlayer mp) {            if (pDialog.isShowing()) {                pDialog.dismiss();            }            finish();                       }    });