安卓:有没有办法流于应用程序的视频?没有办法、应用程序、流于、视频

由网友(朕要回幼儿园深造)分享简介:我见过像Netflix的应用程序,视频流。有没有一种方法使用SDK做到这一点?我找不到有关如何流在Android上任何东西。I've seen apps like netflix that stream video. Is there a way to do this using the sdk? I could...

我见过像Netflix的应用程序,视频流。有没有一种方法使用SDK做到这一点?我找不到有关如何流在Android上任何东西。

I've seen apps like netflix that stream video. Is there a way to do this using the sdk? I could not find anything about how to stream on android.

推荐答案

的下面一个简单的例子,一个 VideoView 流文件

Here a simple example of a VideoView streaming a file

public class VideoPlayer extends Activity {

String url = "http://yourvideo/url/video.mp4";

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview);
       myVideoView.setVideoURI(Uri.parse(url));
       myVideoView.setMediaController(new MediaController(this));
       myVideoView.requestFocus();
       myVideoView.start();
   }
}

和XML中的某个地方:

And in your XML somewhere:

<VideoView
   android:id="@+id/myvideoview"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content" />
阅读全文

相关推荐

最新文章