Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[M73 merge] Sync WMPI's play/pause during RemotePlayback
Currently, if a device starts a RemotePlayback session and an external device plays/pauses the video (via the Android cast notification), the WMPI that started the casting session never gets updated. This means that the user will see the video element on their phone as "playing", with no media time update, or they will see the local video as paused when the cast video is clearly playing. This CL addresses the issue by requesting Blink to play/pause the HTMLMediaElement to match the state of the remotely playing video. This is done by bubbling up play state changes from the FlingingRenderer to WMPI via the OnRemotePlayStateChange interface. To detect an external play state change, we save whether the last command from WMPI was a play or a pause, and propagate a change whenever we get a MediaStatus update that is of the opposite play state. The cast device does not care if it receives a "PLAY" command while already playing (or "PAUSE" when paused). Therefore, after calling OnRemotePlayStateChange, FlingingRenderer does not need to treat the commands it receives any differently than a user initiated command. NOTE: This approach works reasonably well, but is not an ironclad guarantee of consistency. We are fine with missing a few changes, because all the user has to do is tap the video element once to return to a consistent state. Being too aggressive in trying to detect play state changes sometimes causes the phone to go in a feedback loop, where it constantly issues commands while the UI wildly switches between playing and pausing. Bug: 790766, 925576 Change-Id: If230c412a6a020c88970e1c9475d8fdc97976c3b Reviewed-on: https://chromium-review.googlesource.com/c/1413398 Commit-Queue: Thomas Guilbert <tguilbert@chromium.org> Reviewed-by: Xiaohan Wang <xhwang@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#626188}(cherry picked from commit 9f575d2) Reviewed-on: https://chromium-review.googlesource.com/c/1440205 Reviewed-by: Thomas Guilbert <tguilbert@chromium.org> Cr-Commit-Position: refs/branch-heads/3683@{#25} Cr-Branched-From: e510299-refs/heads/master@{#625896}
- Loading branch information