New issue
Advanced search Search tips

Issue 737744 link

Starred by 3 users

Issue metadata

Status: Duplicate
Merged: issue 382879
Owner: ----
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

DOM Moved <video> element is paused (affects Chromecast)

Reported by nekr.fab...@gmail.com, Jun 28 2017

Issue description

Steps to reproduce the problem:
1. Open https://omroep-pwa-bmrzqpwxnl.now.sh/news/3457428 on Android
2. Start playing video
3. Cast it to Chromecast
4. Hit Android's back button

What is the expected behavior?
Video keeps playing on Chromecast

What went wrong?
Video is paused on Chromecast

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version:   Channel: beta
OS Version: 
Flash Version: 

This isn't specific to Chromecast, but mostly affects it. When you DOM-move whatever <video> Chrome pauses it. It seems like this behavior was (accidentally?) kept for Chromecast. So even if you start playing video again immediately after moving, it still will flicker a bit on the Chromecast because of delay.

It's important to put out that closing a tab with the <video> or reloading it doesn't stop or pause the media on Chromecast, so behavior with DOM-moved media feels very weird.
 
Update: "chromcasting" in question is casting with Chrome's native media controls, not with any JS api.
Cc: mlamouri@chromium.org
Owner: avayvod@chromium.org
Components: Internals>Cast>MediaFling
Labels: M-60 M-59 M-61
The following repro steps worked for me:
1. Open https://omroep-pwa-bmrzqpwxnl.now.sh/
2. Click on a video thumbnail to navigate to the video page.
3. Play & cast the video
4. Hit the back button to navigate back

Reproduces on Canary 61 and Stable 59.
Status: Assigned (was: Unconfirmed)
Cc: foolip@chromium.org
Status: Started (was: Assigned)
The bug seems to occur because of the InvokeLoadAlgorithm in HTMLMediaElement::DidMoveToNewDocument() that has a FIXME before it:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp?rcl=ae67f19c066747ebc8f5cfe2e705b8169b508c21&l=603

git hyper-blame unhelpfully points to a patch by liberato@ that didn't touch that code. Could be foolip@ or acolwell@ who put it in place long time ago?

I wonder if we can remove it.
Last time I looked at this, it wasn't a trivial change. It's something we would like to do though so it wouldn't be a bad use of time to investigate more but it will not allow us to fix the crash up to stable/beta.
Well, it's not the cause of the crash until it's proved to be, just the pause on Chromecast.
I don't believe this is cause of the crash. I avoided the crash by stopping using events in MediaElement#remote. I outlined some of the details in the crash issue. I don't remember how exactly, but crash was tied to `connect` event. So now I listen to those events but unsubscribe from them on `connecting` event and start polling state with setInterval() instead. 
Labels: -M-59 -M-60 -M-61
Owner: ----
Status: Available (was: Started)
This would seem to be the cause of this interop issue found on webcompat.com (not specific to Chromecast): https://webcompat.com/issues/8777

It would be good to address this before more sites come to rely on this auto-pausing quirk. Edge and Gecko do not pause on moving video/audio elements in the DOM (WebKit has its own issue for which I will file a bug).

I've attached a testcase in case it helps (but note that this affects not just <video> elements as in the testcase, but also <audio> elements).
testcase.html
656 bytes View Download
Labels: Hotlist-Interop
> (WebKit has its own issue for which I will file a bug)

WebKit renders empty (black) buffer to Picture-in-Picture video when it's off-dom, i.e. moving it in dom blinks the video. Audio plays fine.

Not sure if this is the same issues you planned file.
>Not sure if this is the same issues you planned file.

No, it looks like WebKit currently restarts a video when I move it around in the DOM, using my above testcase (the video and audio both restart at the beginning). Firefox and Edge simply continue smoothly playing it.

I filed this bug: https://bugs.webkit.org/show_bug.cgi?id=176840
If this still matter, this issues causes some compatibility issues in frameworks: https://github.com/developit/preact/issues/747

Clearly, moving DOM elements such as video, audio or canvas shouldn't affect its internal (i.e. playing) state.
The spec for this is slightly below https://html.spec.whatwg.org/multipage/media.html#time-marches-on, at "When a media element is removed from a Document".

In short, removing the media element should pause, but not synchronously, only if it's not reinserted somewhere else, which is the case when moving.
Mergedinto: 382879
Status: Duplicate (was: Available)
This is a duplicate of  bug 382879 .

Sign in to add a comment