Vlc 无法在 PyQt5 中使用 framelesswindow 和透明/半透明背景 [英] Vlc won't work with framelesswindow and transparent/translucent background in PyQt5
本文介绍了Vlc 无法在 PyQt5 中使用 framelesswindow 和透明/半透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制作一个用 vlc 播放视频的窗口.这是我的代码
i am making a window which plays video with vlc. Here is my code
from PyQt5 import QtWidgets,QtCore,QtGui
import vlc
class Player(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.resize(600,400)
self.mainframe=QtWidgets.QFrame(self)
self.setCentralWidget(self.mainframe)
self.mainframe.setStyleSheet("background:grey;border-radius:15px;")
self.videoframe=QtWidgets.QFrame(self.mainframe)
self.videoframe.setGeometry(10,10,580,380)
self.videoframe.setStyleSheet("background:#333333")
'''
If i want to set transparent background and frameless window,video wont display only audio plays
'''
# self.setWindowFlags(
# QtCore.Qt.FramelessWindowHint
# | QtCore.Qt.WindowStaysOnTopHint )
# self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
self.instance=vlc.Instance()
self.player = self.instance.media_player_new()
self.player.set_hwnd(int(self.videoframe.winId()))
media = self.instance.media_new('C:/Users/mishra/Downloads/Video/despacito.mp4')
media.parse()
self.player.set_media(media)
self.player.play()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
window = Player()
window.show()
sys.exit(app.exec_())
如果我设置,我只能听到音频播放,但不能听到视频
i can hear only audio playing but no video if i set
self.setWindowFlags(
QtCore.Qt.FramelessWindowHint
| QtCore.Qt.WindowStaysOnTopHint )
self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
它也抛出了很多错误,但那个错误不影响.我得到的错误是
It also throws a lot of errors but that error does not affect.The errors i got is
[00757578] mmdevice audio output error: cannot initialize COM (error 0x80010106)
[02620b80] mmdevice audio output error: cannot initialize COM (error 0x80010106)
[043ccc28] direct3d11 vout display error: Could not Create the D3D11 device. (hr=0x80004001)
[043ccc28] direct3d11 vout display error: Direct3D11 could not be opened
[043ccc28] direct3d11 vout display error: SetThumbNailClip failed: 0x800706f4
[025fc198] d3d11va generic error: D3D11CreateDevice failed. (hr=0x80004001)
[025fc198] d3d11va generic error: Failed to create device
[043ccc28] direct3d9 vout display error: SetThumbNailClip failed: 0x800706f4
[04384af8] direct3d11 vout display error: Could not Create the D3D11 device. (hr=0x80004001)
[04384af8] direct3d11 vout display error: Direct3D11 could not be opened
[04384af8] direct3d11 vout display error: SetThumbNailClip failed: 0x800706f4
[025fbe38] dxva2 generic error: FindVideoServiceConversion failed
[04384af8] direct3d9 vout display error: SetThumbNailClip failed: 0x800706f4
[04384af8] direct3d11 vout display error: Could not Create the D3D11 device. (hr=0x80004001)
[04384af8] direct3d11 vout display error: Direct3D11 could not be opened
[04384af8] direct3d11 vout display error: SetThumbNailClip failed: 0x800706f4
有人知道怎么解决吗?
推荐答案
这也是 python-VLC github 的一个问题https://github.com/oaubert/python-vlc/issues/155
This is also an issue at python-VLC github https://github.com/oaubert/python-vlc/issues/155
这篇关于Vlc 无法在 PyQt5 中使用 framelesswindow 和透明/半透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文