Ejemplo n.º 1
0
        private void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoPlayerStatus videoStatus = VideoPlayerStatus.Loading;

            switch (_player.Status)
            {
            case AVPlayerStatus.ReadyToPlay:
                switch (_player.TimeControlStatus)
                {
                case AVPlayerTimeControlStatus.Playing:
                    videoStatus = VideoPlayerStatus.Playing;
                    break;

                case AVPlayerTimeControlStatus.Paused:
                    videoStatus = VideoPlayerStatus.Paused;
                    break;
                }
                break;
            }

            ((IVideoPlayer)Element).Status = videoStatus;

            if (_playerItem != null)
            {
                ((IVideoPlayer)Element).Duration = ConvertTime(_playerItem.Duration);
                ((IElementController)Element).SetValueFromRenderer(VideoPlayerControl.PositionProperty, ConvertTime(_playerItem.CurrentTime));
            }
        }
Ejemplo n.º 2
0
        private void OnUpdateStatus(object sender, EventArgs args)
        {
            VideoPlayerStatus status = VideoPlayerStatus.Loading;

            if (_isPrepared)
            {
                status = _videoView.IsPlaying ? VideoPlayerStatus.Playing : VideoPlayerStatus.Paused;
            }

            ((IVideoPlayer)Element).Status = status;
            TimeSpan timeSpan = TimeSpan.FromMilliseconds(_videoView.CurrentPosition);

            ((IElementController)Element).SetValueFromRenderer(VideoPlayerControl.PositionProperty, timeSpan);
        }
Ejemplo n.º 3
0
        void OnMediaElementCurrentStateChanged(object sender, RoutedEventArgs args)
        {
            VideoPlayerStatus videoStatus = VideoPlayerStatus.Loading;

            switch (Control.CurrentState)
            {
            case MediaElementState.Playing:
                videoStatus = VideoPlayerStatus.Playing;
                break;

            case MediaElementState.Paused:
            case MediaElementState.Stopped:
                videoStatus = VideoPlayerStatus.Paused;
                break;
            }

            ((IVideoPlayer)Element).Status = videoStatus;
        }