我正在开发一个显示多个 vlc 流 (rtsp) 的应用程序,通过双击其中一个,流应该全屏显示。该应用程序是使用 pyqt5 和 vlc-qt 的 python 3.7。
代码如下:
import sys
import vlc
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtPrintSupport import *
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.sizeHint = lambda: QSize(1280, 900)
self.move(100, 10)
self.videoFrame = QFrame()
self.setCentralWidget(self.videoFrame)
self.vlcInstance = vlc.Instance(['--video-on-top'])
self.videoPlayer = self.vlcInstance.media_player_new()
self.videoPlayer.set_mrl("rtsp://xxx.xxx.xxx.xxx", "network-caching=300")
self.videoPlayer.audio_set_mute(True)
if sys.platform.startswith('linux'): # for Linux using the X Server
self.videoPlayer.set_xwindow(self.videoFrame.winId())
elif sys.platform == "win32": # for Windows
self.videoPlayer.set_hwnd(self.videoFrame.winId())
elif sys.platform == "darwin": # for MacOS
self.videoPlayer.set_nsobject(int(self.videoFrame.winId()))
self.videoPlayer.play()
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
app.setApplicationName("VLC Test")
window = MainWindow()
app.exec_()
双击视频时,会出现以下控制台消息:
[000001e0a128e630] mmdevice 音频输出错误:无法初始化 COM(错误 0x80010106) [000001e0a12c8710] mmdevice 音频输出错误:无法初始化 COM(错误 0x80010106) [000001e0a2927420] main vout 显示错误:无法设置全屏
双击时出现“设置全屏失败”消息。有谁知道问题可能是什么?
提前致谢