Nemeth Attila
Nemeth Attila

Reputation: 143

Youtube video not playing in qt webview

I have this qt code and when I run it displays the video but the video doesn't play and it shows an error like on the image below.

 #include "mainwindow.h"
 #include "ui_mainwindow.h"
 #include <QWebView>
 #include <QNetworkProxyFactory>



    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        QNetworkProxyFactory::setUseSystemConfiguration(true);
        QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
        QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, true);
        ui->webView->load(QUrl("https://www.youtube.com/watch?v=i3DqmnPCYhs"));
    }

    MainWindow::~MainWindow()
    {
        delete ui;
    }

enter image description here

Upvotes: 1

Views: 296

Answers (1)

Nemeth Attila
Nemeth Attila

Reputation: 143

The problem was with the web browser. I was using Firefox I enabled flash and everything, still did not work. After that I tried with Chrome and it worked.

Upvotes: 0

Related Questions