#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMediaPlayer>
#include <QtMultimedia/QMultimedia>
#include <QtMultimediaWidgets/QVideoWidget>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->resize(800,480);
QVideoWidget *vid=new QVideoWidget(this);
vid->resize(400,300);
setCentralWidget(vid);
QMediaPlayer *player=new QMediaPlayer(this);
player->setVideoOutput(vid);
player->setMedia(QMediaContent(QUrl::fromLocalFile("e:/0.mp4")));
player->play();
}
MainWindow::~MainWindow()
{
delete ui;
}标签:Qt,vid,player,简易,ui,new,include,MainWindow,读取 From: https://www.cnblogs.com/dq0618/p/17659849.html