Fix various issues with audio and video playback

#3716
This commit is contained in:
Wojtek Figat
2026-02-04 21:48:02 +01:00
parent 780e78f056
commit f733611213
4 changed files with 17 additions and 15 deletions

View File

@@ -133,7 +133,9 @@ void VideoPlayer::SetTime(float time)
if (_state == States::Stopped || _player.Backend == nullptr)
return;
TimeSpan timeSpan = TimeSpan::FromSeconds(time);
timeSpan.Ticks = Math::Clamp<int64>(timeSpan.Ticks, 0, _player.Duration.Ticks);
timeSpan.Ticks = Math::Max<int64>(timeSpan.Ticks, 0);
if (_player.Duration.Ticks > 0)
timeSpan.Ticks = Math::Min<int64>(timeSpan.Ticks, _player.Duration.Ticks);
_player.Backend->Player_Seek(_player, timeSpan);
}