How to change vlc-qt media display widget?

499 Views Asked by At

I am using vlc-qt to build a simple media player. And at first I connect the player to a widget, and it works, but when I tried to use the setVideoWidget member function again to change the display widget, it seems doesn't work, so what should i do? Is this member function setVideoWidget can only be called once?

I have call setVideoWidget in my constructor _player->setVideoWidget(ui->video); to set the video widget(the black one you can see in the image above) as the default widget to play media and it works.

But when I tried to change the display widget to another one (named as anotherWidget, the green one you can see in the image above)

void SimplePlayer::on_changeButton_clicked()
{
    _player->pause();
    _player->setVideoWidget(ui->anotherWidget);
    _player->play();
}

When I clicked the button named changeButton it changes nothing.The media was still displayed on the default video widget(the black one).

My constructor:

SimplePlayer::SimplePlayer(QWidget *parent)
    : QMainWindow(parent),
      ui(new Ui::SimplePlayer),
      _media(0),
      _equalizerDialog(new EqualizerDialog(this))
{
//  init ui
    ui->setupUi(this);

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


    signals & slots......



}
0

There are 0 best solutions below