0

我正在尝试在 vlc 3.0.11.1 (macOS mojave 10.14.6) 中打开一个 youtube 流当我运行脚本时,一个 python 窗口启动但之后没有任何反应在终端中:[00007fa7eff66ae0] videotoolbox decoder: Using Video Toolbox to解码“h264”[00007fa7eff66ae0] videotoolbox 解码器:vt cvpx 色度:420v

这是我的代码:

import pafy
import vlc
import sys

url = "https://www.youtube.com/watch?v=hTWKbfoikeg"

video = pafy.new(url)
best = video.getbest()
i = vlc.Instance()
media = vlc.MediaPlayer(best.url)
if sys.platform == "darwin":
    from PyQt6 import QtCore
    from PyQt6 import QtGui
    from PyQt6 import QtWidgets

    vlcApp =QtWidgets.QApplication(sys.argv)
    vlcWidget = QtWidgets.QFrame()
    vlcWidget.resize(700, 700)
    vlcWidget.show()
    media.set_nsobject(int(vlcWidget.winId()))
media.play()

while True:
     pass
4

0 回答 0