在QWebEngineView中观看视频时无法使用fullScreen

问题描述 投票:0回答:1

使用PyQt5 QWebEngineView,我在观看视频时无法使用fullScreen:

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_()

python pyqt fullscreen pyqt5 qwebengineview
1个回答
0
投票

QWebEnginePage :: fullScreenRequested信号有一个名为“request”的参数,它有一个名为“accept()”的函数。所以你必须打电话

request.accept()

但是您的代码使用类型名称(QWebEngineFullScreenRequest)并且不引用此确切对象。

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

© www.soinside.com 2019 - 2024. All rights reserved.