1

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......



}
TrebledJ
  • 8,713
  • 7
  • 26
  • 48
Liam_1998
  • 1,157
  • 3
  • 12
  • 27
  • Hi there! Is it possible to attach your code to your question? It's difficult for us to guess what you are trying to do. A [_minimal, complete, and verifiable example_](https://stackoverflow.com/help/mcve) will help a lot. Thanks! – TrebledJ Nov 18 '18 at 06:48
  • Well, and I have updated my description:) – Liam_1998 Nov 18 '18 at 07:40

0 Answers0