From 2d1fdc44852ca46058412393fe04cd12948e9f2d Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 31 Oct 2018 14:22:36 +0400 Subject: [PATCH] Seek video to start if position is small. --- Telegram/SourceFiles/mediaview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index c76e6272d5..dabf763dd8 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -1947,6 +1947,13 @@ void MediaView::toggleVideoPaused() { } void MediaView::restartVideoAtSeekPosition(TimeMs positionMs) { + // Seek works bad: it seeks to the next keyframe after positionMs. + // At least let user to seek to the beginning of the video. + if (positionMs < 1000 + && (!_videoDurationMs || (positionMs * 20 < _videoDurationMs))) { + positionMs = 0; + } + _autoplayVideoDocument = _doc; if (_current.isNull()) {