public void InitPlayer() { TimeControlStatus = new BehaviorSubject <AVPlayerTimeControlStatus>(AVPlayerTimeControlStatus.WaitingToPlayAtSpecifiedRate); ReasonForWaitingToPlay = new BehaviorSubject <string>("AVPlayerWaitingWithNoItemToPlayReason"); ThePlayer?.Dispose(); ThePlayer = new AVPlayer(); ThePlayer.AddObserver(this, "status", NSKeyValueObservingOptions.New, IntPtr.Zero); ThePlayer.AddObserver(this, "error", NSKeyValueObservingOptions.New, IntPtr.Zero); ThePlayer.AddObserver(this, "timeControlStatus", NSKeyValueObservingOptions.New, IntPtr.Zero); ThePlayer.AddObserver(this, "reasonForWaitingToPlay", NSKeyValueObservingOptions.New, IntPtr.Zero); ReasonForWaitingToPlay.Subscribe(status => { Debug.WriteLine("Reason: " + status); }); TimeControlStatus.Subscribe(status => { Debug.WriteLine("TimeControlStatus: " + status); }); PlayerStates = TimeControlStatus.Zip(ReasonForWaitingToPlay, (status, reason) => { switch (status) { case AVPlayerTimeControlStatus.Paused: if (reason == "AVPlayerWaitingWithNoItemToPlayReason") { return(PlayerState.Idle); } if ((ThePlayer.CurrentTime.Value != 0) && (ThePlayer.CurrentTime.Value == ThePlayer.CurrentItem.Duration.Value)) { return(PlayerState.Ended); } return(PlayerState.Paused); case AVPlayerTimeControlStatus.WaitingToPlayAtSpecifiedRate: if (reason == "AVPlayerWaitingWithNoItemToPlayReason") { return(PlayerState.Idle); } return(PlayerState.Buffering); case AVPlayerTimeControlStatus.Playing: return(PlayerState.Playing); default: throw new ArgumentOutOfRangeException(nameof(status), status, null); } }); PlayerStates .Subscribe(change => { Debug.WriteLine("------------------------Status: " + change.ToString()); }); }