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>(); _additional = std::make_unique<StickerData>();
sticker()->type = StickerType::Webm; sticker()->type = StickerType::Webm;
} }
if (isAudioFile() || isAnimation() || isVoiceMessage()) { if (isAudioFile()
|| isAnimation()
|| isVoiceMessage()
|| storyMedia()) {
setMaybeSupportsStreaming(true); 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) { void DocumentData::setContentUrl(const QString &url) {
_url = url; _url = url;
} }

View file

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