auto-reconnect and event filter, qt

This forum is about all development around libVLC.
DrageFabeldyr
New Cone
New Cone
Posts: 6
Joined: 21 Dec 2016 13:13
Operating System: Windows / Linux
Contact:

auto-reconnect and event filter, qt

Postby DrageFabeldyr » 10 Jan 2017 14:33

Hello everybody, I'm trying to make my qt program using libvlc to resume streaming after source file ended or connection lost.
Now i do it this way:

Code: Select all

check_timer = new QTimer(this); connect(check_timer, SIGNAL(timeout()), this, SLOT(check_state())); check_timer->setInterval(1000); // 1 time per second check_timer->start(); void myprogram::check_state() { if (_player->state() == 6 || _player->state() == 7) // if ended or error { _player->open(_media); } }
but this way slows down the program, so is there any way to get state changes from VlcMediaPlayer?

DrageFabeldyr
New Cone
New Cone
Posts: 6
Joined: 21 Dec 2016 13:13
Operating System: Windows / Linux
Contact:

Re: auto-reconnect and event filter, qt

Postby DrageFabeldyr » 11 Jan 2017 14:47

or may be someone can tell how to use libvlc_event_manager_t?

DrageFabeldyr
New Cone
New Cone
Posts: 6
Joined: 21 Dec 2016 13:13
Operating System: Windows / Linux
Contact:

Re: auto-reconnect and event filter, qt

Postby DrageFabeldyr » 13 Jan 2017 07:58

ok, i've found solution:

Code: Select all

connect(_player, &VlcMediaPlayer::end, this, &myprogram::reconnect); connect(_player, &VlcMediaPlayer::error, this, &myprogram::reconnect); void myprogram::reconnect() { if (_player->state() == 6 || _player->state() == 7) // don't know if it really needed or not { _player->open(_media); } }


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 15 guests