2

我想使用带有互联网链接的 QMediaplayer 播放视频。我试图通过将互联网链接传递给“setMedia”函数来做到这一点,但发生了错误:

“DirectShowPlayerService::doRender:未解决的错误代码 80040218”

示例代码是:

#include "mainwindow.h"
#include <QApplication>
#include <QMediaPlayer>
#include <QVideoWidget>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //MainWindow w;
    //w.show();

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

    player->setVideoOutput(vw);
    player->setMedia(QUrl("http://21.179.127.116/Katy%20Perry%20-%20Roar%20(Official).mp4"));

    vw->setGeometry(100,100,300,400);
    vw->show();

    player->play();

    qDebug()<<player->state();

    return a.exec();
}

我正在使用 Qt Creator 3.5.1(企业版)

4

0 回答 0