如何使用VideoView播放https视频网址

问题描述 投票:0回答:1

获取MediaPlayer:错误(1,-2147483648)

MediaController mediacontroller = new MediaController(getActivity());
mediacontroller.setAnchorView(videoView);
videoView.setVideoPath("https://example.com");
videoView.start();
https android-videoview
1个回答
0
投票

类级变量

           VideoView videoView

我把它放在OnCreate中

             SetContentView(Resource.Layout.Main);
             videoView = FindViewById<VideoView>(Resource.Id.video);

             ImageButton button = FindViewById<ImageButton>(Resource.Id.two_btn);


            MediaController mController = new 
            Android.Widget.MediaController(this);
            mController.SetAnchorView(videoView);
            videoView.SetMediaController(mController);

            uriPath = "https://example.com";
            Android.Net.Uri uri = Android.Net.Uri.Parse(uriPath);
            videoView.RequestFocus();
            videoView.SetVideoURI(uri);
            videoView.Start();

我的按钮点击事件,所以我可以用一个按钮开始视频

© www.soinside.com 2019 - 2024. All rights reserved.