示例#1
0
        public void SetContent(string url)
        {
            // https://stackoverflow.com/questions/47353986/xamarin-forms-forms-context-is-obsolete
            //SOLVED BY REFERENCING LOCAL ANDROID CONTEXT IN MAIN APPLICATION
            //REPLACED FORMS.CONTEXT
            videoView       = new VideoView(MainApplication.ActivityContext);
            mediaController = new MediaController(MainApplication.ActivityContext, false);
            uriHd           = Android.Net.Uri.Parse(url);

            mediaController.SetMediaPlayer(videoView);
            mediaController.SetAnchorView(videoView);

            videoView.SetMediaController(mediaController);
            videoView.SetFitsSystemWindows(true);
            videoView.SetVideoURI(uriHd);

            contentView = new ContentView();
            //contentView.BackgroundColor = Color.Black;
            contentView.Content           = videoView.ToView();
            contentView.HorizontalOptions = LayoutOptions.FillAndExpand;
            contentView.VerticalOptions   = LayoutOptions.CenterAndExpand;

            Content = contentView;

            videoView.Start();
        }