Un par de fallos
This commit is contained in:
@@ -109,9 +109,9 @@ public:
|
||||
Q_INVOKABLE void prepareNext(const QUrl &url) {
|
||||
// Desplegar hilo que descargue y gestione el mediaplayer
|
||||
|
||||
Logger::info(url.toString().toStdString());
|
||||
Logger::info("Loading: " + url.toString().toStdString());
|
||||
m_nextPlayer->setSource(url);
|
||||
|
||||
|
||||
// Para que se quede listo
|
||||
m_nextPlayer->play();
|
||||
m_nextPlayer->pause();
|
||||
@@ -119,6 +119,8 @@ public:
|
||||
}
|
||||
|
||||
Q_INVOKABLE void swapAndPlay() {
|
||||
m_activePlayer->stop();
|
||||
|
||||
std::swap(m_activePlayer, m_nextPlayer);
|
||||
|
||||
m_activePlayer->play();
|
||||
@@ -149,8 +151,10 @@ public:
|
||||
int n_ele = m_queue.size();
|
||||
|
||||
m_queue.push_back(url);
|
||||
if (m_nextPlayer->source() == QUrl()) {
|
||||
prepareNext(m_queue.at(m_queue_index));
|
||||
|
||||
if (!m_playing) {
|
||||
m_playing = true;
|
||||
prepareNext(QUrl::fromLocalFile(m_queue.at(m_queue_index)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +164,7 @@ public:
|
||||
m_activePlayer->pause();
|
||||
else
|
||||
m_activePlayer->play();
|
||||
|
||||
|
||||
emit playingStateChanged();
|
||||
}
|
||||
|
||||
@@ -200,9 +204,6 @@ private:
|
||||
|
||||
case QMediaPlayer::BufferedMedia:
|
||||
Logger::info("Media fully buffered");
|
||||
if (!isActive) {
|
||||
Logger::info("Next media fully buffered");
|
||||
}
|
||||
break;
|
||||
|
||||
case QMediaPlayer::EndOfMedia:
|
||||
@@ -211,6 +212,9 @@ private:
|
||||
m_queue_index++;
|
||||
swapAndPlay();
|
||||
}
|
||||
else {
|
||||
m_playing = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user