PyQt5:"全屏不可用"将YouTube视频作为iframe嵌入QWebEngineView中

时间:2017-10-31 14:42:05

标签: python python-3.x pyqt pyqt5 qwebengineview

我试图在QWebEngineView中嵌入YouTube视频,视频加载正常但是全屏按钮被禁用此消息"全屏不可用"甚至认为嵌入代码确实有" allowfullscreen"

代码段:

web = QWebEngineView()
htmlString = """
            <iframe width="560" height="315" src="https://www.youtube.com/embed/L0MK7qz13bU?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
             """
web.setHtml(htmlString, QUrl(baseUrl))

1 个答案:

答案 0 :(得分:1)

要启用全屏,必须启用FullScreenSupportEnabled属性并接受页面的fullScreenRequested顺序。

authServiceMock.AuthenticateAsync(Arg.Any<HttpContext>(), Arg.Any<string>())
    .Returns(Task.FromResult(AuthenticateResult.Success()));
providerMock.GetService(typeof(IAuthenticationService))
    .Returns(authServiceMock);
httpContextMock.RequestServices.Returns(providerMock);

//...

截图:

enter image description here