mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-29 08:47:52 +00:00
Revert "Avoid using streaming loader with external video player"
This reverts commit d9ddb12500.
This commit is contained in:
@@ -547,7 +547,7 @@ void DocumentData::setVideoQualities(
|
||||
return document->isVideoFile()
|
||||
&& !document->dimensions.isEmpty()
|
||||
&& !document->inappPlaybackFailed()
|
||||
&& document->useStreamingLoader(nullptr)
|
||||
&& document->useStreamingLoader()
|
||||
&& document->canBeStreamed(nullptr);
|
||||
};
|
||||
ranges::sort(
|
||||
@@ -1533,35 +1533,29 @@ bool DocumentData::hasRemoteLocation() const {
|
||||
return (_dc != 0 && _access != 0);
|
||||
}
|
||||
|
||||
bool DocumentData::canVideoBeStreamed(HistoryItem *item) const {
|
||||
if (!isVideoFile()) {
|
||||
return false;
|
||||
}
|
||||
// Streaming couldn't be used with external player
|
||||
// Maybe someone brave will implement this once upon a time...
|
||||
static const auto &ExternalVideoPlayer = base::options::lookup<bool>(
|
||||
Data::kOptionExternalVideoPlayer);
|
||||
return storyMedia()
|
||||
|| !ExternalVideoPlayer.value()
|
||||
|| (item && !item->allowsForward());
|
||||
}
|
||||
|
||||
bool DocumentData::useStreamingLoader(HistoryItem *item) const {
|
||||
bool DocumentData::useStreamingLoader() const {
|
||||
if (size <= 0) {
|
||||
return false;
|
||||
} else if (const auto info = sticker()) {
|
||||
return info->isWebm();
|
||||
}
|
||||
return isAnimation()
|
||||
|| canVideoBeStreamed(item)
|
||||
|| isVideoFile()
|
||||
|| isAudioFile()
|
||||
|| isVoiceMessage();
|
||||
}
|
||||
|
||||
bool DocumentData::canBeStreamed(HistoryItem *item) const {
|
||||
// Streaming couldn't be used with external player
|
||||
// Maybe someone brave will implement this once upon a time...
|
||||
static const auto &ExternalVideoPlayer = base::options::lookup<bool>(
|
||||
Data::kOptionExternalVideoPlayer);
|
||||
return hasRemoteLocation()
|
||||
&& supportsStreaming()
|
||||
&& (!isVideoFile() || canVideoBeStreamed(item));
|
||||
&& (!isVideoFile()
|
||||
|| storyMedia()
|
||||
|| !ExternalVideoPlayer.value()
|
||||
|| (item && !item->allowsForward()));
|
||||
}
|
||||
|
||||
void DocumentData::setInappPlaybackFailed() {
|
||||
@@ -1591,10 +1585,9 @@ StorageFileLocation DocumentData::videoPreloadLocation() const {
|
||||
|
||||
auto DocumentData::createStreamingLoader(
|
||||
Data::FileOrigin origin,
|
||||
bool forceRemoteLoader,
|
||||
HistoryItem *item) const
|
||||
bool forceRemoteLoader) const
|
||||
-> std::unique_ptr<Media::Streaming::Loader> {
|
||||
if (!useStreamingLoader(item)) {
|
||||
if (!useStreamingLoader()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!forceRemoteLoader) {
|
||||
|
||||
Reference in New Issue
Block a user