Fix initial video duration display.

This commit is contained in:
John Preston 2019-03-05 19:24:55 +04:00
parent b5eb88a32f
commit 22356eb01c
3 changed files with 5 additions and 3 deletions

View File

@ -199,7 +199,7 @@ rpl::producer<crl::time> AudioTrack::playPosition() {
_waitingForData.fire({});
}
_playPosition = std::clamp(
((state.position * 1000 + (state.frequency / 2))
crl::time((state.position * 1000 + (state.frequency / 2))
/ state.frequency),
crl::time(0),
_stream.duration - 1);

View File

@ -662,7 +662,7 @@ Media::Player::TrackState Player::prepareLegacyState() const {
if (duration > 0) {
result.length = duration * crl::time(1000);
} else {
result.length = std::max(result.position, crl::time(0));
result.length = std::max(crl::time(result.position), crl::time(0));
}
}
result.frequency = kMsFrequency;

View File

@ -2211,7 +2211,9 @@ void OverlayWidget::restartAtSeekPosition(crl::time position) {
}
auto options = Streaming::PlaybackOptions();
options.position = position;
if (_doc->isAnimation()) {
options.audioId = AudioMsgId(_doc, _msgid);
if (_doc->isAnimation()
|| options.audioId.type() == AudioMsgId::Type::Unknown) {
options.mode = Streaming::Mode::Video;
options.loop = true;
}