Mar*_*ter 15 alsa firefox audio browser
我有一个板载声卡,还有一个连接的蓝牙耳机。我已经在/etc/asound.conf
以下位置配置了蓝牙设备:
# cat /etc/asound.conf
pcm.bluetooth {
type bluetooth
device 12:34:56:78:9a:bc
profile "auto"
}
ctl.bluetooth {
type bluetooth
}
Run Code Online (Sandbox Code Playgroud)
默认情况下,板载卡用于所有声音(显然,默认板载卡甚至不需要在asound.conf中列出)
当我想让应用程序使用我的蓝牙 alsa 设备时,我必须指定它,例如:
mplayer -ao alsa:device=bluetooth file.mp3
Run Code Online (Sandbox Code Playgroud)
这对我来说很好。但是我需要一种方法来告诉我的浏览器也使用蓝牙 alsa 设备。
我找到了一种如何使用--alsa-output-device
命令行选项启动 Chrome 的方法:
chromium --alsa-output-device=bluetooth
Run Code Online (Sandbox Code Playgroud)
我需要一种类似的方式来启动 Firefox,但我找不到任何方式。
如何告诉 Firefox 使用我的蓝牙 alsa 设备,而无需修改/etc/asound.conf
或~/.asoundrc
每次?
我遵循了@lgeorget 的建议,/etc/asound.conf
现在看起来像这样:
pcm.!default {
type plug
slave.pcm {
@func getenv
vars [ ALSAPCM ]
default "hw:0,0"
}
}
pcm.bluetooth {
type bluetooth
device 12:34:56:78:9a:bc
profile "auto"
}
ctl.bluetooth {
type bluetooth
}
Run Code Online (Sandbox Code Playgroud)
当我使用 启动 Firefox 时ALSAPCM=bluetooth firefox
,我的蓝牙耳机中确实有声音,但 Firefox 以 100% CPU(在我的 4 个内核上)运行,并且 youtube 视频以 10 倍速度播放(并且声音相应地(乱码)。我没有了解发生了什么。当我在没有 的情况下启动 Firefox 时ALSAPCM=bluetooth
,一切正常,并且声音在默认的 alsa 设备上播放。
lge*_*get 11
显然 firefox 没有选项,但您可以通过环境变量操作 ALSA 输出。
尝试例如:
ALSA_PCM_CARD=bluetooth firefox
Run Code Online (Sandbox Code Playgroud)
或者,如果这不起作用,请尝试编写一些 .asoundrc 脚本
pcm.!default {
type plug
slave.pcm {
@func getenv
vars [ ALSAPCM ]
default "hw:hdmi"
}
}
Run Code Online (Sandbox Code Playgroud)
(用您的普通 pcm 替换“hw:hdmi”)。然后,如果您希望程序使用特定的 PCM,请使用:
ALSAPCM=bluetooth firefox
Run Code Online (Sandbox Code Playgroud)
资料来源:
归档时间: |
|
查看次数: |
11742 次 |
最近记录: |