我正在玩here的基于WX的视频播放器的vlc-python示例代码
操作系统是Windows 10
一切顺利,除了媒体在播放开始之前创建的单独窗口中播放。
我使用以下代码创建了播放器实例:
self.videopanel = wx.Panel(self, -1)
...
self.Instance = vlc.Instance('--verbose 3')
self.player = self.Instance.media_player_new()
self.player.set_xwindow(self.videopanel.GetHandle())
并得到以下与'vout'相关的调试行:
... [skipped]
[000000000855a530] main window debug: looking for vout window module matching "embed-xid,any": 3 candidates
... [skipped]
[000000000855a530] main window debug: no vout window modules matched
... [skipped]
[00000000085aa8c0] main vout display debug: looking for vout display module matching "any": 12 candidates
... [skipped]
[00000000085aa8c0] main vout display debug: using vout display module "direct3d11"
谁能给我一个关于如何强制libvlc使用WX媒体窗口的线索?
非常感谢!
Rubberducked答案:)对于Windows,应该使用set_hwnd
API调用,而不是set_xwindow
(用于X11系统)
if os.name == 'nt':
self.player.set_hwnd(self.videopanel.GetHandle())
else:
self.player.set_xwindow(self.videopanel.GetHandle())
谢谢,全部!