Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vlc / Vlc-Qt: Failed to set on top -> No video #218

Open
Ciavi opened this issue Oct 7, 2017 · 3 comments
Open

Vlc / Vlc-Qt: Failed to set on top -> No video #218

Ciavi opened this issue Oct 7, 2017 · 3 comments

Comments

@Ciavi
Copy link

Ciavi commented Oct 7, 2017

Hi 馃槃, I'm using on Windows this library in Qt 5.9.1 (Qt Creator 4.4.0) and, as I start my application, in Application Output those errors appear:
core vout display error: Failed to set on top
libvlc: Failed to set on top

Result: no video, only audio.
The code is like this:
InitialWindow.cpp

#include <VLCQtCore/Common.h>
#include <VLCQtCore/Instance.h>
#include <VLCQtCore/Media.h>
#include <VLCQtCore/MediaPlayer.h>

InitialWindow::InitialWindow(QWidget *parent) :
    QMainWindow(parent,Qt::Widget | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint),
    ui(new Ui::InitialWindow), _media(0)
{
    setAttribute(Qt::WA_TranslucentBackground);
    ui->setupUi(this);
    initial_setup();
}
void InitialWindow::initial_setup(){            //Initial Setup
    //VIDEO
    _instance = new VlcInstance(VlcCommon::args(), this);
    _player = new VlcMediaPlayer(_instance);
    _player->setVideoWidget(ui->video);
    ui->video->setMediaPlayer(_player);
    video_openLocal();
}

void InitialWindow::video_openLocal(){
    _media = new VlcMedia("C:\\Users\\Rubinart\\Documents\\Visual Studio 2015\\Projects\\Vestfalia_projekt\\Vestfalia_projekt\\RES\\Images\\bf4.mp4", true, _instance);
    _player->open(_media);
}

and its Header (InitialWindow.h):

#ifndef INITIALWINDOW_H
#define INITIALWINDOW_H

#include <QMainWindow>
#include <QMovie>
#include <QMouseEvent>
#include <QGraphicsBlurEffect>
#include <QScreen>
#include <QRect>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QtAlgorithms>

namespace Ui {
    class InitialWindow;
}

class VlcInstance;
class VlcMedia;
class VlcMediaPlayer;

class InitialWindow : public QMainWindow
{
    Q_OBJECT

    public:
        explicit InitialWindow(QWidget *parent = 0);
        ~InitialWindow();

    protected:
        void mousePressEvent(QMouseEvent *event);
        void mouseReleaseEvent(QMouseEvent *event);
        void mouseMoveEvent(QMouseEvent *event);

    private:
        void initial_setup();
        void video_openLocal();
        void video_openUrl();

        Ui::InitialWindow *ui;
        QPoint windowPos;
        bool isMouseDown = false;
        QMovie btnPlay_animation;
        VlcInstance *_instance;
        VlcMedia *_media;
        VlcMediaPlayer *_player;

    public slots:
        void btnPlay_enter();
        void btnPlay_leave();
        void btnPlay_animate(int frame);

    private slots:
        void on_btnPlay_pressed();
        void on_btnClose_pressed();
        void on_btnMini_pressed();
};
#endif // INITIALWINDOW_H

The widget was added by promoting a QWidget to a VlcWidgetVideo.
I just cannot get it, I'm a newbie to Qt and this "magical world" 馃槅. I hope you can give me a hint to resolve this problem. Thank you in advance 馃槂

@maximus321
Copy link

hey let me know if you solved it, I am facing the same issue
#237

@nrkowalski
Copy link

nrkowalski commented Aug 3, 2018

I'm having the exact same issue, cant figure it out. :(

EDIT: Found a workaround

Opening a NULL VlcMedia object and then immediately stopping it in the main class constructor fixes this issue for me.

I guess the widget isnt getting properly initialized until a call to open() or play() is made.

I still get the following error messages but atleast the videos play now.

core vout display error: Failed to set on top
libvlc: Failed to set on top

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    _media(0)
{
    ui->setupUi(this);

    _instance = new VlcInstance(VlcCommon::args(), this);
    _player = new VlcMediaPlayer(_instance);
    _player->setVideoWidget(ui->video);
    ui->video->setMediaPlayer(_player);

    // This is the part that fixes it for me.
    _media = new VlcMedia(NULL, true, _instance);
    _player->open(_media);
    _player->stop();

@maplejohn
Copy link

mark ,i have solve this problem, this problem is mainly caused by the type of libvlc.dll and libvlccoer.dll file, we just need to download the lastest version of VLC锛宖ound the VLC installer path, copy the "plugins" folder, the "libvlc.dll" file and the "libvlccore.dll"file in your qt project complie project's "release" folder ,the problem will solve. good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants