# No sound from Browsers



## Luca79 (Sep 12, 2015)

Hello,

iI have a strange issue.
My sound work if iI use VLC, but can't make it work from YouTube, using Firefox or Chrome.
(I build my ports with Pulseaudio as option). I use HTML5 on YouTube, and the video is clear and work well, is only muted.
I did a research on the forum, but no luck.


----------



## free-and-bsd (Sep 12, 2015)

Here I'm discussing the same thing in my thread. What helped me was deleting the ~/.pulse directory. But it is also necessary to disable flash plugin in firefox for html5 to work, try this one first. Then there are some other recommended modifications in about:config, read more about it on the web.


----------



## Luca79 (Sep 13, 2015)

Thanks for the answer.
I using a fresh install of 10.2, and never get flash plugin.
Not even have a .pulse directory in my home folder.

The only plugin installed on Firefox is OpenH264.
I tried to install the port multimedia/openh264 but still no sound.


----------



## Deleted member 9563 (Sep 13, 2015)

Luca79 said:


> I using a fresh install of 10.2, and never get flash plugin.


There is no flash package. You have to compile it. The handbook has a short and sweet description of how to do it, so I won't repeat it here.


----------



## Luca79 (Sep 13, 2015)

OJ said:


> There is no flash package. You have to compile it. The handbook has a short and sweet description of how to do it, so I won't repeat it here.


Yes, I knew I need to compile it if I want to use flash.
But I don't care about flash, I just want to use the HTML5 on Youtube, and get the audio from it. (I can see the video clear and fine on Youtube)


----------



## free-and-bsd (Sep 14, 2015)

Luca79 said:


> Yes, I knew I need to compile it if I want to use flash.
> But I don't care about flash, I just want to use the HTML5 on Youtube, and get the audio from it. (I can see the video clear and fine on Youtube)


One small check can be done: do you have sound if you start firefox from command line as root (sudo)?


----------



## willbprog127 (Sep 14, 2015)

In the past, if I had sound problems with Firefox, I'd install all of the libcanberra and common gstreamer packages.


----------



## Deleted member 9563 (Sep 14, 2015)

Do you have sound in any of your other browsers? I find Firefox has been on and off in the last year and recent versions don't even keep settings reliably. Currently I'm having extremely good luck with 40.0.3


----------



## Luca79 (Sep 14, 2015)

free-and-bsd said:


> One small check can be done: do you have sound if you start firefox from command line as root (sudo)?



I'll try. Thanks



willbprog127 said:


> In the past, if I had sound problems with Firefox, I'd install all of the libcanberra and common gstreamer packages.



I have both already installed.



OJ said:


> Do you have sound in any of your other browsers? I find Firefox has been on and off in the last year and recent versions don't even keep settings reliably. Currently I'm having extremely good luck with 40.0.3



No sound from Chrome too. VLC work. But iI can choose the device on VLC.

Anyway in my sysctl.conf iI have:

```
# Sound
dev.hdac.1.polling=1
hw.snd.default_unit=1
# Don't automatically use new sound device
shw.snd.default_auto=0
```


----------



## Luca79 (Sep 14, 2015)

Ok.
I have sound if iI start firefox as root (`sudo firefox`)

I used `sudo portmaster www/firefox` for install it.
Which is the best method for fix this? I'm very new here...


----------



## free-and-bsd (Sep 14, 2015)

Luca79 said:


> Ok.
> I have sound if i start firefox as root (`sudo firefox`)
> 
> I used `sudo portmaster www/firefox` for install it.
> Which is the best method for fix this? I'm very new here...


Good sign that you have it when starting as root. What's in your /etc/devfs.conf?
Mine has

```
link cd0 cdrom
link cd0 dvd
link cd0 dvdr
link cd0 dvdrw
link cd0 cd
link cd0 cdr
link cd0 cdrw

perm cd0 0666
perm xpt0 0666
perm pass0 0666
perm pass1 066
perm pass2 0666
perm pass3 0666
perm pass4 0666
perm pass5 0666
perm da0 0666
perm da1 0666
perm da2 0666
perm da3 0666
perm da4 0666
perm dsp0.0 0666
perm dsp1.0 0666
perm dsp2.0 0666
perm dsp3.0 0666
perm dsp4.0 0666
perm dsp4.1 0666
```
Which groups does your user have membership in? Mine is added to both wheel and operator groups, maybe this has to do with it.

And generally, there MUST be some method in its working/not working.
I hear from a lot of people on this forum how for them in works well with alsa (just works, they say), while I exhausted all possible resources to make it work that way, all to no avail.
On the other hand, those same folks tell me it WON'T work with pulseaudio support, yet here it works all right in all the 3 of my installations! Oh, and you'll be the 4th, because for you it works as well...


----------



## free-and-bsd (Sep 14, 2015)

And BTW, do you have a DE? Which one, if any? That may be important, too. 
I'm using FVWM2 along with random applications I need, though it amounts, together with build-only deps, to >500 packages. But the idea is there is no "sound system" that does along with my desktop. For you it may be different.


----------



## Luca79 (Sep 14, 2015)

I'm using Openbox.
My user is in the wheel group. 


My /etc/devfs.conf is untouched.


```
p, li { white-space: pre-wrap; }

# Copyright (c) 2003 The FreeBSD Project

# All rights reserved.

#

# Redistribution and use in source and binary forms, with or without

# modification, are permitted provided that the following conditions

# are met:

# 1. Redistributions of source code must retain the above copyright

# notice, this list of conditions and the following disclaimer.

# 2. Redistributions in binary form must reproduce the above copyright

# notice, this list of conditions and the following disclaimer in the

# documentation and/or other materials provided with the distribution.

#

# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND

# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE

# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL

# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS

# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)

# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT

# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY

# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF

# SUCH DAMAGE.

#

# $FreeBSD: releng/10.2/etc/devfs.conf 226862 2011-10-27 20:39:20Z gavin $



# These are examples of how to configure devices using /etc/rc.d/devfs.

# The first parameter is always the action to take, the second is always the

# existing device created by devfs, and the last is what you want to change.

# The name of the action is only significant to the first unique character.

#

# Examples:



# Commonly used by many ports

#link cd0 cdrom

#link cd0 dvd



# Allow a user in the wheel group to query the smb0 device

#perm smb0 0660



# Allow members of group operator to cat things to the speaker

#own speaker root:operator

#perm speaker 0660
```


----------



## free-and-bsd (Sep 14, 2015)

Luca79 said:


> I'm using Openbox.
> My user is in the wheel group.
> 
> 
> ...


Right, you don't seem to have the needed links -- see, they are all commented out in your file, aren't they.
So try this first, copy the contents of my /etc/devfs.conf as listed above and restart your /etc/rc.d/devfs.
Like `sudo service devfs restart`
Then see if firefox gives sound as normal user. Oh, and add him to operator group, just in case. But _don't _do it by editing /etc/group.


----------



## free-and-bsd (Sep 14, 2015)

There's a whole story about configuring devd and devfs in FreeBSD. BTW, did you build all the stuff, or install ready packages?


----------



## Luca79 (Sep 15, 2015)

free-and-bsd said:


> There's a whole story about configuring devd and devfs in FreeBSD. BTW, did you build all the stuff, or install ready packages?



Thanks for your help!

I'm new on FreeBSD, so iI not read about devd and devfs yet.
I did installed all my system with `portmaster`.
I already added my user to operator group with `sudo pw groupmod operator -m myuser`.


----------



## free-and-bsd (Sep 15, 2015)

Right, I didn't think it would matter anyway... At least my dsp devices are owned by root and not operator. But how about adding the devices to /etc/devfs.conf? Did it work?
In any case, the most important thing is that you do have sound when starting firefox as root. The rest is a more or less technical question... in which I can hardly advise. In my opinion firefox is rather messy... but Chrome is mu-u-uch worse, so I'll stick to firefox.


----------



## Luca79 (Sep 16, 2015)

I tried.
For now still not working.

I added the lines:

```
perm dsp0 0666
perm dsp1 0666
```

I tried to replace with: 
	
	



```
dsp0.0
```
 and: 
	
	



```
pcm0
```

Where can iI find the name list of devices to use in devfs?


----------



## free-and-bsd (Sep 18, 2015)

Luca79 said:


> I tried.
> For now still not working.
> 
> I added the lines:
> ...


Well, it hits me that you didn't copy the _exact_ lines I posted? Why not? These have to do with permissions, as the syntax suggests, and not with device _creation_. Also, you won't find /dev/pcm* on your FreeBSD system.

Did you build your ports with or without HAL support (wherever the ports have that option)?
I myself have it disabled everywhere, so my configuration is free from it. How about yours?
You can also double-test your settings by creating a new user and trying to start firefox by that user (having logged in as that user). Cause generally your situation suggests that your firefox lacking sound is due to some permission problems at one point or another.


----------



## Luca79 (Sep 19, 2015)

Now I copied and past your previous post into devfs.conf


```
# Commonly used by many ports
link  cd0  cdrom
link  cd0  dvd
link  cd0  dvdr
link  cd0  dvdrw
link  cd0  cd
link  cd0  cdr
link  cd0  cdrw


# Allow a user in the wheel group to query the smb0 device
#perm  smb0  0660


# Allow members of group operator to cat things to the speaker
own  speaker root:operator

perm  cd0  0666
perm  xpt0  0666
perm  pass0  0666
perm  pass1  0666
perm  pass2  0666
perm  pass3  0666
perm  pass4  0666
perm  pass5  0666
perm  da0  0666
perm  da1  0666
perm  da2  0666
perm  da3  0666
perm  da4  0666
perm  dsp0.0  0666
perm  dsp1.0  0666
perm  dsp2.0  0666
perm  dsp3.0  0666
perm  dsp4.0  0666
perm  dsp4.1  0666
```

And unfortunately still not sound coming out....
I not used HAL for build ports.


----------



## cpm@ (Sep 19, 2015)

Hi Luca79,

Please, can you show the following output:
`ls -l /dev/dsp*`

Also shows this one:
`grep your_user /etc/group`


----------



## Wozzeck (Sep 19, 2015)

Depending on the compiling options,  Flash plugin and Firefox don't always use the same sound architecture. Due to some limitations related to the "linux" origin of Flash plugin, it is unable to use the sound server pulseaudio as it passes audio only through the ALSA sound architecture and you can't reroute dynamically the audio flux.

In any case you can change the default rendering sound device through terminal, and just restart Firefox after.

To list the sound devices available on your system

`cat /dev/sndstat`

To show the current settings  :

`sysctl hw.snd.default_unit`

So set to another sound device, for example 1

`sysctl hw.snd.default_unit=1`


When you use HTML5 Firefox can use the pulseaudio sound server BUT you must use a custom compiling configuration by activating the pulseaudio option.

Recompile Firefox accordingly. As a consequence this will install the dependency audio/pulseaudio if not already installed and adding audio/pavucontrol will provide you with a GUI to dynamically reroute the sound flux.

(I think gstreamer, libcanberra are also mandatory dependencies)

Run a YouTube video.
Run Pavucontrol and you will see a "cubeutils virtual sound stream" attached to Firefox moving, just clic on the "DSPx" box to switch dynamically to another "DSP" rendering device.


----------



## Luca79 (Sep 19, 2015)

cpm said:


> Hi Luca79,
> 
> Please, can you show the following output:
> `ls -l /dev/dsp*`




```
crw-rw-rw-  1 root  wheel  0x88 Sep 19 17:08 /dev/dsp0.1
crw-rw-rw-  1 root  wheel  0x86 Sep 19 17:09 /dev/dsp1.0
```



cpm said:


> Also shows this one:
> `grep your_user /etc/group`




```
wheel:*:0:root,luca
operator:*:5:root,luca
```

My user is "luca".


----------



## Luca79 (Sep 19, 2015)

Wozzeck said:


> Depending on the compiling options,  Flash plugin and Firefox don't always use the same sound architecture. Due to some limitations related to the "linux" origin of flash plugin, flash plugin is unable to use the sound server pulseaudio as it passes audio only through the ALSA sound architecture and you can't reroute dynamically the audio flux.
> 
> In any case you can change the default rendering sound device through terminal, and just restart Firefox after.
> 
> ...



`cat /dev/sndstat`:


```
Installed devices:
pcm0: <Intel Haswell (HDMI/DP 8ch)> (play)
pcm1: <Realtek ALC662 (Rear Analog)> (play/rec) default
```

In my /etc/sysctl.conf:


```
hw.snd.default_unit=1
dev.hdac.1.polling=1
```

Anyway my sound works with VLC player.
I'll try audio/pavucontrol, thanks for the suggestion.


----------



## Luca79 (Sep 19, 2015)

I SOLVED it with audio/pavucontrol

Thanks so much!


Honestly I'm not sure what fixed the problem. I updated my ports, then installed  audio/pavucontrol.
When I opened it, and used youtube, the audio was already fixed without touch anything.


----------



## free-and-bsd (Oct 19, 2015)

Yes, I remember in some of my installations (it was Linux) installing pavucontrol fixed the sound. BTW, audio/pavucontrol has to do with pulseaudio.

On my part, I've just built a completely new set of ports for 11-CURRENT, following what I stated previously -- and still, the sound in www/firefox with HTML5 works all right. Without any need for pulseaudio, although Firefox is built with pulseaudio support.
There is one trick I'm using, though: I'm using the same home directory over my installations, and I copy over /etc to every new installation.


----------



## talsamon (Oct 19, 2015)

> I copy over /etc to every new installation


I think this will cause problems. You can copy some of the files of the /etc directory, but not the whole directory.


----------



## free-and-bsd (Oct 19, 2015)

talsamon said:


> > I copy over /etc to every new installation
> 
> 
> I think this will cause problems. You can copy some of the files of the /etc directory, but not the whole directory.


Actually it doesn't. Whatever NEW files are added with the new release, they remain untouched. Whatever EXISTING files get modified upon upgrade -- it is usually changes I have to undo to keep my installation: like wiping clean my /etc/passwd and login. I've seen this many times during STABLE upgrade and mergemaster.
Although you're right, this may happen.

EDIT: Yes, you're right. I didn't have problems yet most likely because I was upgrading from STABLE to RELEASE, which is essentially the same thing. But it really is rather dangerous, as I now realize... thankfully , I've done that just once or twice...


----------

