Ejemplo n.º 1
0
        protected override void OnElementChanged(ElementChangedEventArgs <MyVideoPlayer> e)
        {
            base.OnElementChanged(e);
            if (this.Control == null)
            {
                this.Element.PlayerAction = (action) => {
                    if (action == VideoState.ActionPause)
                    {
                        this._Player.Pause();
                    }
                    else if (action == VideoState.ActionPlay)
                    {
                        this._Player.Start();
                    }
                    else if (action == VideoState.ActionSTOP)
                    {
                        this._Player.Stop();
                    }
                };

                this._Player = new MyPlayerView(true, this.Frame);

                SetNativeControl(this._Player);
            }
        }
 protected override void Dispose(bool disposing)
 {
     if (this._PlayerView != null)
     {
         this._PlayerView.Dispose();
         this._PlayerView = null;
     }
     base.Dispose(disposing);
 }
        protected override void OnElementChanged(ElementChangedEventArgs <MyVideoPlayer> e)
        {
            base.OnElementChanged(e);
            if (this.Control == null)
            {
                this._PlayerView = new MyPlayerView(this.Element);
                SetNativeControl(this._PlayerView);
            }

            this._PlayerView.Load(new NSString(this.Element.FileSource));
            this._PlayerView.FitToWindow   = this.Element.FitInWindow;
            this._PlayerView.AddController = this.Element.AddVideoController;

            // autoplay
            if (this.Element.AutoPlay)
            {
                this._PlayerView.Start();
            }
        }