Ubuntu – Audio starts playing 3-5 seconds after video does


I've installed Ubuntu Studio 16.04.1 LTS on my pc (ASRock X99 Taichi, i7 6800k, GTX 970, DisplayPort to iMac as monitor), my first experience with Ubuntu/Linux. I haven't installed any third party software during installation.

Whenever I play videos on youtube, the first 3-5 seconds are mute. If I pause and start playing the video from the beginning a second time, then the audio starts playing at the start. This happens every time I open a new video. Everything is in sync, but the audio always takes time to start playing. How can I fix this annoying glitch/delay? I am using the default Ubuntu Studio xfce desktop environment.

Best Answer

Perfect solution for specific problem, but not all applications

This solution works when pausing and resuming from the same sound source such as a movie:

Edit Pulse Audio configuration file: sudo -H gedit /etc/pulse/default.pa

Locate this section and place # in front of second line:

### Automatically suspend sinks/sources that become idle for too long
# load-module module-suspend-on-idle

Save the file and exit.

Reload Pulse Audio using pulseaudio -k.

Where it doesn't work.

Whilst watching a movie I can have laundry timer running in the background. When a alert sounds to signal end of Wash Cycle, Rinse Cycle or Dryer no sound is heard. The alert sound was < 5 seconds. The workaround is to pick a different sound file > 5 seconds long.