QtWebView - WebRTC - macOS support back to 10.14
-
I develop a cross-platform audio-video app that targets macOS, Windows, Linux, iOS and Android.
I use QtWebView in Qt 6.4.2 to load a WebRTC client that needs access to the camera device.This works fine across the 5 target platforms above (using QtWebEngineView for Windows and Linux), but on macOS there are some subtle variations.
Note: Qt6 is officially supported on macOS back to version 10.14 (see docs). macOS users are particularly prone to sticking on old OS versions (like macOS 10.14 Mojave), especially if they are creator/producer types who rely on old OS versions to run their current setup of audio software. (It's incredibly frustrating for us developers, yes, but that's the reality of things.)Does any Qt/Mac guru out there know what causes the following problem? And how it can be resolved or worked around?
(Note: QtWebEngineView does work where QtWebView fails in this case - but adding webengine to the app deployment increases the installer size from 40mb to 200mb, which users will not appreciate...)PROBLEM
QtWebView on macOS 10.14 does NOT successfully request the Camera permission that allows WebRTC functionality (eg video chat using webcam)REPRODUCTION
I created a minimal test project to demonstrate this:
https://github.com/danryu/webview_camera_test
It simply loads a QML WebView with a WebRTC demo url.
Please try running the project on macOS 10.14 versus 11+.
(NOTE: you may need to add QT_WEBVIEW_PLUGIN=native to the Run environment in order to let the WebView plugin be picked up.)Test Summary:
- macOS 11 and later: WebView requests Camera permission, WebRTC demo successful

- macOS 10.14: WebView does NOT ask for Camera permission, WebRTC demo FAILS

- macOS 11 and later: WebView requests Camera permission, WebRTC demo successful