Flash in browsers does not play sound accurately using Pulse network audio

Preface

I was able to replicate Dave's issue in experiments, and they lead me to believe that Flash is somehow sending the sound to PulseAudio in such a way that it creates a lot of network traffic (think lots of tiny packets, not bandwidth); this overwhelms the network "tunnel" PulseAudio has created, i.e. you have

Youtube => [PA-client => network => PA-server] => speakers

I could solve the issue by putting both the client and server on their own virtual network, giving them effectively infinitely fast connectivity (10 Gbits/sec) between them; obviously, that doesn't work for real-world networks :)

So, a bit of googling and this post and this one gave me the idea of dropping the tunnel (middleman, as Dave aptly put it), and having the client talk directly to the server, i.e.

Youtube => network => PA-server => speakers

And that worked for me; Flash videos/sound play flawlessly.

Let's try it!

This assumes your client-server are on a local network (router, etc.)

  1. Preliminary: On the client machine, if you have an existing setup, open paprefs and uncheck everything; then kill PulseAudio to be sure.

  2. On the server machine (i.e., the one with the speakers), start PA Preferences (paprefs) and set it up as follows:

    enter image description here enter image description here enter image description here enter image description here

    • Then close it, and kill PulseAudio in a terminal as shown, wait, and check that it is now listening on port 4713:

    enter image description here

    • If you don't see it, open paprefs again and check the remaining boxes in the Network Access and Network Server tabs (they don't hurt)

    • Make sure you know the server's IP address - use ifconfig, etc. We'll use 192.168.0.4 in our example.

  3. On the client machine, open a terminal, and test our direct connection first, with a speech sample WAV (replace 192.168... with your server IP!)

    wget http://www.signalogic.com/melp/EngSamples/Orig/female.wav
    paplay --server=192.168.0.4:4713 female.wav
    
    • Abort with Ctrl-C if it works, it can get boring ;)

Now, close all running browser instances, and then start it (assuming Firefox here with the following syntax):

PULSE_SERVER=192.168.0.4:4713 firefox &
  • Replace 192... with the appropriate IP for your server!

  • In that Firefox instance, open up Youtube (or whichever Flash video site), and try playing videos back --- fingers crossed, it should work without stuttering/pausing!

Make it stick

If you want to make this fix apply to all programs instead of having to put PULSE_SERVER=192.168.0.4:4713 in front of every command, edit /etc/environment on the client and add PULSE_SERVER=192.168.0.4:4713 on a new line at the end of the file. Also add a line break at the end.

This will make all sound on the client go to the Pulseaudio server, so be sure that's what you want before making this edit to your /etc/environment file.

Reboot, and enjoy a smooooooth audio experience. ;)


If the problem is Gnash here is how to fix it:

Close all browsers and run these commands:

sudo apt-get purge gnash mozilla-plugin-gnash adobe-flashplugin

then this sudo apt-get install adobe-flashplugin

this fixed my problems: basically it removes everything related to Gnash and installs Flash.


I think your problem might be related to the flash player.

There is a FireFox plugin Flash-Aid that installs appx flash version according to your environment.