Play movie from URL on Android

强颜欢笑 提交于 2020-01-16 04:33:16

问题


@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);
        videoView.setVideoURI(video);
        videoView.requestFocus();
        videoView.start();
    }

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


回答1:


I guess you did not use

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

Did you?



来源:https://stackoverflow.com/questions/6277375/play-movie-from-url-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!