📜  videoStream qt - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:29.337000             🧑  作者: Mango

代码示例1
#include 
#include 
#include 
#include 
#include 
#include 
#include "DemoPlayer.h"
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QWidget *widget=new QWidget;
    widget->resize(400,300);

    QMediaPlayer *player=new QMediaPlayer;
    QVideoWidget *vw= new QVideoWidget;
    QHBoxLayout *layout=new QHBoxLayout;

    layout->addWidget(vw);
    widget->setLayout(layout);
    player->setVideoOutput(vw);
    player->setMedia(QUrl::fromLocalFile("C:/Users/Administrator/Desktop/1minute.mp4"));
    player->play();
    widget->show();
    qDebug()<availableMetaData()<currentMedia().canonicalUrl();

    return a.exec();
}