Force streaming bit for stories videos.

This commit is contained in:
John Preston 2023-06-16 16:44:32 +04:00
parent fc0902adf0
commit 08c4f1f67a
3 changed files with 34 additions and 13 deletions

View File

@ -443,7 +443,10 @@ void DocumentData::setattributes(
_additional = std::make_unique<StickerData>();
sticker()->type = StickerType::Webm;
}
if (isAudioFile() || isAnimation() || isVoiceMessage()) {
if (isAudioFile()
|| isAnimation()
|| isVoiceMessage()
|| storyMedia()) {
setMaybeSupportsStreaming(true);
}
}
@ -1588,6 +1591,19 @@ void DocumentData::setRemoteLocation(
}
}
void DocumentData::setStoryMedia(bool value) {
if (value) {
_flags |= Flag::StoryDocument;
setMaybeSupportsStreaming(true);
} else {
_flags &= ~Flag::StoryDocument;
}
}
bool DocumentData::storyMedia() const {
return (_flags & Flag::StoryDocument);
}
void DocumentData::setContentUrl(const QString &url) {
_url = url;
}

View File

@ -232,6 +232,9 @@ public:
[[nodiscard]] Storage::Cache::Key bigFileBaseCacheKey() const;
void setStoryMedia(bool value);
[[nodiscard]] bool storyMedia() const;
void setRemoteLocation(
int32 dc,
uint64 access,
@ -283,18 +286,19 @@ public:
private:
enum class Flag : ushort {
StreamingMaybeYes = 0x001,
StreamingMaybeNo = 0x002,
StreamingPlaybackFailed = 0x004,
ImageType = 0x008,
DownloadCancelled = 0x010,
LoadedInMediaCache = 0x020,
HasAttachedStickers = 0x040,
InlineThumbnailIsPath = 0x080,
ForceToCache = 0x100,
PremiumSticker = 0x200,
PossibleCoverThumbnail = 0x400,
UseTextColor = 0x800,
StreamingMaybeYes = 0x0001,
StreamingMaybeNo = 0x0002,
StreamingPlaybackFailed = 0x0004,
ImageType = 0x0008,
DownloadCancelled = 0x0010,
LoadedInMediaCache = 0x0020,
HasAttachedStickers = 0x0040,
InlineThumbnailIsPath = 0x0080,
ForceToCache = 0x0100,
PremiumSticker = 0x0200,
PossibleCoverThumbnail = 0x0400,
UseTextColor = 0x0800,
StoryDocument = 0x1000,
};
using Flags = base::flags<Flag>;
friend constexpr bool is_flag_type(Flag) { return true; };

View File

@ -59,6 +59,7 @@ using UpdateFlag = StoryUpdate::Flag;
const auto result = owner->processDocument(*document);
if (!result->isNull()
&& (result->isGifv() || result->isVideoFile())) {
result->setStoryMedia(true);
return StoryMedia{ result };
}
}