MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / handleAudioUpdate

Method handleAudioUpdate

Telegram/SourceFiles/mainwidget.cpp:857–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857void MainWidget::handleAudioUpdate(const Media::Player::TrackState &state) {
858 using State = Media::Player::State;
859 const auto document = state.id.audio();
860 const auto item = session().data().message(state.id.contextId());
861 if (!Media::Player::IsStoppedOrStopping(state.state)) {
862 const auto ttlSeconds = item
863 && item->media()
864 && item->media()->ttlSeconds();
865 if (!ttlSeconds) {
866 createPlayer();
867 }
868 } else if (state.state == State::StoppedAtStart) {
869 Media::Player::instance()->stopAndClose();
870 }
871
872 if (item) {
873 session().data().requestItemRepaint(item);
874 }
875 if (document) {
876 if (const auto items = InlineBots::Layout::documentItems()) {
877 if (const auto i = items->find(document); i != items->end()) {
878 for (const auto &item : i->second) {
879 item->update();
880 }
881 }
882 }
883 }
884}
885
886void MainWidget::closeBothPlayers() {
887 if (_player) {

Callers

nothing calls this directly

Calls 14

IsStoppedOrStoppingFunction · 0.85
documentItemsFunction · 0.85
audioMethod · 0.80
ttlSecondsMethod · 0.80
requestItemRepaintMethod · 0.80
instanceFunction · 0.50
messageMethod · 0.45
dataMethod · 0.45
contextIdMethod · 0.45
mediaMethod · 0.45
stopAndCloseMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected