Changeset 280330 in webkit


Ignore:
Timestamp:
Jul 26, 2021 5:25:42 PM (12 months ago)
Author:
Jean-Yves Avenard
Message:

Video pauses after scrubbing with Touch Bar
https://bugs.webkit.org/show_bug.cgi?id=228277
rdar://80606886

Reviewed by Jer Noble.

Source/WebCore:

In https://trac.webkit.org/r206487 ; in order to ensure that the playback state
was properly reflected following a seek using the touch bar, the element was paused.
It's unclear if that workaround is still required, but for now we will record if the
element was playing before the seek and if so, resume playback once the seek completes.
Now that the touch bar and Now Playing are hooked to the Media Session action handlers
the behaviour change will occur for all those components.

Test: media/media-session/play-after-seek.html

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::HTMLMediaElement): Initialize new member in constructor.
(WebCore::HTMLMediaElement::clearSeeking):
(WebCore::HTMLMediaElement::finishSeek): Call play() once seek completes if the element
was playing before.
(WebCore::HTMLMediaElement::pause): Ensure that if pause() is called before the seek
completes, the element stays paused.
(WebCore::HTMLMediaElement::handleSeekToPlaybackPosition): Record playing state before
pausing the element.

  • html/HTMLMediaElement.h: Add new boolean member.

LayoutTests:

  • media/media-session/play-after-seek-expected.txt: Added.
  • media/media-session/play-after-seek.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r280329 r280330  
     12021-07-26  Jean-Yves Avenard  <jya@apple.com>
     2
     3        Video pauses after scrubbing with Touch Bar
     4        https://bugs.webkit.org/show_bug.cgi?id=228277
     5        rdar://80606886
     6
     7        Reviewed by Jer Noble.
     8
     9        * media/media-session/play-after-seek-expected.txt: Added.
     10        * media/media-session/play-after-seek.html: Added.
     11
    1122021-07-26  Eric Hutchison  <ehutchison@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r280323 r280330  
     12021-07-26  Jean-Yves Avenard  <jya@apple.com>
     2
     3        Video pauses after scrubbing with Touch Bar
     4        https://bugs.webkit.org/show_bug.cgi?id=228277
     5        rdar://80606886
     6
     7        Reviewed by Jer Noble.
     8
     9        In https://trac.webkit.org/r206487 ; in order to ensure that the playback state
     10        was properly reflected following a seek using the touch bar, the element was paused.
     11        It's unclear if that workaround is still required, but for now we will record if the
     12        element was playing before the seek and if so, resume playback once the seek completes.
     13        Now that the touch bar and Now Playing are hooked to the Media Session action handlers
     14        the behaviour change will occur for all those components.
     15
     16        Test: media/media-session/play-after-seek.html
     17
     18        * html/HTMLMediaElement.cpp:
     19        (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize new member in constructor.
     20        (WebCore::HTMLMediaElement::clearSeeking):
     21        (WebCore::HTMLMediaElement::finishSeek): Call play() once seek completes if the element
     22        was playing before.
     23        (WebCore::HTMLMediaElement::pause): Ensure that if pause() is called before the seek
     24        completes, the element stays paused.
     25        (WebCore::HTMLMediaElement::handleSeekToPlaybackPosition): Record playing state before
     26        pausing the element.
     27        * html/HTMLMediaElement.h: Add new boolean member.
     28
    1292021-07-26  Ryosuke Niwa  <rniwa@webkit.org>
    230
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r280308 r280330  
    415415    , m_seeking(false)
    416416    , m_seekRequested(false)
     417    , m_wasPlayingBeforeSeeking(false)
    417418    , m_sentStalledEvent(false)
    418419    , m_sentEndEvent(false)
     
    30823083    m_seekRequested = false;
    30833084    m_pendingSeekType = NoSeek;
     3085    m_wasPlayingBeforeSeeking = false;
    30843086    invalidateCachedTime();
    30853087}
     
    30873089void HTMLMediaElement::finishSeek()
    30883090{
     3091    bool wasPlayingBeforeSeeking = m_wasPlayingBeforeSeeking;
    30893092    // 4.8.10.9 Seeking
    30903093    // 14 - Set the seeking IDL attribute to false.
     
    31123115        m_mediaSource->monitorSourceBuffers();
    31133116#endif
     3117    if (wasPlayingBeforeSeeking)
     3118        playInternal();
    31143119}
    31153120
     
    35663571
    35673572    pauseInternal();
     3573    // If we have a pending seek, ensure playback doesn't resume.
     3574    m_wasPlayingBeforeSeeking = false;
    35683575}
    35693576
     
    48554862    if (!m_isScrubbingRemotely) {
    48564863        m_isScrubbingRemotely = true;
    4857         if (!paused())
     4864        if ((m_wasPlayingBeforeSeeking = !paused()))
    48584865            pauseInternal();
    48594866    }
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r280308 r280330  
    10721072    bool m_seeking : 1;
    10731073    bool m_seekRequested : 1;
     1074    bool m_wasPlayingBeforeSeeking : 1;
    10741075
    10751076    // data has not been loaded since sending a "stalled" event
Note: See TracChangeset for help on using the changeset viewer.