Page 1 of 1

Having two media players working at the same time

Posted: 28 Mar 2013 19:36
by hanky
I'd like to know the proper way of having two media players working in parallel.
Do I need to create two vlc instance objects for them? Or they can share a single one?

I my program I need to have two players working at the same time. In the begining only one player is playing, but user can open another player at any time. So I want to mute the first one, then show the second one and then, when it's closed, restore the volume of the first player.
My problem is that when I mute the first player, the second one starts to play with no sound too. Though I can tune the volume using a slider, initially the second player is mute.
I use a single vlc instance object for my players. Is this approach correct?

Re: Having two media players working at the same time

Posted: 29 Mar 2013 00:06
by Jean-Baptiste Kempf
Use 2 libvlc objects?

Re: Having two media players working at the same time

Posted: 29 Mar 2013 05:21
by hanky
Ok, I'll try.
So, you confrim that proper way is 'one libvlc object = one player'?
I ask because in another part of my app I have a player playing in one tab, then user can switch to another tab (the first player becomes mute) and start the second player. In this case everything works fine with a single libvlc instance. I think it works because there is a delay between muting the first player and starting the second one. And the scenario I've described in the first post doesn't have such delay. Can it be a problem?

Re: Having two media players working at the same time

Posted: 29 Mar 2013 08:20
by hanky
Also there's a weird thing that, if I don't mute the first player, the second player starts with exactly the same volume as the first one had.

Re: Having two media players working at the same time

Posted: 29 Mar 2013 10:05
by RĂ©mi Denis-Courmont
One libvlc instance is a set of shared resources and configuration. You can have multiple libvlc instances in one process, but you can have multiple media players or media list players in a single instance as well.

Re: Having two media players working at the same time

Posted: 10 Apr 2014 22:08
by lgassman
I have the same behaviour with my app. Do you know any approach to make each player is independent? The sleep approach fails when I change the volume of second player (No sound is played).
Thanks in advance.
Leo.