2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Using media player for voice / video messages.

Media::Player::Widget displays the current voice / video message
if it is played and the current song otherwise.

It is created when a voice / video message starts and is destroyed
when all the voice / video messages in the playlist are finished.
This commit is contained in:
John Preston
2017-05-21 16:16:39 +03:00
parent 2661fe5cd5
commit 7873cb4373
24 changed files with 325 additions and 192 deletions

View File

@@ -836,7 +836,7 @@ bool File::updateStatusText() const {
if (document->voice()) {
statusSize = FileStatusSizeLoaded;
auto state = Media::Player::mixer()->currentState(AudioMsgId::Type::Voice);
if (state.id == AudioMsgId(document, FullMsgId()) && !Media::Player::IsStopped(state.state) && state.state != State::Finishing) {
if (state.id == AudioMsgId(document, FullMsgId()) && !Media::Player::IsStoppedOrStopping(state.state)) {
statusSize = -1 - (state.position / state.frequency);
realDuration = (state.length / state.frequency);
showPause = (state.state == State::Playing || state.state == State::Resuming || state.state == State::Starting);
@@ -844,7 +844,7 @@ bool File::updateStatusText() const {
} else if (document->song()) {
statusSize = FileStatusSizeLoaded;
auto state = Media::Player::mixer()->currentState(AudioMsgId::Type::Song);
if (state.id == AudioMsgId(document, FullMsgId()) && !Media::Player::IsStopped(state.state) && state.state != State::Finishing) {
if (state.id == AudioMsgId(document, FullMsgId()) && !Media::Player::IsStoppedOrStopping(state.state)) {
statusSize = -1 - (state.position / state.frequency);
realDuration = (state.length / state.frequency);
showPause = (state.state == State::Playing || state.state == State::Resuming || state.state == State::Starting);