sudo apt update
sudo apt install build-essential clang
sudo apt install qtcreator qtbase5-dev qt5-qmake cmake
sudo apt install qtwebengine5-dev qtmultimedia5-dev
sudo apt install git
sudo apt-get install open-vm-tools-desktop
git config --global http.sslVerify false

qmake -v

Using Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu

配置webrtc相关

sudo apt install libqt5webengine5 
sudo apt install libqt5webenginewidgets5
sudo apt install libqt5multimediawidgets5

增加权限相关的控制,增加自签名证书的错误忽略.

#include <QApplication>
#include <QUrl>
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QWebEngineCertificateError>

class WebEnginePage: public QWebEnginePage{
    Q_OBJECT
public:
    WebEnginePage(QObject *parent = Q_NULLPTR):QWebEnginePage(parent){
        connect(this, &WebEnginePage::featurePermissionRequested, this, &WebEnginePage::onFeaturePermissionRequested);
    }
private Q_SLOTS:
    void onFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature){

        if(feature  == QWebEnginePage::MediaAudioCapture
                || feature == QWebEnginePage::MediaVideoCapture
                || feature == QWebEnginePage::MediaAudioVideoCapture)
            setFeaturePermission(securityOrigin, feature, QWebEnginePage::PermissionGrantedByUser);
        else
            setFeaturePermission(securityOrigin, feature, QWebEnginePage::PermissionDeniedByUser);
    }
protected:
    bool certificateError(const QWebEngineCertificateError &error){
        return error.isOverridable();
    }
};
本文链接地址:https://const.net.cn/756.html

标签: none

添加新评论