mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-24 15:34:20 +00:00
Enable voice messages streaming.
This commit is contained in:
parent
195164d9d4
commit
41c60419f1
@ -56,7 +56,11 @@ void AutoDownloadBox::setupContent() {
|
||||
this,
|
||||
std::move(wrap)));
|
||||
|
||||
static const auto kHidden = { Type::Video, Type::Music };
|
||||
static const auto kHidden = {
|
||||
Type::Video,
|
||||
Type::Music,
|
||||
Type::VoiceMessage
|
||||
};
|
||||
|
||||
const auto values = Ui::CreateChild<base::flat_map<Type, int>>(content);
|
||||
const auto add = [&](Type type, LangKey label) {
|
||||
|
@ -181,7 +181,9 @@ void Full::setBytesLimit(Source source, Type type, int bytesLimit) {
|
||||
}
|
||||
|
||||
bool Full::shouldDownload(Source source, Type type, int fileSize) const {
|
||||
if (type == Type::Video || type == Type::Music) {
|
||||
if (type == Type::Video
|
||||
|| type == Type::Music
|
||||
|| type == Type::VoiceMessage) {
|
||||
// With streaming we disable autodownload and hide them in Settings.
|
||||
return false;
|
||||
}
|
||||
|
@ -115,8 +115,7 @@ AudioMsgId::Type Instance::getActiveType() const {
|
||||
const auto voiceData = getData(AudioMsgId::Type::Voice);
|
||||
if (voiceData->current) {
|
||||
const auto state = getState(voiceData->type);
|
||||
if (voiceData->current == state.id
|
||||
&& !IsStoppedOrStopping(state.state)) {
|
||||
if (!IsStoppedOrStopping(state.state)) {
|
||||
return voiceData->type;
|
||||
}
|
||||
}
|
||||
@ -355,18 +354,12 @@ void Instance::play(const AudioMsgId &audioId) {
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
if (document->isAudioFile()) {
|
||||
if (document->isAudioFile() || document->isVoiceMessage()) {
|
||||
auto loader = document->createStreamingLoader(audioId.contextId());
|
||||
if (!loader) {
|
||||
return;
|
||||
}
|
||||
playStreamed(audioId, std::move(loader));
|
||||
} else if (document->isVoiceMessage()) {
|
||||
mixer()->play(audioId);
|
||||
setCurrent(audioId);
|
||||
if (document->loading()) {
|
||||
documentLoadProgress(document);
|
||||
}
|
||||
} else if (document->isVideoMessage()) {
|
||||
if (const auto item = App::histItemById(audioId.contextId())) {
|
||||
App::wnd()->controller()->startRoundVideo(item);
|
||||
|
@ -674,6 +674,8 @@ Media::Player::TrackState Player::prepareLegacyState() const {
|
||||
? crl::time(0)
|
||||
: document->song()
|
||||
? document->song()->duration
|
||||
: document->voice()
|
||||
? document->voice()->duration
|
||||
: document->duration();
|
||||
if (duration > 0) {
|
||||
result.length = duration * crl::time(1000);
|
||||
|
Loading…
Reference in New Issue
Block a user