LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   How do I make Sun Java output sound through PulseAudio using a browser? (https://www.linuxquestions.org/questions/linux-desktop-74/how-do-i-make-sun-java-output-sound-through-pulseaudio-using-a-browser-804235/)

Mr Beanjamin 04-26-2010 06:16 AM

How do I make Sun Java output sound through PulseAudio using a browser?
 
Hello everyone,

I am trying to make Sun Java 1.6.0_20 output its sound through PulseAudio. Currently, Java uses the sound card directly, blocking every other application from using sound when a Java program is running. Other applications work just fine, and I can get multiple programs to output sound at the same time as long as no Java program is running. PulseAudio Volume Control lists all programs trying to output sound through PulseAudio, but Java is nowhere to be found when it's playing sound.

I have tried executing "padsp firefox", but Firefox doesn't even start when I try that. I have also tested "padsp konqueror", but when I do that, there's no sound from Java applets. Putting padsp in front of the command to launch the non-browser Java applet does work though.

I have also tried renaming the java binary to java.bin and then creating a file named "java" that says
Code:

padsp /opt/java/jre/bin/java.bin "$@"
and then chmod +x it. This should basically do the same thing as putting "padsp" in front of a command, but it does allow Firefox to run. Java still works when I do that, but then I can't hear any sound at all from Java when I access it in a browser, so basically it has the same effect as "padsp konqueror".

To summarise: I would like Firefox to output Java's sound through PulseAudio, but "padsp firefox" doesn't work.

I hope this was clear enough. If I need to supply any more information, please ask, because I don't really know much about outputting sound. Thanks in advance.

jschiwal 04-27-2010 07:50 PM

Could you provide a link to a page that uses java to produce sound? It would help if you could verify the problem and test a solution.

Does the java program access OSS drivers or Alsa?

Your firefox command is probably a wrapper script which may undo the changes to $LD_PRELOAD that the padsp command made. Try running the binary directly instead:
e.g. padsp -- /usr/lib/firefox/firefox <url>

You might try running the java program w/o pulse, e.g. pasuspender -- firefox <url>
And then use lsof to see which files and devices are opened. Or use "ltrace /usr/lib/firefox/firefox" or "strace /usr/lib/firefox/firefox" which will allow you to discover which libraries and system calls are used. This can often provide valuable clues. Pay particular attention to libraries loaded and errors.


All times are GMT -5. The time now is 09:40 PM.