I am using the WebEngineView QML type to render a locally hosted web page which uses the WebRTC HTML media audio capture feature on Qt 5.15.1 (Which is listed among the features available to WebEngineView.
The web page is hosted locally using an nginx server and works perfectly when accessed by other browsers.
When accessing it with WebEngineView, the microphone is not capturing most likely due to the permission to do so not being granted.
There are no errors of any kind that occur in the console when opening the web page with WebEngineView, it simply just does not capture audio from the system input source.
Does anybody know how to properly go about granting this particular feature permission via the Qt WebEngineView or by some other means?
Here's what my code looks like.
main.qml
import QtQuick 2.15
import QtQuick.Window 2.15
import QtWebEngine 1.10
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
WebEngineView {
id: view
anchors.fill: parent
url: "http://127.0.0.1/audio.html"
Component.onCompleted: {
/* heres my attempt to grant permission
to use the microphone, which did not
seem to have any affect */
view.grantFeaturePermission("http://127.0.0.1",
MediaAudioCapture, true)
}
}
}
Does anybody know how to properly go about granting this particular feature permission via the Qt WebEngineView or by some other means?
** EDIT **
audio.html (relevant code)
<!DOCTYPE html>
<head></head><body><div id="results"></div><script>
window.rc = new webkitSpeechRecognition()
rc.continuous = true;
rc.onresult = function(result) {
document.querySelector("#results").innerHTML = result.results[0][0].transcript;
}
rc.start();
</script></body></html>