Reputation: 842
I'm trying to embed a youtube video in a QWebEngineView, the video loads fine but the fullscreen button is disabled with this message "Fullscreen is unavailable" even thought the embed code does have "allowfullscreen"
Code snippet:
web = QWebEngineView()
htmlString = """
<iframe width="560" height="315" src="https://www.youtube.com/embed/L0MK7qz13bU?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
"""
web.setHtml(htmlString, QUrl(baseUrl))
Upvotes: 2
Views: 1608
Reputation: 243897
To enable the full screen it is necessary to enable the FullScreenSupportEnabled attribute and accept the fullScreenRequested order of the page.
if __name__ == '__main__':
app = QApplication(sys.argv)
web = QWebEngineView()
web.settings().setAttribute(QWebEngineSettings.FullScreenSupportEnabled, True)
web.page().fullScreenRequested.connect(lambda request: request.accept())
baseUrl = "local"
htmlString = """
<iframe width="560" height="315" src="https://www.youtube.com/embed/L0MK7qz13bU?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
"""
web.setHtml(htmlString, QUrl(baseUrl))
web.show()
sys.exit(app.exec_())
Screenshot:
Upvotes: 2