2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Use SharedMediaMergedViewer() for audio player.

That way audio files and voice/video messages will play in context
(one after another with ability to go to next or previous in player)
almost always, no matter at what part of message history we are.
This commit is contained in:
John Preston
2017-12-09 14:02:51 +04:00
parent 9bbcbd4bb3
commit 4e2c8bbc26
8 changed files with 207 additions and 60 deletions

View File

@@ -36,6 +36,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "base/observer.h"
#include "base/task_queue.h"
#include "history/history_media.h"
#include "styles/style_history.h"
Q_DECLARE_METATYPE(ClickHandlerPtr);
Q_DECLARE_METATYPE(Qt::MouseButton);
@@ -359,15 +360,25 @@ void handlePendingHistoryUpdate() {
}
Auth().data().pendingHistoryResize().notify(true);
for (auto item : base::take(Global::RefPendingRepaintItems())) {
for (const auto item : base::take(Global::RefPendingRepaintItems())) {
Auth().data().requestItemRepaint(item);
// Start the video if it is waiting for that.
if (item->pendingInitDimensions()) {
if (auto media = item->getMedia()) {
if (auto reader = media->getClipReader()) {
if (!reader->started() && reader->mode() == Media::Clip::Reader::Mode::Video) {
item->resizeGetHeight(item->width());
if (const auto media = item->getMedia()) {
if (const auto reader = media->getClipReader()) {
const auto startRequired = [&] {
if (reader->started()) {
return false;
}
using Mode = Media::Clip::Reader::Mode;
return (reader->mode() == Mode::Video);
};
if (startRequired()) {
const auto width = std::max(
item->width(),
st::historyMinimalWidth);
item->resizeGetHeight(width);
}
}
}