Howto disable webrtc webview for pyqt5

Heads up! You've already completed this tutorial.

Maria_Medina | 2020-11-27 22:40:32 UTC | #1

please tell me how can I turn off WebRTC on pyqt5 through webview


martin | 2020-12-04 20:13:54 UTC | #2

Hi @Maria_Medina

The way these things are usually controlled is through web settings, e.g.

python
webview.page().settings().setAttribute(<setting>, <value>) 

The only thing I can find related to WebRTC in Qt's browser is on this page

python
QWebEngineSettings.WebRTCPublicInterfacesOnly

...which " Limits WebRTC to public IP addresses only." That doesn't seem to be what you're looking for.

Create GUI Applications with Python & Qt6 by Martin Fitzpatrick — (PyQt6 Edition) The hands-on guide to making apps with Python — Over 15,000 copies sold!

More info Get the book

The documentation here mentions web features, for example this list which would allow you to disable video/audio capture. Is that what you're looking for?

1:1 Coaching & Tutoring for your Python GUIs project
Martin Fitzpatrick Python GUIs Coaching & Training
60 mins ($195) Book Now

1:1 Python GUIs Coaching & Training

Comprehensive code reviewBugfixes & improvements • Maintainability advice and architecture improvements • Design and usability assessment • Suggestions and tips to expand your knowledgePackaging and distribution help for Windows, Mac & Linux • Find out more.

In that case, it looks like you need to handle the .featurePermissionRequested signal on the QWebEnginePage -- if you do not accept it, it should not be enabled. I can't see how to disable this from the load however.

Packaging Python Applications with PyInstaller by Martin Fitzpatrick — This step-by-step guide walks you through packaging your own Python applications from simple examples to complete installers and signed executables.

More info Get the book


Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak
Martin Fitzpatrick

Howto disable webrtc webview for pyqt5 was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Martin founded PythonGUIs to provide easy to follow GUI programming tutorials to the Python community. He has written a number of popular Python books on the subject.