void UpdateSource()
        {
            if (MediaElement.Source != null)
            {
                if (MediaElement.Source is UriMediaSource uriSource)
                {
                    if (uriSource.Uri.Scheme == "ms-appx")
                    {
                        // video resources should be in the raw folder with Build Action set to AndroidResource
                        string uri = "android.resource://" + Context.PackageName + "/raw/" + uriSource.Uri.LocalPath.Substring(1, uriSource.Uri.LocalPath.LastIndexOf('.') - 1).ToLower();
                        _view.SetVideoURI(global::Android.Net.Uri.Parse(uri));
                    }
                    else if (uriSource.Uri.Scheme == "ms-appdata")
                    {
                        string filePath = Platform.ResolveMsAppDataUri(uriSource.Uri);

                        if (string.IsNullOrEmpty(filePath))
                        {
                            throw new ArgumentException("Invalid Uri", "Source");
                        }

                        _view.SetVideoPath(filePath);
                    }
                    else
                    {
                        if (uriSource.Uri.IsFile)
                        {
                            _view.SetVideoPath(uriSource.Uri.AbsolutePath);
                        }
                        else
                        {
                            _view.SetVideoURI(global::Android.Net.Uri.Parse(uriSource.Uri.AbsoluteUri));
                        }
                    }
                }
                else if (MediaElement.Source is FileMediaSource fileSource)
                {
                    _view.SetVideoPath(fileSource.File);
                }

                if (MediaElement.AutoPlay)
                {
                    _view.Start();
                    Controller.CurrentState = _view.IsPlaying ? MediaElementState.Playing : MediaElementState.Stopped;
                }
            }
            else if (_view.IsPlaying)
            {
                _view.StopPlayback();
                Controller.CurrentState = MediaElementState.Stopped;
            }
        }