2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Use streamed video for GIFs in History.

This commit is contained in:
John Preston
2019-07-30 17:46:13 +02:00
parent b73f1be856
commit 8e8c356659
9 changed files with 279 additions and 158 deletions

View File

@@ -3199,25 +3199,30 @@ void Session::unregisterContactItem(
}
}
void Session::registerAutoplayAnimation(
not_null<::Media::Clip::Reader*> reader,
not_null<ViewElement*> view) {
_autoplayAnimations.emplace(reader, view);
void Session::registerPlayingVideoFile(not_null<ViewElement*> view) {
_playingVideoFiles.emplace(view);
}
void Session::unregisterAutoplayAnimation(
not_null<::Media::Clip::Reader*> reader) {
_autoplayAnimations.remove(reader);
void Session::unregisterPlayingVideoFile(not_null<ViewElement*> view) {
_playingVideoFiles.remove(view);
}
void Session::stopAutoplayAnimations() {
for (const auto [reader, view] : base::take(_autoplayAnimations)) {
void Session::stopPlayingVideoFiles() {
for (const auto view : base::take(_playingVideoFiles)) {
if (const auto media = view->media()) {
media->stopAnimation();
}
}
}
void Session::checkPlayingVideoFiles() {
for (const auto view : base::take(_playingVideoFiles)) {
if (const auto media = view->media()) {
media->checkAnimation();
}
}
}
HistoryItem *Session::findWebPageItem(not_null<WebPageData*> page) const {
const auto i = _webpageItems.find(page);
if (i != _webpageItems.end()) {