开发者

Play movie from URL on Android

开发者 https://www.devze.com 2023-03-11 00:56 出处:网络
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); VideoView videoView = (VideoView) findViewById(R.id.video_view);
@Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);

        VideoView videoView = (VideoView) findViewById(R.id.video_view);
        MediaController mediaController = new MediaController(this);
        mediaController.setAnchorView(videoView);
        Uri video = Uri.parse(link);
        videoView.setMediaController(mediaController);
        vi开发者_运维知识库deoView.setVideoURI(video);
        videoView.requestFocus();
        videoView.start();
    }

But not successful. It's giving an error: "Cannot play this video"


I guess you did not use

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

Did you?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号