Page 1 of 1
Video not read in QWidget
Posted: 27 May 2023 08:43
by NicolasS
Hello,
I built the project found on this page:
https://github.com/videolan/vlc/tree/ma ... c/QtPlayer and tested it.
Unfortunately, every time I start playing a file, libvlc opens a new window instead of playing the video in the QWidget.
The project was built under Fedora 38. The behavior is the same with X and Wayland.
I think the behavior of "libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId());" is incorrect.
I don't know if it's libvlc (3.0.19) that's the culprit or if it's Qt (version 5.15).
I tried the same in pyqt and it doesn't work anymore.
I tried a lot of things found on forums but nothing worked.
I am posting to this forum for ideas on what I could try to successfully get the video to play in the QWidget.
Thank you for your help, have a good day.
Nicolas.
Re: Video not read in QWidget
Posted: 30 May 2023 05:58
by mfkl
is videoWidget->winId() valid and initialized?
Re: Video not read in QWidget
Posted: 31 May 2023 09:31
by NicolasS
Thanks for your reply.
videoWidget->winId() seems to be valid and initialized. When I print it, I see value like 1 or 2. But I don't know if it's ok.
I read here :
https://doc.qt.io/qt-6/qwidget.html#winId that "Portable in principle, but if you use it you are probably about to do something non-portable." But I don't know what to be careful.
I tried to build same exe on an old debian (with qt4) and same code works perfectly.
Re: Video not read in QWidget
Posted: 31 May 2023 11:03
by Rémi Denis-Courmont
1 and 2 aren't legit X window IDs.
Re: Video not read in QWidget
Posted: 02 Jun 2023 18:34
by NicolasS
I have added a "std::cout << "videoWidget->winId() " << videoWidget->winId() << std::endl;" in Mwindow::openFile. It gives :
videoWidget->winId() 8
I don't know precisely what is WId return by QWidget::winId and how it is convert to string.
Re: Video not read in QWidget
Posted: 03 Jun 2023 07:02
by Rémi Denis-Courmont
That value is definitely not a X window ID either. The problem is on the Qt side of the code.
Re: Video not read in QWidget
Posted: 04 Jun 2023 16:05
by NicolasS
I was wrong. The problem comes from wayland. When I'm using X11, no problem.
With wayland (If I understood correctly), there is no more global window ids. So I don't know what to give to libvlc_media_player_set_xwindow. Maybe it's incorrect to call this function.
I will look if there is a function like libvlc_media_player_set_waylandwindow.
Re: Video not read in QWidget
Posted: 04 Jun 2023 16:12
by NicolasS
I have found a work around by using QT_QPA_PLATFORM=xcb
Re: Video not read in QWidget
Posted: 04 Jun 2023 17:20
by Rémi Denis-Courmont
As the name implies, and as the documentation says that function wants an X11 window ID.
Wayland is not supported in VLC 3.0.
Re: Video not read in QWidget
Posted: 10 Jun 2023 09:24
by NicolasS
It's well known that users/developers never read the doc. I am guilty !
Thanks a lot for your answers. The workaround works fine.
Have a nice day.
Re: Video not read in QWidget
Posted: 19 Jun 2023 10:31
by NicolasS
Is there an (unstable) version of vlc that supports wayland?
I thought I was reading about a 4.0 maybe?
If so, I imagine it can be found on gitlab on a particular branch, right?
Thanks for help.
Re: Video not read in QWidget
Posted: 19 Jun 2023 16:56
by Rémi Denis-Courmont
VLC 4.0 supports Wayland, but not LibVLC 4.0 as of yet.