Title: [277203] trunk/Source/WebCore
Revision
277203
Author
[email protected]
Date
2021-05-07 15:00:57 -0700 (Fri, 07 May 2021)

Log Message

[iOS] fix inconsistency around the meaning of `rate` and `defaultPlaybackRate` between WebKit and AVKit
https://bugs.webkit.org/show_bug.cgi?id=225532
<rdar://problem/77629276>

Reviewed by Eric Carlson.

In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after
pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after
ending scanning, with the `playbackRate` being used in all other cases, including when
resuming after pausing. As such, WebKit should return the `playbackRate` instead of the
`defaultPlaybackRate` in these cases when communicating with AVKit.

* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController setRate:]):
Also `setDefaultPlaybackRate:` if not paused (i.e. `rate != 0`) since WebKit's definition of
`playbackRate` does not change when paused.

* platform/ios/PlaybackSessionInterfaceAVKit.mm:
(WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
Make sure to `setDefaultPlaybackRate:` before `setRate:` as the latter can affect the former.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277202 => 277203)


--- trunk/Source/WebCore/ChangeLog	2021-05-07 21:54:02 UTC (rev 277202)
+++ trunk/Source/WebCore/ChangeLog	2021-05-07 22:00:57 UTC (rev 277203)
@@ -1,3 +1,26 @@
+2021-05-07  Devin Rousso  <[email protected]>
+
+        [iOS] fix inconsistency around the meaning of `rate` and `defaultPlaybackRate` between WebKit and AVKit
+        https://bugs.webkit.org/show_bug.cgi?id=225532
+        <rdar://problem/77629276>
+
+        Reviewed by Eric Carlson.
+
+        In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after
+        pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after
+        ending scanning, with the `playbackRate` being used in all other cases, including when
+        resuming after pausing. As such, WebKit should return the `playbackRate` instead of the
+        `defaultPlaybackRate` in these cases when communicating with AVKit.
+
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController setRate:]):
+        Also `setDefaultPlaybackRate:` if not paused (i.e. `rate != 0`) since WebKit's definition of
+        `playbackRate` does not change when paused.
+
+        * platform/ios/PlaybackSessionInterfaceAVKit.mm:
+        (WebCore::PlaybackSessionInterfaceAVKit::rateChanged):
+        Make sure to `setDefaultPlaybackRate:` before `setRate:` as the latter can affect the former.
+
 2021-05-07  Carlos Garcia Campos  <[email protected]>
 
         Do not try to remove and already removed node while deleting selection

Modified: trunk/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm (277202 => 277203)


--- trunk/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm	2021-05-07 21:54:02 UTC (rev 277202)
+++ trunk/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm	2021-05-07 22:00:57 UTC (rev 277203)
@@ -126,8 +126,8 @@
 
 void PlaybackSessionInterfaceAVKit::rateChanged(bool isPlaying, float playbackRate, float defaultPlaybackRate)
 {
+    [m_playerController setDefaultPlaybackRate:defaultPlaybackRate];
     [m_playerController setRate:isPlaying ? playbackRate : 0.];
-    [m_playerController setDefaultPlaybackRate:defaultPlaybackRate];
 }
 
 void PlaybackSessionInterfaceAVKit::seekableRangesChanged(const TimeRanges& timeRanges, double lastModifiedTime, double liveUpdateInterval)

Modified: trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm (277202 => 277203)


--- trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2021-05-07 21:54:02 UTC (rev 277202)
+++ trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2021-05-07 22:00:57 UTC (rev 277203)
@@ -196,6 +196,13 @@
     if (!_rate)
         return;
 
+    // In AVKit, the `defaultPlaybackRate` is used when playback starts, such as resuming after
+    // pausing. In WebKit, however, `defaultPlaybackRate` is only used when first loading and after
+    // ending scanning, with the `playbackRate` being used in all other cases, including when
+    // resuming after pausing. As such, WebKit should return the `playbackRate` instead of the
+    // `defaultPlaybackRate` in these cases when communicating with AVKit.
+    [self setDefaultPlaybackRate:_rate];
+
     if (self.delegate && self.delegate->playbackRate() != _rate)
         self.delegate->setPlaybackRate(_rate);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to