Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Enable Codecs in QtWebEngine using qmake on Mac
Forum Updated to NodeBB v4.3 + New Features

Enable Codecs in QtWebEngine using qmake on Mac

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 199 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NineswissN Offline
    NineswissN Offline
    Nineswiss
    wrote on last edited by
    #1

    I am trying to work out how to set "use_proprietary_codecs" within my QtQuick app. I have got QtWebEngine working but need to be able to play mp4 h.264 etc (and widevine but I can work on that next).
    My code so far:
    .pro

    QT += quick
    QT += webenginequick
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    

    main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QtWebEngineQuick>
    
    
    int main(int argc, char *argv[])
    {
    #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    #endif
    
    
        QGuiApplication app(argc, argv);
    QtWebEngineQuick::initialize();
        QQmlApplicationEngine engine;
        const QUrl url(QStringLiteral("qrc:/main.qml"));
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                         &app, [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
                QCoreApplication::exit(-1);
        }, Qt::QueuedConnection);
        engine.load(url);
    
        return app.exec();
    }
    
    

    main.qml

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtWebEngine
    
    Window {
            width: 1024
            height: 750
            visible: true
    
            WebEngineView {
                id: webViewer
                width: parent.width
                height: parent.height-60
                y: 60
                url: "https://dribbble.com"
            }
    }
    
    

    Anyone able to help?

    1 Reply Last reply
    0
    • NineswissN Offline
      NineswissN Offline
      Nineswiss
      wrote on last edited by
      #2

      I worked it out.
      I installed qt via brew and added
      to main.cpp

      qputenv("--webEngineArgs","--webengine-proprietary-codecs");
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved