1

我想构建一个应用程序来从我的平板电脑上的 IP 摄像头获取实时视频流。我用谷歌搜索了很多,但找不到任何实用的方法。我找到了这段代码

  [Activity(Label = "CameraTest1", MainLauncher = true, Icon = "@drawable/icon")]
    public class Activity1 : Activity
    {
        int count = 1;

        VideoView videoView;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);
            videoView = FindViewById<VideoView>(Resource.Id.videoView1);
            button.Click += button_Click;
        }

        void button_Click(object sender, EventArgs e)
        {
            videoView.SetVideoURI(Uri.Parse("rtsp://192.168.1.3/mjpeg"));
            videoView.SetMediaController(new MediaController(this));
            videoView.RequestFocus();
            videoView.Start();


        }
    }

但它给了我一个错误(无法播放此视频)任何帮助将不胜感激。

4

0 回答 0