void MultimediaManager::playItem(int index) { const multimediamanager::MediaSources…
- User
void MultimediaManager::playItem(int index) { const multimediamanager::MediaSources currentSource = m_sourceManager->GetCurrentSource(); if (m_sourceManager->IsStorageSource(currentSource) == true) { auto sourceHandler = m_sourceManager->GetMediaStorageSourceHandler(currentSource); const int currentIndex = sourceHandler->GetCurrentMediaIndex();
// Check if index is valid considering our nowPlayingList const auto& nowPList = sourceHandler->GetNowPlayingSongList(); if ((index < 0) || (nowPList.count() <= index)) { qInfo() << "Index is invalid. NowP Count is" << nowPList.count() << "Index" << index; m_playerInterface->SetPlaybackStatus(multimediamanager::PlaybackStatus_t::PB_STOPPED); } else { // Set LastUserPlaybackStatus sourceHandler->SetLastUserPlaybackStatus(multimediamanager::PlaybackStatus_t::PB_PLAYING); qInfo() << "index: " << index << " currentIndex:" << currentIndex; qInfo() << "current media source: " << currentSource; qint64 lastPosition = 0; m_playerInterface->SetPlayingIndex(index); m_playerInterface->SetPlaybackStatus(multimediamanager::PlaybackStatus_t::PB_PLAYING); if (currentIndex == index) { if (sourceHandler != nullptr) { lastPosition = sourceHandler->GetPlaybackProgress().ElapsedMsec; } m_playerInterface->SetPlaybackStatus(multimediamanager::PlaybackStatus_t::PB_PAUSED); qInfo() << " resume playing from last position (" << (lastPosition) << ")" << multimediamanager::helper::millisecToString(lastPosition); auto seekAndPlay = [this, lastPosition]() { // TODO Improve SeekAndPlay to take also current source: if seekable changes but source is not the same, then do nothing! // Or add a StateMachine for playing status const Art::PlaybackStatus pbStatus = m_audioPlayer->playbackStatus(); const bool seekable = m_audioPlayer->isSeekable(); if (seekable && Art::PlaybackStatus::kStopped != pbStatus) { qInfo() << "resume playing from last position " << multimediamanager::helper::millisecToString(lastPosition) << " and disconnect"; seekTo(static_cast<int>(lastPosition)); m_playerInterface->SetPlaybackStatus(multimediamanager::PlaybackStatus_t::PB_PLAYING); } }; SeekAndPlay::doSeekAndPlay(seekAndPlay, m_audioPlayer, this); } } } else if (m_sourceManager->IsBTSource(currentSource) == true) { m_bluetoothPlayer->SetPlayingIndex(index); }}
- Assistant
- User
this is a a function from multimediamanager.cpp. i need to know where exactly it may call some function from a library called mediaplayermanager. Also, i want to know which line of code is responsible for playing the media. you can promt me to go and check specific function definition and i will do so.
- Assistant