McV
McV

Reputation: 99

Being run within an wxpython project, libvlc plays media in a separate window

I'm playing with the vlc-python example code for WX-based video player from here

The OS is Windows 10

Everything works smooth, except the media is played in a separate window created right before the playing starts.

I created the player instance with this code:

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())

and got the following debug lines related to 'vout' stuff:

... [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"

Can anyone give me a clue on how to force libvlc to use the WX media window?

Thanks a lot!

Upvotes: 0

Views: 344

Answers (1)

McV
McV

Reputation: 99

Rubberducked the answer :) For Windows, the set_hwnd API call should be used, not set_xwindow (which is for X11 systems)

if os.name == 'nt':
    self.player.set_hwnd(self.videopanel.GetHandle())
else:
    self.player.set_xwindow(self.videopanel.GetHandle())

Thanks, all!

Upvotes: 1

Related Questions