#πŸ”’ help accessing audio to pyqt6webengine

12 messages Β· Page 1 of 1 (latest)

vague saddle
#

Hi i have simple script that run a URL, reason im using python is because the URL require chromium and i do not like chromium browsers so i opt to use python

This is the script,

import os
import sys
from PyQt6.QtCore import QUrl
from PyQt6.QtWidgets import QApplication
from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtWebEngineCore import QWebEnginePage

# chromium flags, GL/desktop failure, angle preference, do remember to check on the chromium flags and nvidia flags, if GBM still fail stay with vulkan in meantime, idk what cause "js fail" < #511 on obsidian write.
os.environ['QTWEBENGINE_CHROMIUM_FLAGS'] = "--no-sandbox --enable-features=WebRTC-PipeWire-Capturer"

# configuration
APP_URL = "http://localhost:18888/"
APP_TITLE = "Viris Decoda"
WINDOW_SIZE = (1280, 800)

# per mission logic
class WebEnginePage(QWebEnginePage):
    def featurePermissionRequested(self, url, feature):
        # Grant permission for microphone 
        if feature == QWebEnginePage.Feature.MediaAudioCapture:
            self.setFeaturePermission(
                url, feature, QWebEnginePage.PermissionPolicy.PermissionGrantedByUser
            )
        # grant permission for audio playback
        elif feature == QWebEnginePage.Feature.MediaAudioPlay:
            self.setFeaturePermission(
                url, feature, QWebEnginePage.PermissionPolicy.PermissionGrantedByUser
            )
        else:
            self.setFeaturePermission(
                url, feature, QWebEnginePage.PermissionPolicy.PermissionDeniedByUser
            )

# MAIN APPLICATION (DO NOT FORGET THE ICON)
if __name__ == "__main__":
    app = QApplication(sys.argv)

    web_view = QWebEngineView()

    page = WebEnginePage(web_view)
    web_view.setPage(page)

    web_view.load(QUrl(APP_URL))
    web_view.setWindowTitle(APP_TITLE)
    web_view.resize(WINDOW_SIZE[0], WINDOW_SIZE[1])
    web_view.show()

    sys.exit(app.exec())

I have checked the URL, and it detects my microphone and speaker when I open it in a browser, but not when I run it through the Python script.

Here’s more information about my setup:

I use an NVIDIA GPU.

I’m on Arch Linux with KDE Plasma.

The last log I get when opening the Python script is:

GBM is not supported with the current configuration. Fallback to Vulkan rendering in Chromium.
pci id for fd 80: 10de:2504, driver (null)
pci id for fd 82: 10de:2504, driver (null)
libEGL warning: pci id for fd 80: 10de:2504, driver (null)

pci id for fd 69: 10de:2504, driver (null)
pci id for fd 82: 10de:2504, driver (null)
libEGL warning: egl: failed to create dri2 screen
pci id for fd 80: 10de:2504, driver (null)
pci id for fd 82: 10de:2504, driver (null)
libEGL warning: egl: failed to create dri2 screen
js: [CVV] is not ready for set audio output.
js: [CVV] is not ready for set audio output.
js: [useWebInfo] clientState is not initialized yet
js: [useWebInfo] this is not web edition
dusky mantleBOT
#

@vague saddle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

vague saddle
#

if there is something i missed feel free to ask

vague saddle
#

Fixed i just needed more chroimum flags

dusky mantleBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

πŸ”’ help accessing audio to pyqt6webengine

restive cypress
#

help accessing audio to pyqt6webengine

vague saddle
#

The fix is

os.environ['QTWEBENGINE_CHROMIUM_FLAGS'] = (
    "--no-sandbox "
    "--enable-features=WebRTC-PipeWire-Capturer "
    "--allow-http-screen-capture "
    "--use-fake-ui-for-media-stream "
    "--enable-logging "
)

do make sure to remvoe --enable-logging if you don't want to clutter your terminal

#

my old solution

# chromium flags, GL/desktop failure, angle preference, do remember to check on the chromium flags and nvidia flags, if GBM still fail stay with vulkan in meantime, idk what cause "js fail" < #511 on obsidian write.
os.environ['QTWEBENGINE_CHROMIUM_FLAGS'] = "--no-sandbox --enable-features=WebRTC-PipeWire-Capturer"

had a goofy typo where i forgot to type ( ) thats on me lmao

#

!close

dusky mantleBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.