Page 1 of 1

Embedding VLC in a PyQt4 app

Posted: 16 Feb 2010 21:07
by daimoner
Hello,

I'm trying to embed a VLC player in a python application based on PyQt4. Currently, I'am able to display a video using VLC Python bindings but only in a separate windows (title: VLC Direct3D output) with the following code:

Code: Select all

import sys from PyQt4 import Qt import vlc app = Qt.QApplication(sys.argv) video = Qt.QWidget() video.setMinimumSize(300, 300) path="xxx" instance=vlc.Instance() media=instance.media_new(path) player=instance.media_player_new() player.set_media(media) #Is it correct? Without these 2 lines I get a separate video display otherwise I see nothing... hwnd = video.winId().__hex__() player.set_hwnd(hwnd); player.play() video.show() app.exec_()
Any idea why this does not work?

Thanks!

Re: Embedding VLC in a PyQt4 app

Posted: 17 Feb 2010 18:06
by ppaulojr
I have the same problem.

Plus: the input in Direct 3D window is not forwarded to libvlc neither is used as hotkey

Re: Embedding VLC in a PyQt4 app

Posted: 05 Aug 2010 11:29
by dvdjimmy
Dear all,

it seems that this is still an unsolved issue. I have exactly the same behaviour right now.

Here is the code I use

Code: Select all

import sys import sys from PyQt4 import Qt import vlc app = Qt.QApplication(sys.argv) video = Qt.QWidget() video.setMinimumSize(300, 300) path="test" instance=vlc.Instance() media = instance.media_new(path) player=instance.media_player_new() player.set_media(media) player.play() video.show() app.exec_()
An extra VLC Direct3D Output window is displayed in which the video is running. What do I have to change to display it directly in the widget?

Thank you in advance for your help.
dvdjimmy

Re: Embedding VLC in a PyQt4 app

Posted: 05 Aug 2010 11:54
by dvdjimmy
I found a solution. The Problem is, that you have to tell VLC to which window it should render. Just add these two lines to your code and it works fine.

Code: Select all

hwnd = int(video.winId()) player.set_hwnd(hwnd)
Its very important that you convert the winId() to int. Otherwise it will not work!!

Happy coding..

dvdjimmy