没有插件报错:DirectShowPlayerService::doRender: Unresolved error code 0x80040266
如果文件路径不对或者文件名是中文的,则会显示如下错误:
DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80004005 ()
参考博客:https://blog.csdn.net/qqwangfan/article/details/52469859
在工程中添加 :QT += multimedia multimediawidgets
头文件:
#include <QVideoWidget>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QVBoxLayout>
#include <QFileDialog>
#include <QDebug>
下载并安装 LAVFilters:https://github.com/Nevcairiel/LAVFilters/releases
installer方式直接按步骤安装
压缩包方式解压右键以管理员运行 install_video.bat 文件
切记:需要重启电脑
完美,没毛病。。。。。。
测试代码:
void MainWindow::player()
{
QString fileName=QFileDialog::getOpenFileName(this,"Open Videos");
QVideoWidget *videoWidget=new QVideoWidget();
this->setCentralWidget(videoWidget);
QMediaPlayer *player=new QMediaPlayer;
player->setVideoOutput(videoWidget);
player->setMedia(QUrl::fromLocalFile(fileName));
player->play();
qDebug()<<fileName;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)