最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to disable Chrome media pause - Stack Overflow

programmeradmin4浏览0评论

I am developing a chrome extension that plays videos in the background (in an inactive tab) and I remarked that Chrome automatically pauses any video or media before the tab is focused. This is a real problem for me as I need to play videos in unfocused tabs.

I have made some research but I haven't found any solution to disable this behavior.

Is there any way to solve this ? A local solution would be great (from chrome params), even if a javascript one would be better (from the extension).

I am developing a chrome extension that plays videos in the background (in an inactive tab) and I remarked that Chrome automatically pauses any video or media before the tab is focused. This is a real problem for me as I need to play videos in unfocused tabs.

I have made some research but I haven't found any solution to disable this behavior.

Is there any way to solve this ? A local solution would be great (from chrome params), even if a javascript one would be better (from the extension).

Share Improve this question edited Dec 30, 2016 at 5:38 Pritish Vaidya 22.2k4 gold badges61 silver badges77 bronze badges asked Dec 21, 2016 at 10:32 David SeroussiDavid Seroussi 1,7102 gold badges19 silver badges35 bronze badges 19
  • How is new tab opened without gaining focus? – guest271314 Commented Dec 24, 2016 at 17:45
  • @guest271314 Well it's not opened without gaining focus. The extension does its work in a tab that was opened with purpose of being "backgrounded" – David Seroussi Commented Dec 24, 2016 at 23:47
  • "I remarked that Chrome automatically pauses any video or media before the tab is focused." , "it's not opened without gaining focus." If tab gains focus, media playback begins, yes? – guest271314 Commented Dec 25, 2016 at 0:10
  • Yes, so ? I need videos to plau without focus – David Seroussi Commented Dec 25, 2016 at 1:33
  • Could not reproduce video not playing when new tab is opened. Is Question how to achieve opening tab without gaining focus on the newly opened tab? – guest271314 Commented Dec 25, 2016 at 1:46
 |  Show 14 more ments

2 Answers 2

Reset to default 5 +25

I am not familiar with a javascript solution, but there is a local option.

This behavior can be adjusted with the flag:

Gesture requirement for media playback

When this flag is enabled, videos will not be played in the background. This flag can be disabled on the chrome://flags page or by adding to the launch options:

--disable-gesture-requirement-for-media-playback

Recently i came across same issue where, on tab focus out video was getting paused. Looks like it's a feature provided by chromium when audio track is not present in the video. To fix the issue simplest solution would be to edit the video and add placeholder audio track if it's not present. I did not faced pause issue with video having audio.

More details: https://developer.chrome./blog/media-updates-in-chrome-63-64/#background-video-track-optimizations

发布评论

评论列表(0)

  1. 暂无评论