Page 1 of 1

multiple mediacontrol instances in Python Bindings

Posted: 03 Jun 2009 22:54
by wlourf
Hi all,

In python, I try to use multiple instances of vlc, but if I stop one of the instances and restart it later, its always the last instance I created that restart.
Here is my code:

Code: Select all

#! /usr/bin/env python # -*- coding: utf-8 -*- import vlc, time,os #array to store multiple players enreg=[] class one_player(): def __init__(self,cmd): self.player= vlc.MediaControl(cmd) for i in range(0,3): print "\n"+str(i)+"\n" lineCmd = [] lineCmd.append("--volume=0") lineCmd.append("--sout=#transcode{acodec=mp3,ab=64,channels=1}:duplicate{dst=std{access=file,mux=raw,dst=/tmp/"+str(i)+".mp3}}") enreg.append(one_player(lineCmd)) enreg[i].player.set_mrl("/tmp/test.mp3") enreg[i].player.start() time.sleep(5) #0.mp3, 1.mp3, 2.mp3 are running -->ok #stop the players and remove the files --> ok enreg[0].player.stop() enreg[1].player.stop() enreg[2].player.stop() os.remove("/tmp/0.mp3") os.remove("/tmp/1.mp3") os.remove("/tmp/2.mp3") time.sleep(5) # My BIG problem is here !!! #start player number 1 but this restart number 2, why ? enreg[1].player.start() time.sleep(5)
Is there a problem with my code or I misunderstand how works the vlc.MediaControl?

Thanks for any help !