New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 694384 link

Starred by 5 users

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Feature

Blocked on:
issue 721557

Blocking:
issue 716066



Sign in to add a comment

Video keeps playing with tablet-like power button

Project Member Reported by tbuck...@chromium.org, Feb 21 2017

Issue description

Chrome Version: 57.0.2987.54 (Official Build) beta (64-bit)
OS: Chrome

What steps will reproduce the problem?
(1) Play YouTube video on convertible device
(2) Press power button

What is the expected result?
Screen is off, video is paused

What happens instead?
Screen is off, video keeps playing

I think it would be preferable to at least mute the audio.

@warx/derat what do you think?
 

Comment 1 by derat@chromium.org, Feb 21 2017

Labels: -Type-Bug Type-Feature
Uh, hmm. I think there was discussion about this years ago, with the idea of doing something similar when the user locks the screen. Pausing was pretty much impossible at the time. Most video content then was Flash, and there wasn't any way to tell Flash content to pause itself.

Now, everyone uses <audio> and <video>, but I think that it's still the case that Chrome can't go in and pause random elements at will without breaking sites. If you want this, I think you need to go at it from the angle of getting YouTube, Vimeo, etc. to pause their own content.

I see that this actually happens when using Chrome on an Android device -- both the YouTube and Vimeo mobile sites pause videos when I tap the power button. They may be using either focus/blur events or the Page Visibility API (https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API). I'm guessing they only use it on their mobile sites, though. I don't know that it would be possible for them to also use it for desktop without breaking a bunch of use cases there (e.g. playing music on YouTube in a background tab).

If you just want to mute audio, that's much easier to do and doesn't require any cooperation from web pages, but it'll also break the use case of using a device to play audio while its screen is off... which I think we probably don't want to do. :-(

Let me know if there's some other option that I'm missing.
The only other quick-fix option I can see is actually putting the device in standby, which then makes waking take longer.

Programmatically pausing a YouTube video seems to work. Could we auto-pause videos/audio (perhaps with a whitelist of safe sites or blacklist of unsafe sites) and then mute audio as well for sites we can't pause (use Flash, would break the site, etc)? That way we both try to do the right thing (pause the content) but also avoid having audio playing.

I can send a couple proposals to UI Review if you're comfortable with them. Options seem to be:
1) Do nothing -- treat like lock screen
2) Mute audio
3) Mute audio + try to pause sites -- risk breaking some + inconsistent across sites
4) Hibernate immediately instead of after delay

Comment 3 by derat@chromium.org, Feb 27 2017

In case it was unclear, I think that automatically pausing on focus/blur or using the Page Visibility API requires involvement from YouTube et al -- it's not something we can do from the Chrome OS side.

So the options are:

1) Do nothing
2) Mute audio
3) Suspend immediately

(The word "hibernate" refers to suspending to disk, which we don't do. See https://en.wikipedia.org/wiki/Hibernation_(computing) .)
As you mentioned previously, I don't think we want websites to pause media using the Page Visibility API since many use cases involve it still running in the background.

So there's no way for Chrome to go through open tabs and pause all <audio>/<video>?

Comment 5 by derat@chromium.org, Feb 27 2017

Components: Blink>Media>Audio Blink>Media>Video
Not without breaking all sites that don't expect their audio/video elements to be paused without them having asked for it, I think. (Adding some components to get confirmation from people who understand this better.)

Comment 6 by derat@chromium.org, Feb 27 2017

Hmm, that didn't auto-cc anyone. I'm not sure who leads <audio>/<video>, but we should ask them. :-P
Right, but YouTube handles it fine. I'd imagine that just special-casing a few top video/music sites that we know handle it well will cover a good portion of cases.

Regardless, I'll run the options past UI Review and mention that we're also exploring pausing content. I'll see if we can find someone from Chrome media to help.

Comment 8 by derat@chromium.org, Feb 27 2017

The desktop YouTube web site doesn't handle this at all, at least on the kevin device where I just tested this. Video keeps playing when I lock the screen.

Are you talking about mobile YouTube web? Like I said before, I suspect that mobile YT (and Vimeo) have that behavior because they listen for the page losing the focus. They wouldn't want to update their desktop site to have similar behavior because it would break a bunch of use cases.
Sorry, to clarify if I open dev tools and run $("video").pause() on Youtube, the video pauses and the controls correctly update. As the OS/browser it seems like we could do that automatically when the user locks their device.

Comment 10 by derat@chromium.org, Feb 28 2017

Interesting. Can you loop in someone from the <video> side, and someone else from YouTube, to get their thoughts?
Cc: mlamouri@chromium.org

Comment 12 by warx@chromium.org, May 11 2017

Blockedon: 721557

Comment 13 by derat@chromium.org, May 18 2017

Blocking: 716066
Project Member

Comment 14 by bugdroid1@chromium.org, May 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/67a6d3fc1811bf403d56f59cf4099e3f88b68063

commit 67a6d3fc1811bf403d56f59cf4099e3f88b68063
Author: warx <warx@chromium.org>
Date: Wed May 31 21:00:21 2017

cros: Suspend media sessions with display off trigger by tablet power button

Changes:
Convertible/tablet device's side power button is described as tablet power button. It will set display forced-off or forced-on just like android phone. This CL is going to add extra functionality to tablet power button, which is suspending media sessions when display is forced-off by tablet power button.

BUG= 694384 
TEST=tested on kevin, with two youtube browser tabs and one youtube arc++ app. arc++ app's audio is not controlled by the tablet power button.
(1) browser tabs audio playing, pressing power button to set display off, audio will pause.
(2) browser tabs audio pausing, pressing power button to set display off will still pause audio, pressing again will keep audio paused.

Also added test coverage in TabletPowerButtonControllerTest.

Review-Url: https://codereview.chromium.org/2821303004
Cr-Commit-Position: refs/heads/master@{#476018}

[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/ash/shell_delegate.h
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/ash/system/power/tablet_power_button_controller.cc
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/ash/system/power/tablet_power_button_controller_unittest.cc
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/ash/test/test_shell_delegate.cc
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/ash/test/test_shell_delegate.h
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/chrome/browser/ui/ash/chrome_shell_delegate.cc
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/chrome/browser/ui/ash/chrome_shell_delegate.h
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/content/browser/media/session/media_session_browsertest.cc
[modify] https://crrev.com/67a6d3fc1811bf403d56f59cf4099e3f88b68063/content/browser/media/session/media_session_controllers_manager.cc

Status: Started (was: Assigned)
Is this implemented now?

Comment 17 by warx@chromium.org, Aug 8 2017

Status: Fixed (was: Started)
yes for chrome browser media

Comment 18 by warx@chromium.org, Aug 8 2017

CL is landed in 61.0.3117.0
Status: Verified (was: Fixed)
Verified in Chrome OS 9827.0.0, 62.0.3176.0. 
Cc: avayvod@chromium.org warx@chromium.org dalecur...@chromium.org dah...@chromium.org jorgelo@chromium.org battre@chromium.org
 Issue 716066  has been merged into this issue.

Sign in to add a comment