diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp index 01ba767a4e..b27a81c9ad 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_audio_track.cpp @@ -199,7 +199,7 @@ rpl::producer AudioTrack::playPosition() { _waitingForData.fire({}); } _playPosition = std::clamp( - ((state.position * 1000 + (state.frequency / 2)) + crl::time((state.position * 1000 + (state.frequency / 2)) / state.frequency), crl::time(0), _stream.duration - 1); diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp index 7d2891d8d5..91ed9c3763 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_player.cpp @@ -662,7 +662,7 @@ Media::Player::TrackState Player::prepareLegacyState() const { if (duration > 0) { result.length = duration * crl::time(1000); } else { - result.length = std::max(result.position, crl::time(0)); + result.length = std::max(crl::time(result.position), crl::time(0)); } } result.frequency = kMsFrequency; diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 3116bea975..1831cdf0cf 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -2211,7 +2211,9 @@ void OverlayWidget::restartAtSeekPosition(crl::time position) { } auto options = Streaming::PlaybackOptions(); options.position = position; - if (_doc->isAnimation()) { + options.audioId = AudioMsgId(_doc, _msgid); + if (_doc->isAnimation() + || options.audioId.type() == AudioMsgId::Type::Unknown) { options.mode = Streaming::Mode::Video; options.loop = true; }