Repository navigation
Conversation
This was referenced Nov 19, 2026
oviron
marked this pull request as ready for review
November 19, 2026 12:07
oviron
force-pushed
the
tdesktop-inline-video-restart
branch
from
November 19, 2026 12:40
074f6fd to
c452d60
Compare
Author
|
Update: the branch has two more commits, both described above, and its first commit was fixed. It named Our fork ships all four commits in AyuGram 7.4.4-3, universal macOS and Windows x64, built by CI. The macOS build starts and runs; I have not yet checked the behaviour itself by observation. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An autoplaying video in a chat or channel can play for a few seconds, jump back to the first frame and start over. It happens to videos with alternative qualities, and two places lose the position. Two more commits cover what is left around the switch.
Quality switch. The inline player starts with the quality from the settings, 480p by default. When the speed estimate allows a larger rendition and four seconds are preloaded,
Streaming::Documentrequests it, andGif::createStreamedPlayer()replaces the stream.startStreamedPlayer()then takes the position from the message timestamp or the saved position of the document, which is zero for a video that was never opened in the viewer. The first estimate comes no earlier than five seconds after the first request, so the jump comes a few seconds into the video. A switch down while the video waits for data loses the position the same way. The media viewer and PiP already pass the current position when they switch (OverlayWidget::applyVideoQuality(),Pip::applyVideoQuality()).The first commit remembers the position of the replaced stream and starts the new one from it. It reads the position from the
Streaming::Documentinformation, which is updated on the main thread and already holds the start position while the player is initializing. The position is used once, so a first start and a later restart of the same stream behave as before.View rebuild.
Gif::~Gif()keeps the stream alive for five seconds so that a recreated view picks up the running player. It asksData::Streamingto keep the original document, but the stream is registered under the chosen rendition. When a rendition plays, nothing is kept, and the new view starts a new player from the start. Editing the post is enough:applyEdition()recreates the media, andfinishEdition()requests a new view.The second commit keeps alive the document that is streamed.
A playing video and a quality chosen elsewhere. The handler of
switchQualityRequestsreturned when the saved quality already had the requested height. That is the case when another video, the media viewer or PiP switched first: this video asks for the same height later, finds it saved and keeps its lower rendition, while every video started after that plays the higher one. The third commit returns there only if the cell already plays what the setting selects.It also takes the replacement out of the handler. The handler runs inside the player's own update, so replacing the stream there can destroy that player, and two views of one video in different renditions can call each other's handlers without end through
Data::Streaming::sharedDocument()andDocument::setOtherQualities(). Now the handler only saves the height, and the replacement runs from the event loop if the stream is still the same.A switch that cannot start. If the new stream fails before it is ready, for example on the seek to the carried position, the cell kept the failed stream and showed a still frame:
checkStreamedIsStarted()does not start a failed one. The fourth commit drops such a stream, and the video starts again by the usual rules.Streaming::Documenthas marked a rendition that failed to open by then, so another one is chosen; if the original itself failed to open, the video stays unplayable as before.Not covered: a rebuilt view still starts over if the quality setting changed in between, because another video switched it and the new view then chooses a different rendition. While a new rendition opens, the cover is shown for a moment, as before.
Our fork of AyuGram, which tracks Telegram Desktop 7.4.4, ships these commits in AyuGram 7.4.4-3 (universal macOS and Windows x64, built by CI). The macOS build starts and runs; the behaviour itself has not been checked by observation yet.
This pull request was prepared with the help of an AI assistant (Claude Code).
🤖 Generated with Claude Code