Changeset 225265 in webkit


Ignore:
Timestamp:
Nov 29, 2017 5:31:36 AM (6 years ago)
Author:
graouts@webkit.org
Message:

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:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r225260 r225265  
     12017-11-29  Antoine Quint  <graouts@apple.com>
     2
     3        Pressing the space bar while watching a fullscreen video doesn't play or pause
     4        https://bugs.webkit.org/show_bug.cgi?id=180033
     5        <rdar://problem/33610443>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Adding a new macOS-only test that checks that pressing the space bar while playing fullscreen
     10        pauses the media and resumes it when pressing the space bar again.
     11
     12        * media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback-expected.txt: Added.
     13        * media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html: Added.
     14        * media/video-test.js:
     15        (runWithKeyDown): Update the key to not be space since this would cause media to be paused when entering fullscreen.
     16        * platform/ios-simulator/TestExpectations:
     17
    1182017-11-28  Zan Dobersek  <zdobersek@igalia.com>
    219
  • trunk/LayoutTests/media/video-test.js

    r223626 r225265  
    415415    if (window.testRunner) {
    416416        if (eventSender.keyDown)
    417             eventSender.keyDown(" ", []);
     417            eventSender.keyDown("a", []);
    418418        else
    419419            eventSender.mouseDown();
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r225222 r225265  
    129129media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html [ Skip ]
    130130media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html [ Skip ]
     131media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html [ Skip ]
    131132media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html [ Skip ]
    132133media/modern-media-controls/media-documents/media-document-video-mac-sizing.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r225264 r225265  
     12017-11-29  Antoine Quint  <graouts@apple.com>
     2
     3        Pressing the space bar while watching a fullscreen video doesn't play or pause
     4        https://bugs.webkit.org/show_bug.cgi?id=180033
     5        <rdar://problem/33610443>
     6
     7        Reviewed by Eric Carlson.
     8
     9        We register a "keydown" event to track when the space bar is pressed, and if the media is playing
     10        in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
     11        one of the media controls using the keyboard will not let the events we register for be dispatched
     12        this far along the event dispatch phase.
     13
     14        Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
     15
     16        * Modules/modern-media-controls/media/media-controller.js:
     17        (MediaController):
     18        (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
     19        lead to some extraneous unhandled promise console logging that pollutes test output.
     20        (MediaController.prototype.handleEvent):
     21
    1222017-11-28  Brent Fulgham  <bfulgham@apple.com>
    223
  • trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js

    r225222 r225265  
    5858
    5959        media.addEventListener(this.fullscreenChangeEventType, this);
     60
     61        window.addEventListener("keydown", this);
    6062    }
    6163
     
    101103    {
    102104        if (this.media.paused)
    103             this.media.play();
     105            this.media.play().catch(e => {});
    104106        else
    105107            this.media.pause();
     
    159161            if (event.type === "webkitpresentationmodechanged")
    160162                this._returnMediaLayerToInlineIfNeeded();
     163        } else if (event.type === "keydown" && this.isFullscreen && event.key === " ") {
     164            this.togglePlayback();
     165            event.preventDefault();
    161166        }
    162167    }
Note: See TracChangeset for help on using the changeset viewer.