Audio control in multiple instances of JVLC

*nix specific usage questions
elombert
New Cone
New Cone
Posts: 4
Joined: 16 Dec 2008 15:30

Audio control in multiple instances of JVLC

Postby elombert » 16 Dec 2008 16:03

Hi all!
I'm using JVLC for an application and in a frame I have multiple instances of JVLC running. When the frame is first shown, all of the videos have audio. If I mute all of them and try to un-mute them all again, only one gets audio. After that, I can not get them to have audio again. Only the first one gets audio or gets mute.

Anyone else have seen this behaviour?

JVLC version is 0.9.0 test3

Thanks

Ellis Lombert

wells
Blank Cone
Blank Cone
Posts: 15
Joined: 12 Aug 2008 08:53
Location: china
Contact:

Re: Audio control in multiple instances of JVLC

Postby wells » 04 Jan 2009 11:01

I have the similar trouble. I have two instances of jvlc running, when I set one of them mute , the other is mute too. On the other hand is the same!
Maybe someone can help us!

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: Audio control in multiple instances of JVLC

Postby Jean-Baptiste Kempf » 04 Jan 2009 13:18

Fill a bug in the jvlc tracker.
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.

littlejohn
Blank Cone
Blank Cone
Posts: 73
Joined: 04 May 2006 14:59

Re: Audio control in multiple instances of JVLC

Postby littlejohn » 06 Jan 2009 19:47

I have the similar trouble. I have two instances of jvlc running, when I set one of them mute , the other is mute too. On the other hand is the same!
Maybe someone can help us!
Hi,
I added a unit test in /jvlc-core/src/test/java/org/videolan/jvlc/JVLCTest.java named:

org.videolan.jvlc.JVLCTest.twoAudioInstancesTest()

and it shows that the mute status on the second instance does not depend on the first instance status. Please create a unit test which I can run and file a bug on the jvlc trac ( http://trac.videolan.org/jvlc ).

Cheers,
Filippo

elombert
New Cone
New Cone
Posts: 4
Joined: 16 Dec 2008 15:30

Re: Audio control in multiple instances of JVLC

Postby elombert » 09 Jan 2009 20:58

Hi Filippo!
I have setup an example based on yours (MultipleVideosSample.java) that you can use to test what I stated in my original message.
filename is now an array of video file names that are located in the folder indicated by the filepath variable (/home/user/ in the example). Just change the video names for those that you have and the location of them in the filepath variable and run the example. When you click on the name of a video in the list, that video is supposed to switch the mute state. If you select the mute all checkbox, all videos are supposed to be muted and when de-selected, all videos should have audio again. Play with it and you see what I mean.

OS: Ubuntu 8.10 Intrepid
VLC: (0.9.0 - 0.9.4)
IDE: EasyEclipse 1.2.2.2

Here is the code of the example:

Code: Select all

import java.awt.*; import java.awt.event.*; import javax.swing.JPanel; import org.videolan.jvlc.*; /***************************************************************************** * MultipleVideosSample.java: VLC Java Bindings ***************************************************************************** * Copyright (C) 1998-2008 the VideoLAN team * * Authors: Filippo Carone <filippo@carone.org> * * * $Id $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ public class MultipleVideosSample implements ItemListener { public void itemStateChanged(ItemEvent arg0) { try{ if(arg0.getSource() instanceof Checkbox) { Checkbox chk = (Checkbox)(arg0.getSource()); muteAllVideos( chk.getState()); } else { int inx = lisVideo.getSelectedIndex(); System.out.println( ((lisAud[inx].getMute())?"Un-":"")+"Muting: "+filename[inx]+ " was : "+lisAud[inx].getMute()); lisAud[inx].setMute(!lisAud[inx].getMute()); } }catch(Exception ee) { System.out.println("Error al asignar nuevo estado de audio ..."); } } private void muteAllVideos(boolean es) { System.out.println(" Setting mute to : "+es); for (int i = 0; i < videosNumber; i++) { System.out.println( ((es)?"":"Un-")+"Muting: "+filename[i]+ " was : "+lisAud[i].getMute()); lisAud[i].setMute(es); } } private static int videosNumber = 6; private static String filename[] = {"video1.avi","video2.avi","video3.avi","video4.avi","video5.avi","video6.flv"}; private static String filepath = "/home/user/"; Frame frame = new java.awt.Frame(); JPanel jvcc = new JPanel(); JPanel pansel = new JPanel(); Checkbox muteAll = new Checkbox("Mute all"); List lisVideo = new List(); Audio lisAud[] = new Audio[videosNumber]; Scrollbar selVol = new Scrollbar(0,100,0,1,1); Canvas[] videoCanvasesArray = new Canvas[videosNumber]; JVLC[] jvlcArray = new JVLC[videosNumber]; public MultipleVideosSample() { frame.setBounds(0, 0, 600, 750); muteAll.addItemListener(this); lisVideo.addItemListener(this); frame.add("Center", jvcc); frame.add("South",pansel); pansel.add(lisVideo); pansel.add(selVol); pansel.add(muteAll); for (int i = 0; i < videosNumber; i++) { Canvas jvlcCanvas = new Canvas(); videoCanvasesArray[i] = jvlcCanvas; jvlcCanvas.setSize(200, 200); jvlcCanvas.setBackground(new Color(0x0)); jvcc.add(jvlcCanvas); lisVideo.add(filename[i]); } frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent ev) { System.exit(0); } }); frame.setVisible(true); for (int i = 0; i < videosNumber; i++) { JVLC jvlc = new JVLC(); jvlcArray[i] = jvlc; lisAud[i] = new Audio(jvlc); jvlc.setVideoOutput(videoCanvasesArray[i]); } for (int i = 0; i < videosNumber; i++) { jvlcArray[i].play(filepath+filename[i]); try{ Thread.sleep(500); } catch(Exception ee){System.out.println("Error al dormir thread ");} } } public static void main(String[] args) throws Exception { MultipleVideosSample smp = new MultipleVideosSample(); } }

elombert
New Cone
New Cone
Posts: 4
Joined: 16 Dec 2008 15:30

Re: Audio control in multiple instances of JVLC

Postby elombert » 04 Feb 2009 15:09

Hi all!
I have been trying to file a bug report in trac for JVLC about this problem but I haven't been able to login. I registered and trac recognizes that there is a user with that name but it doesn't allow me to login. I tried with Firefox and Explorer and I receive the same results.

It is not the user/password combination because I tried it with two different user/password combinations.

BTW, have any of you found something regarding the problem of the audio control when there are multiple instances of JVLC?

Thanks.

Ellis Lombert

elombert
New Cone
New Cone
Posts: 4
Joined: 16 Dec 2008 15:30

Re: Audio control in multiple instances of JVLC

Postby elombert » 06 Feb 2009 16:24

Hi all!
I have been trying the latest git vlc and jvlc sources and it seems that there have been a change in how setVideoOutput works! Before, setting the video output for JVLC did not try to start playing immediately. Now, when you set the video output to a JVLC object it seems that it tries to start playing. At that point, there is no media set to play.

If you ask the JVLC object to play a media, it opens a new window for every media.
This new behavior prevents the MultipleVideosSample.java program from running correctly!

Any advice?

TIA

Ellis Lombert


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 20 guests