mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-31 15:59:54 +00:00
Don't auto-resume video when seeking.
This commit is contained in:
parent
fb244c00b9
commit
321e4ffe9c
@ -169,6 +169,8 @@ struct OverlayWidget::Streamed {
|
|||||||
base::Timer timer;
|
base::Timer timer;
|
||||||
QImage frameForDirectPaint;
|
QImage frameForDirectPaint;
|
||||||
|
|
||||||
|
bool withSound = false;
|
||||||
|
bool pausedBySeek = false;
|
||||||
bool resumeOnCallEnd = false;
|
bool resumeOnCallEnd = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2007,6 +2009,10 @@ void OverlayWidget::createStreamingObjects() {
|
|||||||
this,
|
this,
|
||||||
static_cast<PlaybackControls::Delegate*>(this),
|
static_cast<PlaybackControls::Delegate*>(this),
|
||||||
[=] { waitingAnimationCallback(); });
|
[=] { waitingAnimationCallback(); });
|
||||||
|
_streamed->withSound = _doc->isAudioFile()
|
||||||
|
|| _doc->isVideoFile()
|
||||||
|
|| _doc->isVoiceMessage()
|
||||||
|
|| _doc->isVideoMessage();
|
||||||
|
|
||||||
if (videoIsGifv()) {
|
if (videoIsGifv()) {
|
||||||
_streamed->controls.hide();
|
_streamed->controls.hide();
|
||||||
@ -2261,6 +2267,7 @@ void OverlayWidget::playbackPauseResume() {
|
|||||||
|
|
||||||
void OverlayWidget::restartAtSeekPosition(crl::time position) {
|
void OverlayWidget::restartAtSeekPosition(crl::time position) {
|
||||||
Expects(_streamed != nullptr);
|
Expects(_streamed != nullptr);
|
||||||
|
Expects(_doc != nullptr);
|
||||||
|
|
||||||
if (videoShown()) {
|
if (videoShown()) {
|
||||||
_streamed->info.video.cover = videoFrame();
|
_streamed->info.video.cover = videoFrame();
|
||||||
@ -2270,13 +2277,9 @@ void OverlayWidget::restartAtSeekPosition(crl::time position) {
|
|||||||
auto options = Streaming::PlaybackOptions();
|
auto options = Streaming::PlaybackOptions();
|
||||||
options.position = position;
|
options.position = position;
|
||||||
options.audioId = AudioMsgId(_doc, _msgid);
|
options.audioId = AudioMsgId(_doc, _msgid);
|
||||||
if (_doc->isAnimation()
|
if (!_streamed->withSound) {
|
||||||
|| options.audioId.type() == AudioMsgId::Type::Unknown) {
|
|
||||||
options.mode = Streaming::Mode::Video;
|
options.mode = Streaming::Mode::Video;
|
||||||
options.loop = true;
|
options.loop = true;
|
||||||
_streamingPauseMusic = false;
|
|
||||||
} else {
|
|
||||||
_streamingPauseMusic = true;
|
|
||||||
}
|
}
|
||||||
_streamed->player.play(options);
|
_streamed->player.play(options);
|
||||||
if (_streamingStartPaused) {
|
if (_streamingStartPaused) {
|
||||||
@ -2284,6 +2287,7 @@ void OverlayWidget::restartAtSeekPosition(crl::time position) {
|
|||||||
} else {
|
} else {
|
||||||
playbackPauseMusic();
|
playbackPauseMusic();
|
||||||
}
|
}
|
||||||
|
_streamed->pausedBySeek = false;
|
||||||
|
|
||||||
_streamed->info.audio.state.position
|
_streamed->info.audio.state.position
|
||||||
= _streamed->info.video.state.position
|
= _streamed->info.video.state.position
|
||||||
@ -2296,12 +2300,16 @@ void OverlayWidget::playbackControlsSeekProgress(crl::time position) {
|
|||||||
Expects(_streamed != nullptr);
|
Expects(_streamed != nullptr);
|
||||||
|
|
||||||
if (!_streamed->player.paused() && !_streamed->player.finished()) {
|
if (!_streamed->player.paused() && !_streamed->player.finished()) {
|
||||||
|
_streamed->pausedBySeek = true;
|
||||||
playbackControlsPause();
|
playbackControlsPause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::playbackControlsSeekFinished(crl::time position) {
|
void OverlayWidget::playbackControlsSeekFinished(crl::time position) {
|
||||||
_streamingStartPaused = false;
|
Expects(_streamed != nullptr);
|
||||||
|
|
||||||
|
_streamingStartPaused = !_streamed->pausedBySeek
|
||||||
|
&& !_streamed->player.finished();
|
||||||
restartAtSeekPosition(position);
|
restartAtSeekPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2359,7 +2367,9 @@ void OverlayWidget::playbackResumeOnCall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::playbackPauseMusic() {
|
void OverlayWidget::playbackPauseMusic() {
|
||||||
if (!_streamingPauseMusic) {
|
Expects(_streamed != nullptr);
|
||||||
|
|
||||||
|
if (!_streamed->withSound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player::instance()->pause(AudioMsgId::Type::Voice);
|
Player::instance()->pause(AudioMsgId::Type::Voice);
|
||||||
|
@ -338,7 +338,6 @@ private:
|
|||||||
QString _headerText;
|
QString _headerText;
|
||||||
|
|
||||||
bool _streamingStartPaused = false;
|
bool _streamingStartPaused = false;
|
||||||
bool _streamingPauseMusic = false;
|
|
||||||
bool _fullScreenVideo = false;
|
bool _fullScreenVideo = false;
|
||||||
int _fullScreenZoomCache = 0;
|
int _fullScreenZoomCache = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user