Pressing the space bar while watching a fullscreen video doesn't play or pause
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 13:31:36 +0000 (13:31 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 13:31:36 +0000 (13:31 +0000)
commit430df77a175829d6097194722a881e790d4e5855
treea32c7035c7d70f52a3b4ffb9368463408b66ee8d
parent84875b2d6f173d4ea2db0ee05af984eea25ec27e
Pressing the space bar while watching a fullscreen video doesn't play or pause
https://bugs.webkit.org/show_bug.cgi?id=180033
<rdar://problem/33610443>

Reviewed by Eric Carlson.

Source/WebCore:

We register a "keydown" event to track when the space bar is pressed, and if the media is playing
in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
one of the media controls using the keyboard will not let the events we register for be dispatched
this far along the event dispatch phase.

Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html

* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
lead to some extraneous unhandled promise console logging that pollutes test output.
(MediaController.prototype.handleEvent):

LayoutTests:

Adding a new macOS-only test that checks that pressing the space bar while playing fullscreen
pauses the media and resumes it when pressing the space bar again.

* media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt: Added.
* media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html: Added.
* media/video-test.js:
(runWithKeyDown): Update the key to not be space since this would cause media to be paused when entering fullscreen.
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt [new file with mode: 0644]
LayoutTests/media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html [new file with mode: 0644]
LayoutTests/media/video-test.js
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/media-controller.js