Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] vlc-qt fullscreen mode



  • Hello everyone. I started studying vlc-qt and I have a problem. I have pasted vlcvideowidget in qwidget. Video works, but takes up only a small area in the corner of the main window.
    But I need a full-screen mode. How do I make the videoframe takes all the mainwindow? I think it should be easy, but not for such a newbie like me)
    I also have the following errors:
    [00000000028e98b8] main interface error: no suitable interface module
    [0000000002a45dc8] main vout display error: Failed to set on top

    Here is the code.

    DemoPlayer.cpp
    @
    #include <vlc-qt/Common.h>
    #include <vlc-qt/Instance.h>
    #include <vlc-qt/Media.h>
    #include <vlc-qt/MediaPlayer.h>
    #include <vlc-qt/WidgetVideo.h>
    #include "DemoPlayer.h"

    #include <QtWidgets>

    DemoPlayer::DemoPlayer(QWidget *parent)
    : QMainWindow(parent),
    _videowidget(0),
    _media(0)
    {
    _instance = new VlcInstance(VlcCommon::args(), this);
    _media = new VlcMedia("C:/promo/repeat.mp4", true, _instance);
    _player = new VlcMediaPlayer(_instance);
    _videowidget = new VlcWidgetVideo(_player,this);
    _player->setVideoWidget(_videowidget);
    _videowidget->show();
    _player->open(_media);
    _player->play();
    @

    main.cpp
    @
    #include <QApplication>

    #include "DemoPlayer.h"

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    DemoPlayer mainWindow;
    mainWindow.showfullscreen();
    return app.exec();
    }
    @

    DemoPlayer.h
    @
    #ifndef DEMOPLAYER_H_
    #define DEMOPLAYER_H_
    #include <QMainWindow>
    #include <QWidget>
    class VlcInstance;
    class VlcMedia;
    class VlcMediaPlayer;
    class VlcWidgetVideo;

    class DemoPlayer : public QMainWindow
    {
    Q_OBJECT
    public:
    explicit DemoPlayer(QWidget *parent = 0);

    public:
    VlcInstance *_instance;
    VlcMedia *_media;
    VlcMediaPlayer *_player;
    VlcWidgetVideo *_videowidget;
    };

    #endif // DEMOPLAYER_H_
    @


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    From just a quick overlook at the code (I haven't used that lib yet) you don't set any widget as DemoPlayer centralWidget so it's not managed for you



  • Thanks for the quick reply! Now I understand)
    Topic may be closed.


  • Lifetime Qt Champion

    You're welcome !

    The current way of doing that is to prepend [solved] to the thread title (just edit the original post and modify the title)


Log in to reply