简体   繁体   中英

Streaming using pyqt5

I've tried using the pyqt web engine to log into discord.com, everything works fine, but when I try screen sharing, this error is seen:

"Uncaught (in promise) notallowederror: invalid state".

it looks like a JS error, I am not sure how I would solve a js error in pyqt5

def class_runner():
    class WebEnginePage(QWebEnginePage):
        def __init__(self, *args, **kwargs):
            QWebEnginePage.__init__(self, *args, **kwargs)
            self.featurePermissionRequested.connect(self.onFeaturePermissionRequested)

        def onFeaturePermissionRequested(self, url, feature):
            if feature in (QWebEnginePage.MediaAudioCapture, 
                QWebEnginePage.MediaVideoCapture, 
                QWebEnginePage.MediaAudioVideoCapture):
                self.setFeaturePermission(url, feature, QWebEnginePage.PermissionGrantedByUser)
            else:
                self.setFeaturePermission(url, feature, QWebEnginePage.PermissionDeniedByUser)
        

    app = QApplication(sys.argv)
    app.setApplicationName("Discord Lite")
    view = QWebEngineView()
    page = WebEnginePage()
    view.setPage(page)
    view.load(QUrl("https://discord.com/app"))
    view.show()
    scriptDir = os.path.dirname(os.path.realpath(__file__))
    app.setWindowIcon(QIcon(scriptDir + os.path.sep + 'logo4.png'))
    app.exec_()
class_runner()

This is the python code.
I tried looking up other sites and the closest I came to was this GitHub .

turns out you cant, I started using pywebview

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM