-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
popover: should audio/video in a popover keep playing after popover is dismissed? #9770
Comments
/cc @josepharhar who was looking into this. |
I don't think this is specific to popovers. What about dialogs? What happens when you disconnect a video or audio element from the document? display:none is how we decided to make popovers be in a closed state, and we are inheriting all of the behaviors that come along with that. Should we otherwise emulate different behavior from display:none, like how things behave when disconnecting from the document? What do iframes do when they are display:none vs disconnected? |
I wonder if instead of changing popovers behaviour this should be an attribute (pausewhenhidden?) on video/audio elements so the solution is agnostic of whether it's popover, dialog or futureelement. This way it's also opt-in. |
After I wrote https://brucelawson.co.uk/2023/html-popover-videos-display-blackhole/, @zcorpan suggested "Maybe an attribute |
I've raised #9793 where we can discuss the addition of |
Thinking further about autopause, this wouldn't necessarily solve my use case. I'm iframing a video from YouTube (but could be vimeo, or soundcloud, or bandcamp, or any number of other similar services) so don't have access to the underlying media element. |
Are cross-origin iframes supposed to be capable of knowing when their parent frame set them to display:none? If not, I'm not sure that we can make this work. |
I think they can with an IntersectionObserver, no? |
When you remove a In #9793, it's been proposed to add a The behavior specified for "when you remove a media element from the DOM" is there because removing a playing |
I've used a MutationObserver in my UI boilerplate to "fix" the issue with embedded videos. Example video player which uses It caters for browsers that support lazy loading iframes, and ones that don't. |
To be able to undo the pause (with script), we need to make sure the the scheduling of the pausing is the same as the closing/hiding of the popover. Otherwise the audio could have an interruption if e.g. the popover is hidden and the audio is paused in separate tasks. |
(Originally filed as a Chrome bug)
Right now allowing playback in
display: none
seems to be an intended behavior, so dismissing a popover doesn't change playback status, and A/V will keep playing.On the other hand, this behavior can be confusing to some people.
I don't have an opinion here, just filing this issue to discuss what the correct behavior should be.
The text was updated successfully, but these errors were encountered: