如何绕过Chrome在后台标签页中禁用视频的自动播放 [英] How to bypass Chrome disabling autoplay of video's in background tabs

查看:611
本文介绍了如何绕过Chrome在后台标签页中禁用视频的自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的朋友正在建立一个像Musare这样的广播电台的网站,上面有互相播放的YouTube视频的播放列表.

my friends and I are making a website that acts like a radio station called Musare with playlists of YouTube videos that play after each other.

最近,Chrome引入了一个新的功能",该功能会自动禁用背景"标签中的视频自动播放功能,而无需关闭此功能.这会破坏我们的网站,因为用户不想继续回到该网站开始播放歌曲.这也破坏了其他大型网站,例如YouTube播放列表,Facebook聊天通知声音和许多音乐共享网站.

Recently Chrome introduced a new 'feature' that automatically disables autoplaying of videos in background tabs with no option to turn this off. This breaks our site because users don't want to keep going back to the site to start a song. This also broke other big sites, like YouTube playlists, Facebook chat notification sound and a lot of music sharing sites.

到目前为止,很多网站都找到了绕过此问题的解决方案,例如dubtrack.fm,YouTube,Facebook以及其他一些网站.

By now, a lot of sites have found solutions to bypass this, like dubtrack.fm, YouTube, Facebook and probably some other sites as well.

有人在 https://codereview.chromium.org/1414853003上为其提供选项. /,但要在主要的Google Chrome浏览器中可能要花几周甚至几个月的时间.

There is someone working on making an option for it at https://codereview.chromium.org/1414853003/, but that might take weeks or even months for it to be in the main Google Chrome.

如果有人知道如何绕过此操作,请告诉我.

If anyone knows how to bypass this, please let me know.

先谢谢您了:)

  • 在当前视频结束之前开始播放另一视频-没有成功
  • 纠缠玩家变量-没有成功
  • 可能其他事情-没有成功
  • 我们正在使用YouTube API.我们使用YT.Player和youtubePlayer.loadVideoById(id)
  • SoundCloud流与SC.Stream配合良好.
  • 我们项目的源代码位于 https://github.com/Musare/Musare

推荐答案

因此,在经过数小时的尝试和研究之后,我终于找到了如何绕开它的方法.

So I have found out how to bypass it finally, after many hours of trying and researching.

如果您只是使用YT.Player构造函数初始化YouTube的iframe播放器,则可以仅使用播放器变量并使用yourPlayerVariable.loadVideoById(id).

If you just initialize the iframe player of YouTube by using the YT.Player constructor, you can then just use the player variable and use yourPlayerVariable.loadVideoById(id).

您必须先进入选项卡才能启动,但此后它就可以加载和播放视频,而无需回到选项卡.如果您删除并重新添加了iframe,则必须返回该iframe才能重新启动.

You have to first go to the tab for it to start, but after that it will be able to load and play video's without you having to go back to the tab. If you remove and re-add the iframe, you will have to go back for it to start again.

这篇关于如何绕过Chrome在后台标签页中禁用视频的自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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