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

Play video userpics in photo change messages.

This commit is contained in:
John Preston
2020-07-03 21:44:21 +04:00
parent e363b254f6
commit f99960e1f6
7 changed files with 212 additions and 46 deletions

View File

@@ -839,7 +839,7 @@ bool UserpicButton::createStreamingObjects(not_null<PhotoData*> photo) {
: Data::FileOrigin(Data::FileOriginPeerPhoto(_peer->id));
_streamed = std::make_unique<Instance>(
photo->owner().streaming().sharedDocument(photo, origin),
[=] { update(); });
nullptr);
_streamed->player().updates(
) | rpl::start_with_next_error([=](Update &&update) {
handleStreamingUpdate(std::move(update));
@@ -892,8 +892,6 @@ void UserpicButton::streamingReady(Media::Streaming::Information &&info) {
void UserpicButton::updateVideo() {
Expects(_role == Role::OpenPhoto);
using namespace Media::Streaming;
const auto id = _peer->userpicPhotoId();
if (!id) {
clearStreaming();

View File

@@ -26,7 +26,6 @@ class SessionController;
namespace Media {
namespace Streaming {
class Instance;
class Document;
struct Update;
enum class Error;
struct Information;
@@ -222,13 +221,13 @@ private:
void setCursorInChangeOverlay(bool inOverlay);
void updateCursor();
void updateVideo();
bool showSavedMessages() const;
void checkStreamedIsStarted();
bool createStreamingObjects(not_null<PhotoData*> photo);
void clearStreaming();
void handleStreamingUpdate(Media::Streaming::Update &&update);
void handleStreamingError(Media::Streaming::Error &&error);
void streamingReady(Media::Streaming::Information &&info);
bool showSavedMessages() const;
void paintUserpicFrame(Painter &p, QPoint photoPosition);
void grabOldUserpic();