Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stream video from php server to android programmatically

I have a url to a video. I want to stream the video to my application. I can download the video file completely and then play it but i want that while downloading the video the video should also be played, like in youtube. I have a php server running which has the video on it. I have seen this question being asked but there were no answers for any of the questions.

like image 372
sanjeev Avatar asked Apr 08 '26 06:04

sanjeev


1 Answers

You can go through code

void playvideo(String url) 
{
     String  link=url;
     Log.e("url",link);
     view1 = (VideoView) findViewById(R.id.myVideoView); 
      getWindow().setFormat(PixelFormat.TRANSLUCENT);

      MediaController mc = new MediaController(this); 
      mc.setMediaPlayer(view1); 

      view1.setMediaController(mc); 
      view1.setVideoURI(Uri.parse(link)); 
      view1.requestFocus(); 
      view1.start();

 }
like image 184
Nirali Avatar answered Apr 09 '26 20:04

Nirali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!