M
M
Michael2013-02-28 21:25:18
Python
Michael, 2013-02-28 21:25:18

Why doesn't vlc on pygtk switch to next track?

Hello, I am writing a small player in python using pygtk binding to libvlc.
There is a task at the end of the track to take the next controller il (GetNextTrack function) and play it.
Through the event_manager of the binding, I write the following callback:

def next_track(self,sender):
    fname = vlc_controller.GetNextTrack()['url']
    self.vlc.player.set_media(instance.media_new(fname,'--network-caching 60000'))
    self.vlc.player.play()

But at the end of the current track, this code is hung up on the function call: player.set_media
And, accordingly, it is not played.
Also tried on qtvlc example. the same.
Tell me which way to dig?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
subvillion, 2013-03-01
@subvillion

You're calling libvlc from libvlc and it's brain-breaking. This is a bug.

M
Michael, 2013-03-01
@1099511627776

Ok, let's say. Then I try now to remove the component in the window of which libvlc is displayed:

  def endCallback(self,event):
    sys.stdout.write('\n\r endCallback')
    sys.stdout.flush()
    self._mainbox.remove(self.vlc)
    self.vlc = None
    self.vlc = DecoratedVLCWidget()
    sys.stdout.write('\n\r recreatePlayer')
    sys.stdout.flush()
    fname = vlc_controller.GetNextTrack()['url']
    self.vlc.player.set_media(instance.media_new(fname,'--network-caching 60000'))
    sys.stdout.write('\n\r after set_media')
    sys.stdout.flush()		
    self.vlc.player.play()
    sys.stdout.write('\n\r afterplay')
    sys.stdout.flush()		

hangs on self._mainbox.remove(self.vlc) i.e. on the removal of the widget from the form in place of which I planned to put a new instance

M
Michael, 2013-03-01
@1099511627776

Damn, even the developers agreed that this is a cant
forum.videolan.org/viewtopic.php?f=32&t=108750#p368299
And the phrase "patch welcome" - pleased

M
Michael, 2013-03-01
@1099511627776

So far I've done a workaround via vlc.py MediaPlayerList.
After the end of playback, I add the next track to the list. But there are jambs.
1. The first file in the playlist is played 2 times
2. When a file is deleted from the list, the player is still suspended

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question