有没有办法从URL播放视频

时间:2018-03-16 08:52:36

标签: php html react-native react-native-android react-native-ios

有没有办法,localhost设置播放视频,如: https://vjs.zencdn.net/v/oceans.mp4

当我尝试访问我的视频时,它会自动下载

1 个答案:

答案 0 :(得分:1)

使用视频观看

 VideoView videoview = (VideoView) findViewById(R.id.VideoView);   
    MediaController mediacontroller = new MediaController("context");
    mediacontroller.setAnchorView(videoview);
    Uri video = Uri.parse("you_video_url");

    videoview.setMediaController(mediacontroller);
    videoview.setVideoURI(video);

浏览器中播放视频

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://vjs.zencdn.net/v/oceans.mp4"));
            startActivity(browserIntent);