private unsafe void UpdatePlaybackControls() { if (_progressBarShown && Player?.State == Common.PlayerState.Playing && (DateTime.Now - _lastKeyPressTime).TotalMilliseconds >= _progressBarFadeout.TotalMilliseconds) { _progressBarShown = false; _options.Hide(); Logger?.Info( $"{(DateTime.Now - _lastKeyPressTime).TotalMilliseconds} ms of inactivity, hiding progress bar."); } fixed(byte *name = ResourceLoader.GetBytes(_resourceLoader.ContentList[_selectedTile].Title)) { DllImports.UpdatePlaybackControls(new DllImports.PlaybackData() { show = _progressBarShown ? 1 : 0, state = (int)ToPlayerState(Player?.State ?? Common.PlayerState.Idle), currentTime = (int)_seekLogic.CurrentPositionUI.TotalMilliseconds, totalTime = (int)_seekLogic.Duration.TotalMilliseconds, text = name, textLen = _resourceLoader.ContentList[_selectedTile].Title.Length, buffering = _bufferingInProgress ? 1 : 0, bufferingPercent = _bufferingProgress, seeking = (_seekLogic.IsSeekInProgress || _seekLogic.IsSeekAccumulationInProgress) ? 1 : 0 }); } }
private unsafe void UpdatePlaybackControls() { if (_seekBufferingInProgress == false && _seekInProgress == false) { _playerTimeCurrentPosition = _player?.CurrentPosition ?? TimeSpan.Zero; } _playerTimeDuration = _player?.Duration ?? TimeSpan.Zero; if (_progressBarShown && _player?.State == PlayerState.Playing && (DateTime.Now - _lastKeyPressTime).TotalMilliseconds >= _progressBarFadeout.TotalMilliseconds) { _progressBarShown = false; _options.Hide(); Logger?.Info( $"{(DateTime.Now - _lastKeyPressTime).TotalMilliseconds} ms of inactivity, hiding progress bar."); } fixed(byte *name = ResourceLoader.GetBytes(_resourceLoader.ContentList[_selectedTile].Title)) { DllImports.UpdatePlaybackControls(new DllImports.PlaybackData() { show = _progressBarShown ? 1 : 0, state = (int)(_player?.State ?? PlayerState.Idle), currentTime = (int)_playerTimeCurrentPosition.TotalMilliseconds, totalTime = (int)_playerTimeDuration.TotalMilliseconds, text = name, textLen = _resourceLoader.ContentList[_selectedTile].Title.Length, buffering = _bufferingInProgress ? 1 : 0, bufferingPercent = _bufferingProgress }); } }
private static void ResetPlaybackControls() { DllImports.UpdatePlaybackControls(new DllImports.PlaybackData()); }