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).
- 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
2 Answers
Reset to default 5 +25I 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