Android VideoView无法用于在线视频流

时间:2016-09-21 17:19:08

标签: java android android-activity android-videoview

        setContentView(R.layout.activity_s);
    VideoView vidView = (VideoView)findViewById(R.id.videoView);
    MediaController vidControl = new MediaController(this);
    String vidAddress = "VideoURL";
    Uri vidUri = Uri.parse(vidAddress);
    vidView.setVideoURI(vidUri);
    vidControl.setAnchorView(vidView);
    vidView.setMediaController(vidControl);

活动已成功启动但无法播放视频。

1 个答案:

答案 0 :(得分:0)

添加:

vidView.start();

您必须在AndroidManifest上包含此权限

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

您可以尝试第三方库: easy-video-player