首页 > 学院 > 开发设计 > 正文

Window 下 Qt5 使用QMediaplayer 进行视频播放 流播放问题

2019-11-08 00:53:42
字体:
来源:转载
供稿:网友
复制代码
 1 int main(int argc, char *argv[]) 2 { 3     Qapplication a(argc, argv); 4  5  6        QWidget *widget = new QWidget; 7         widget->resize(400, 300);   // 8  9         QVBoxLayout *layout = new QVBoxLayout;10         QMediaPlayer* player = new QMediaPlayer;11         QVideoWidget* vw = new QVideoWidget;12 13         layout->addWidget(vw);14         widget->setLayout(layout);15 16         player->setVideoOutput(vw);17 18         QFile file("123.mp4");19         if(!file.open(QIODevice::ReadOnly))20             qDebug() << "Could not open file";21 22         player->setMedia(QUrl::fromLocalFile("123.mp4"));23         player->play();24         widget->show();25 26     return a.exec();27 }复制代码

出现问题

      

     解决方法:

      window 下下载k-lite 即可解决此类   转码问题


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表