#ifndef DEMOPLAYER_H_#define DEMOPLAYER_H_#include <QMainWindow>class VlcInstance;class VlcMedia;class VlcMediaPlayer;class DemoPlayer : public QMainWindow{Q_OBJECTpublic: explicit DemoPlayer(QWidget *parent = 0);private: VlcInstance *_instance; VlcMedia *_media; VlcMediaPlayer *_player;};#endif // DEMOPLAYER_H_
#include <vlc-qt/Common.h>#include <vlc-qt/Instance.h>#include <vlc-qt/Media.h>#include <vlc-qt/MediaPlayer.h>#include "DemoPlayer.h"DemoPlayer::DemoPlayer(QWidget *parent) : QMainWindow(parent), _media(0){ _instance = new VlcInstance(VlcCommon::args(), this); _media = new VlcMedia("C:/promo/repeat.mp4", true, _instance); _player = new VlcMediaPlayer(_instance); _player->open(_media); _player->play();}
#include <QApplication>#include "DemoPlayer.h"int main(int argc, char *argv[]){ QApplication app(argc, argv); DemoPlayer mainWindow; mainWindow.show(); return app.exec();}
TARGET = demo-playerTEMPLATE = appQT += widgetsSOURCES += main.cpp\ DemoPlayer.cppHEADERS += DemoPlayer.hLIBS += -lvlc-qt -lvlc-qt-widgetsLIBS += -LC:\vlc\lib -lvlc-qt -lvlc-qt-widgetsINCLUDEPATH += C:\vlc\include
#include <vlc-qt/Common.h>#include <vlc-qt/Instance.h>#include <vlc-qt/Media.h>#include <vlc-qt/MediaPlayer.h>#include <vlc-qt/MediaListPlayer.h>#include <vlc-qt/MediaList.h>#include <vlc-qt/WidgetVideo.h>#include "DemoPlayer.h"#include <QtWidgets>DemoPlayer::DemoPlayer(QWidget *parent) : QMainWindow(parent), _videowidget(0), _media(0){ _instance = new VlcInstance(VlcCommon::args(), this); _media = new VlcMedia("C:/promo/repeat.mp4", true, _instance); _player = new VlcMediaPlayer(_instance); _videowidget = new VlcWidgetVideo(_player,this); _player->setVideoWidget(_videowidget); _videowidget->show(); _player->open(_media); _player->play();}