private void ObserveVideoRect() { if (_videoLayer?.VideoRect != null) { VideoRatioChanged?.Invoke(this, _videoLayer.VideoRect.Width / Math.Max(_videoLayer.VideoRect.Height, 1)); } }
public void OnPrepared(AndroidMediaPlayer mp) { PlaybackSession.NaturalDuration = TimeSpan.FromMilliseconds(_player.Duration); VideoRatioChanged?.Invoke(this, (double)mp.VideoWidth / global::System.Math.Max(mp.VideoHeight, 1)); if (PlaybackSession.PlaybackState == MediaPlaybackState.Opening) { UpdateVideoStretch(_currentStretch); if (_isPlayRequested) { _player.Start(); PlaybackSession.PlaybackState = MediaPlaybackState.Playing; } else { // To display first image of media when setting a new source. Otherwise, last image of previous source remains visible _player.Start(); _player.Pause(); _player.SeekTo(0); } } _isPlayerPrepared = true; }