从PHP服务器流视频到Android编程 [英] Stream video from php server to android programmatically
本文介绍了从PHP服务器流视频到Android编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个链接到一个视频。我要流视频到我的应用程序。我可以完全下载的视频文件,然后发挥,但我想,在下载视频也应发挥,就像在YouTube上的视频。我有一个PHP的服务器上运行有它的视频。 我已经看到了这个问题被问,但没有回答任何的问题。
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.
推荐答案
您可以通过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();
}
这篇关于从PHP服务器流视频到Android编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文