0

Using PyQt5 QWebEngineView, I cannot use fullScreen when watching video:

import sys from PyQt5 import QtWidgets, QtGui, QtCore from PyQt5.QtWebEngineWidgets import * app=QtWidgets.QApplication(sys.argv) w=QWebEngineView() w.settings().setAttribute(QWebEngineSettings.PluginsEnabled, True) w.settings().setAttribute(QWebEngineSettings.JavascriptEnabl‌​ed, True) w.settings().setAttribute(QWebEngineSettings.FullScreenSuppo‌​rtEnabled, True) w.page().fullScreenRequested.connect(QWebEngineFullScreenReq‌​uest.accept) w.load(QtCore.QUrl('56.com/w94/play_album-aid-14364505_vid-M‌​TQ3NDUxMjY3.html')) w.showMaximized() app.exec_() 

enter image description here

2
  • 56.com/w94/play_album-aid-14364505_vid-M‌​TQ3NDUxMjY3.html or http://www.56.com/w94/play_album-aid-14364505_vid-M‌​TQ3NDUxMjY3.html Commented Nov 16, 2017 at 12:51
  • When you access the link directly it tells me that the place does not exist and redirects me to the main page. Commented Nov 16, 2017 at 12:54

2 Answers 2

1

you can reference bellow code:

m_webView->settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true); connect(m_webView->page(), &QWebEnginePage::fullScreenRequested, this, [this] (QWebEngineFullScreenRequest fullScreenRequest) { fullScreenRequest.accept(); qDebug()<<"UI: fullScreenRequested: "<<fullScreenRequest.toggleOn()<<endl; }); 
Sign up to request clarification or add additional context in comments.

Comments

0

QWebEnginePage::fullScreenRequested signal has an argument named "request" and it has a function named "accept()". So you have to call

request.accept()

but your code uses the type name (QWebEngineFullScreenRequest) and doesn't refer to this exact object.

https://doc.qt.io/qt-5/qwebenginepage.html#fullScreenRequested

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.