Title: [261648] branches/safari-610.1.13-branch/Source/WebCore
Revision
261648
Author
[email protected]
Date
2020-05-13 13:47:22 -0700 (Wed, 13 May 2020)

Log Message

Cherry-pick r261587. rdar://problem/63195680

    [iOS] REGRESSION: (r261342) Play/pause button doesn't work upon first entering fullscreen mode
    https://bugs.webkit.org/show_bug.cgi?id=211797
    <rdar://problem/63118008>

    Reviewed by Eric Carlson.

    In r261342 we added code to handle "canplay" and "waiting" events without ever actually
    adding event listeners for them. So when we enter fullscreen before the "canplay" event, we
    never re-evaluate whether we're playing or not.

    Drive-by fix: Also noticed that stalls will cause the play/pause toggle to switch from the
    "pause icon" to the "play icon", which is incorrect; we're still "playing" event when we're
    stalled. So when we are in the stalled state, set the "playbackRate" property to some very
    small, but non-zero value. This will cause the playback slider to stop progressing, but
    won't also cause the play/pause button to swap states.

    * platform/cocoa/PlaybackSessionModelMediaElement.mm:
    (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
    (WebCore::PlaybackSessionModelMediaElement::observedEventNames):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261587 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.13-branch/Source/WebCore/ChangeLog (261647 => 261648)


--- branches/safari-610.1.13-branch/Source/WebCore/ChangeLog	2020-05-13 20:47:20 UTC (rev 261647)
+++ branches/safari-610.1.13-branch/Source/WebCore/ChangeLog	2020-05-13 20:47:22 UTC (rev 261648)
@@ -1,5 +1,54 @@
 2020-05-13  Alan Coon  <[email protected]>
 
+        Cherry-pick r261587. rdar://problem/63195680
+
+    [iOS] REGRESSION: (r261342) Play/pause button doesn't work upon first entering fullscreen mode
+    https://bugs.webkit.org/show_bug.cgi?id=211797
+    <rdar://problem/63118008>
+    
+    Reviewed by Eric Carlson.
+    
+    In r261342 we added code to handle "canplay" and "waiting" events without ever actually
+    adding event listeners for them. So when we enter fullscreen before the "canplay" event, we
+    never re-evaluate whether we're playing or not.
+    
+    Drive-by fix: Also noticed that stalls will cause the play/pause toggle to switch from the
+    "pause icon" to the "play icon", which is incorrect; we're still "playing" event when we're
+    stalled. So when we are in the stalled state, set the "playbackRate" property to some very
+    small, but non-zero value. This will cause the playback slider to stop progressing, but
+    won't also cause the play/pause button to swap states.
+    
+    * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+    (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
+    (WebCore::PlaybackSessionModelMediaElement::observedEventNames):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-05-12  Jer Noble  <[email protected]>
+
+            [iOS] REGRESSION: (r261342) Play/pause button doesn't work upon first entering fullscreen mode
+            https://bugs.webkit.org/show_bug.cgi?id=211797
+            <rdar://problem/63118008>
+
+            Reviewed by Eric Carlson.
+
+            In r261342 we added code to handle "canplay" and "waiting" events without ever actually
+            adding event listeners for them. So when we enter fullscreen before the "canplay" event, we
+            never re-evaluate whether we're playing or not.
+
+            Drive-by fix: Also noticed that stalls will cause the play/pause toggle to switch from the
+            "pause icon" to the "play icon", which is incorrect; we're still "playing" event when we're
+            stalled. So when we are in the stalled state, set the "playbackRate" property to some very
+            small, but non-zero value. This will cause the playback slider to stop progressing, but
+            won't also cause the play/pause button to swap states.
+
+            * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+            (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
+            (WebCore::PlaybackSessionModelMediaElement::observedEventNames):
+
+2020-05-13  Alan Coon  <[email protected]>
+
         Cherry-pick r261485. rdar://problem/63195719
 
     Fix assertion after r261414

Modified: branches/safari-610.1.13-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm (261647 => 261648)


--- branches/safari-610.1.13-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-05-13 20:47:20 UTC (rev 261647)
+++ branches/safari-610.1.13-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-05-13 20:47:22 UTC (rev 261648)
@@ -47,6 +47,13 @@
 
 namespace WebCore {
 
+// This is the rate which we report to our clients, namely AVKit, when playback has stalled.
+// The value must be non-zero, so as to differentiate "playing-but-stalled" from "paused". But
+// the value also must be very small, so there is no visible movement in the system provided
+// timeline slider when stalled. The value below will cause the slider to move 1 second every
+// 3 years, so meets both goals.
+static const float StalledPlaybackRate = 0.00000001f;
+
 PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement()
     : EventListener(EventListener::CPPEventListenerType)
 {
@@ -143,8 +150,8 @@
         || eventName == eventNames().ratechangeEvent
         || eventName == eventNames().waitingEvent
         || eventName == eventNames().canplayEvent) {
-        bool isPlaying = this->isPlaying() && !isStalled();
-        float playbackRate = this->playbackRate();
+        bool isPlaying = this->isPlaying();
+        float playbackRate = isStalled() ? StalledPlaybackRate : this->playbackRate();
         for (auto client : m_clients)
             client->rateChanged(isPlaying, playbackRate);
     }
@@ -391,6 +398,7 @@
 {
     // FIXME(157452): Remove the right-hand constructor notation once NeverDestroyed supports initializer_lists.
     static NeverDestroyed<Vector<AtomString>> names = Vector<AtomString>({
+        eventNames().canplayEvent,
         eventNames().durationchangeEvent,
         eventNames().pauseEvent,
         eventNames().playEvent,
@@ -398,6 +406,7 @@
         eventNames().timeupdateEvent,
         eventNames().progressEvent,
         eventNames().volumechangeEvent,
+        eventNames().waitingEvent,
         eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent,
     });
     return names.get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to