How to duplicate video output with PySide6?
-
Hello,
I am developing a video-slides player, using the QMediaPlayer class, and I would like to add a presenter mode (as in PowerPoint), with a duplicate view of what is shown on the main screen.
For Qt5, there are solutions using video surfaces, which seem to have disappeared as of Qt6.
I try to instantiate another QVideoWidget, and pass the QVideoFrame in between them with:media_player.videoSink().videoFrameChanged.connect(second_video_widget.videoSink().setVideoFrame)
but it does not seem to be allowed (You can't add dynamic slots on an object originated from C++).
Is there a Qt-way to display the same video content but multiple times?
Thanks!
-
@jeertmans
Although I know nothing aboutQMediaPlayer
I believe your attempted approach is correct. See https://forum.qt.io/topic/128382/qt6-porting-guidance-qcamera-and-qabstractvideosurface but for C++.To proceed the way you wish is a problem in PySide (PyQt fairs better). See the accepted solution's workarounds at https://stackoverflow.com/a/75620549/489865. Try the simplest Using a lambda, hopefully that will allow you to
connect
successfully? -