Can't hide VLC player from callback after it reaches 'Ended' State, in python / gtk3 / windows
Posted: 15 Feb 2016 19:28
Hello everyone.
I'm trying to get video support to work in a cross-platform PDF presentation tool written in python (called pympress). I figured VLC was a good way to go.
I manage to get a video to play within an overlay to show/hide it whenever I want. It can be resized, removed, paused, stopped, etc, mostly no problems on all platforms.
the bug
However, on windows only, I get the following:
- the VLC video output appears to be 'on top' of my Gtk widgets such that those do not receive click events anymore. I suppose this is by design (?) and is not much of a problem in itself anyway.
- The following error message: "core vout display error: Failed to set on top"
- Same good behaviour *except* once VLC is done playing. In that case, when the player reports it has the state 'ended', and as soon as the MediaPlayerEndReached callback is called, the zone where the video was played becomes 'unresponsive', that is Gtk widgets can't draw on that area anymore, it is not resizable, etc.
reproducible example
I have created a minimal example, available here: https://gist.github.com/Cimbali/86a081e78b0ffc691b50 (I usually test it with the following very short video: https://cimba.li/video.mpeg but it should be reproducible with any file)
Current behaviour:
- after the file is done playing, the last frame remains visible
- if the window is moved or another is put on top of it, this "last frame" zone is filled with garbage
- pressing stop, i.e. calling player.stop(), (while the video is playing or after the video is done playing) avoids (resp. fixes) this weird effect
- calling player.stop() from the MediaPlayerEndReached callback (in this example, the function VLCVideoDA.hide) freezes the whole program
Desired behaviour:
- after the file is done playing, the area where the video played goes back to showing what was behind it, as before it played (in this case: black), without user intervention
questions
So my questions are: what happens here? Why can't I call player.stop() within the callback? How can I achieve the desired behaviour?
references
Versions of the software I'm using are:
- Windows 7
- python 3.4.3 (64b), this was verified with python 2.7 (64b) as well
- Gtk+3 from pygobject for windows (https://sourceforge.net/projects/pygobjectwin32/) version 3.18.2
- VLC 2.2.2 (64b)
- python-vlc 1.1.2 (as distributed through pip)
I'm trying to get video support to work in a cross-platform PDF presentation tool written in python (called pympress). I figured VLC was a good way to go.
I manage to get a video to play within an overlay to show/hide it whenever I want. It can be resized, removed, paused, stopped, etc, mostly no problems on all platforms.
the bug
However, on windows only, I get the following:
- the VLC video output appears to be 'on top' of my Gtk widgets such that those do not receive click events anymore. I suppose this is by design (?) and is not much of a problem in itself anyway.
- The following error message: "core vout display error: Failed to set on top"
- Same good behaviour *except* once VLC is done playing. In that case, when the player reports it has the state 'ended', and as soon as the MediaPlayerEndReached callback is called, the zone where the video was played becomes 'unresponsive', that is Gtk widgets can't draw on that area anymore, it is not resizable, etc.
reproducible example
I have created a minimal example, available here: https://gist.github.com/Cimbali/86a081e78b0ffc691b50 (I usually test it with the following very short video: https://cimba.li/video.mpeg but it should be reproducible with any file)
Current behaviour:
- after the file is done playing, the last frame remains visible
- if the window is moved or another is put on top of it, this "last frame" zone is filled with garbage
- pressing stop, i.e. calling player.stop(), (while the video is playing or after the video is done playing) avoids (resp. fixes) this weird effect
- calling player.stop() from the MediaPlayerEndReached callback (in this example, the function VLCVideoDA.hide) freezes the whole program
Desired behaviour:
- after the file is done playing, the area where the video played goes back to showing what was behind it, as before it played (in this case: black), without user intervention
questions
So my questions are: what happens here? Why can't I call player.stop() within the callback? How can I achieve the desired behaviour?
references
Versions of the software I'm using are:
- Windows 7
- python 3.4.3 (64b), this was verified with python 2.7 (64b) as well
- Gtk+3 from pygobject for windows (https://sourceforge.net/projects/pygobjectwin32/) version 3.18.2
- VLC 2.2.2 (64b)
- python-vlc 1.1.2 (as distributed through pip)