What I want to achieve is to have a button or a widget to be displayed on top of a QVideoWidget. Following this example of a sample video player, I tried to add a button on top of the QVideoWidget with the following code
self.button= QPushButton(videoWidget)
The button is displayed properly just as it should, but once I start playing the video file I open, the button disappears. I noticed if I hover my mouse over the location of the button, it briefly reappears before it disappears again, which makes me think that the button is being hidden by the QMediaPlayer which is being rerendered on top of everything for every frame.
How can I keep the button on top while the video is playing?
That is a known problem since the drawing of the video is not directly done by Qt but OpenGL, a solution is to have a widget where the QVideoWidget is placed and in that widget place the button:
Code:
Output: