声音无法在“背景"选项卡中播放 [英] Sound does not play in background tab

查看:47
本文介绍了声音无法在“背景"选项卡中播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的扩展程序,可以不断检查网站上的某些数据.

I've a small Extension which keeps checking for some data on a website.

在特定事件上,它使用以下方式播放声音文件:

On specific event it plays a sound file using:

document.getElementById("audio-beep1").play();

实际上,该页面不是前景页面,因为我将在其他选项卡上工作,因此即使检测到事件,此声音也不会播放.

However practically this page isn't the foreground page since I'll be working on some other tab so this sound does not play even though event is detected.

因此,当我单击此选项卡时-会播放声音.

So as I click this tab - sound plays.

即使选项卡不是前台选项卡,声音在事件播放时有什么方式吗?

Is there any way the sound will play on event even if the tab isn't the foreground one?

推荐答案

Google在过去约6个月左右的时间里添加了一个更新,名为"Tab Freezing"的大吊带"仿冒品.和制表符丢弃".

Google added an update in the past ~6 months or so, a The Great Suspender knockoff called "Tab Freezing" and "Tab Discarding."

这就是为什么您无法在背景标签中播放音频的原因.Google已暂停该标签,而未告知您.这也是为什么您第二次单击该标签时,它会开始播放音频-该标签未冻结,然后重新加载.对于我的一位客户,事实证明这是一场噩梦,因为他们使用的是Incontact MAX,如果Chrome有机会,就会破坏VOIP系统.

That's why you can't play audio in a background tab. Google has suspended the tab without telling you. It's also why the second you click the tab, it starts playing the audio -- the tab is unfrozen, and re-loaded. This is proving to be a nightmare for one of my clients, as they use Incontact MAX, and if Chrome gets a chance, it simply wrecks the VOIP system.

我没有适合您的解决方案.Google凭着自己不屈不挠的智慧,决定不需要配置,禁用此功能或进行任何其他操作.他们也没有问您是否要启用此功能.实话实说,对于Chrome使用的RAM数量不合理,他们似乎很尴尬,这就是他们的解决方法.

I do not have a solution for you. Google, in their great and unending wisdom, decided this feature does not need any ability to be configured, disabled, or anything of the sort. Nor did they ask you if you wanted this function to be enabled. Truth be told, they appear to be very embarrassed about the unholy amounts of RAM that Chrome uses, and this is their kludge filled workaround.

(您曾经能够在chrome://flags中禁用此功能,但他们已将其从所述窗口中删除,并且未将其添加到设置菜单中.)

(You were once able to disable this feature in chrome://flags but they have removed it from said window, and did not add it to the settings menu.)

不,告诉Chrome不要在chrome://discards中自动丢弃实际上并不会阻止它执行此操作.

And no, telling Chrome not to auto discard in chrome://discards does not actually stop it from doing this.

我听到的一个建议是循环播放一个音频文件,该音频文件既不会发出任何噪音,又无法听到它的声音,就像一秒钟的死空气循环一样.这可能会导致Chrome在积极播放音频时导致其冻结或放弃该标签页.不知道这是否行得通.我打算进行测试的另一个方法是在背景标签上使用The Great Suspender,然后查看是否会阻止Google的工作正常.

One suggestion I've heard is looping an audio file that is either not making any noise or so quiet it cannot be heard -- like a 1 second loop of dead air. This might trick Chrome into not freezing or discarding the tab, as it's actively playing audio. No idea if this will work. Another I'm planning to test out is using The Great Suspender on the background tab, and seeing if that prevents Google's thing from working.

这篇关于声音无法在“背景"选项卡中播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆