Video not read in QWidget

This forum is about all development around libVLC.
NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Video not read in QWidget

Postby NicolasS » 27 May 2023 08:43

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.

mfkl
Developer
Developer
Posts: 746
Joined: 13 Jun 2017 10:41

Re: Video not read in QWidget

Postby mfkl » 30 May 2023 05:58

is videoWidget->winId() valid and initialized?
https://mfkl.github.io

NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Re: Video not read in QWidget

Postby NicolasS » 31 May 2023 09:31

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15279
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Video not read in QWidget

Postby Rémi Denis-Courmont » 31 May 2023 11:03

1 and 2 aren't legit X window IDs.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Re: Video not read in QWidget

Postby NicolasS » 02 Jun 2023 18:34

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15279
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Video not read in QWidget

Postby Rémi Denis-Courmont » 03 Jun 2023 07:02

That value is definitely not a X window ID either. The problem is on the Qt side of the code.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Re: Video not read in QWidget

Postby NicolasS » 04 Jun 2023 16:05

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.

NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Re: Video not read in QWidget

Postby NicolasS » 04 Jun 2023 16:12

I have found a work around by using QT_QPA_PLATFORM=xcb

Rémi Denis-Courmont
Developer
Developer
Posts: 15279
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Video not read in QWidget

Postby Rémi Denis-Courmont » 04 Jun 2023 17:20

As the name implies, and as the documentation says that function wants an X11 window ID.

Wayland is not supported in VLC 3.0.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Re: Video not read in QWidget

Postby NicolasS » 10 Jun 2023 09:24

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.

NicolasS
New Cone
New Cone
Posts: 9
Joined: 27 May 2023 08:27

Re: Video not read in QWidget

Postby NicolasS » 19 Jun 2023 10:31

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15279
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Video not read in QWidget

Postby Rémi Denis-Courmont » 19 Jun 2023 16:56

VLC 4.0 supports Wayland, but not LibVLC 4.0 as of yet.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests