Qt6 topics merged with General

Allow WebRTC webcam request using when QtWebEngine

  • How do I Allow WebRTC webcam request in QtWebEngine (using QML plugin or not)?

    My code sample webengine.qml

    import QtQuick 2.1
    import QtQuick.Controls 1.1
    import QtWebEngine 1.0
    ApplicationWindow {
        width: 800
        height: 600
        color: "lightgray"
        visible: true
        WebEngineView {
            id: webview
            url: "https://opentokrtc.com/test"
            anchors.fill: parent

    On my Mac Yosemite, running the command:

     /usr/local/Cellar/qt5/5.4.0/bin/qmlscene webengine.qml 

    but the video won't start because it's waiting for "Allow" camera, but not dialog pops to let me do that.

    In other words, is there a way to programmatically set Chromium Web Engine policy e.g. VideoCaptureAllowed

  • Moderators

    You need to connect to the featurePermissionRequested of the WebView, i.e.

        onFeaturePermissionRequested: {
            grantFeaturePermission(securityOrigin, feature, true);