Having two media players working at the same time

This forum is about all development around libVLC.
hanky
Blank Cone
Blank Cone
Posts: 21
Joined: 30 May 2012 07:49

Having two media players working at the same time

Postby hanky » 28 Mar 2013 19:36

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?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Having two media players working at the same time

Postby Jean-Baptiste Kempf » 29 Mar 2013 00:06

Use 2 libvlc objects?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

hanky
Blank Cone
Blank Cone
Posts: 21
Joined: 30 May 2012 07:49

Re: Having two media players working at the same time

Postby hanky » 29 Mar 2013 05:21

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?

hanky
Blank Cone
Blank Cone
Posts: 21
Joined: 30 May 2012 07:49

Re: Having two media players working at the same time

Postby hanky » 29 Mar 2013 08:20

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Having two media players working at the same time

Postby Rémi Denis-Courmont » 29 Mar 2013 10:05

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

lgassman
New Cone
New Cone
Posts: 1
Joined: 10 Apr 2014 21:45

Re: Having two media players working at the same time

Postby lgassman » 10 Apr 2014 22:08

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.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests