connected vlc to play audio
This commit is contained in:
parent
20094b0cf2
commit
71f7652a8a
4 changed files with 44 additions and 19 deletions
|
|
@ -2,19 +2,20 @@
|
|||
|
||||
#include <QDebug>
|
||||
#include <models/MusicModel.h>
|
||||
#include <VLCQtCore/Audio.h>
|
||||
#include <VLCQtCore/MediaPlayer.h>
|
||||
|
||||
MusicController::MusicController(QObject *parent) : QObject(parent)
|
||||
{
|
||||
mVlc = new VlcInstance(VlcCommon::args(), this);
|
||||
mModel = new MusicModel(mVlc, this);
|
||||
mPlayer = new VlcMediaPlayer(mVlc);
|
||||
|
||||
connect(mPlayer, &VlcMediaPlayer::error, [this](){
|
||||
qDebug() << "playerError";
|
||||
});
|
||||
mPlayer = new VlcMediaListPlayer(mVlc);
|
||||
|
||||
connect(mModel, &MusicModel::navigateTo, this, &MusicController::navigateTo);
|
||||
connect(mModel, &MusicModel::play, mPlayer, &VlcMediaListPlayer::play);
|
||||
connect(mModel, &MusicModel::pause, mPlayer->mediaPlayer(), &VlcMediaPlayer::pause);
|
||||
connect(mModel, &MusicModel::navigateTo, [this](NavigationItemModel*){
|
||||
if(mModel->isPlaying()) mModel->playPause();
|
||||
});
|
||||
}
|
||||
|
||||
MusicController::~MusicController()
|
||||
|
|
@ -25,7 +26,8 @@ MusicController::~MusicController()
|
|||
void MusicController::initPlayer(NavigationItemModel *item)
|
||||
{
|
||||
mModel->init(item);
|
||||
mPlayer->open(mModel->getMedia());
|
||||
mPlayer->stop();
|
||||
mPlayer->setMediaList(mModel->getMedia());
|
||||
}
|
||||
|
||||
void MusicController::setContext(QQmlContext *context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue