Title: [282046] trunk/Source/WebCore
Revision
282046
Author
[email protected]
Date
2021-09-04 09:55:13 -0700 (Sat, 04 Sep 2021)

Log Message

[iOS] Play/pause button's icon does not update when pausing in full screen
https://bugs.webkit.org/show_bug.cgi?id=229904

Reviewed by Eric Carlson.

AVKit expects KVO notification of `rate` to update the play/pause icon.
However, with the changes in r280840, `-[WebAVPlayerController setRate]`
will be called by AVKit only. When a user taps the play/pause button,
`-[WebAVPlayerController setRate:fromJavaScript:]` will be called, which
does not generate the KVO notification.

This patch fixes the issue by manually generate the KVO notification.

To be safe, this patch manually generates the KVO notification for
property `defaultPlaybackRate` as well.

Tested manually.

* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController setDefaultPlaybackRate:fromJavaScript:]):
(-[WebAVPlayerController setRate:fromJavaScript:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282045 => 282046)


--- trunk/Source/WebCore/ChangeLog	2021-09-04 13:20:39 UTC (rev 282045)
+++ trunk/Source/WebCore/ChangeLog	2021-09-04 16:55:13 UTC (rev 282046)
@@ -1,3 +1,27 @@
+2021-09-04  Peng Liu  <[email protected]>
+
+        [iOS] Play/pause button's icon does not update when pausing in full screen
+        https://bugs.webkit.org/show_bug.cgi?id=229904
+
+        Reviewed by Eric Carlson.
+
+        AVKit expects KVO notification of `rate` to update the play/pause icon.
+        However, with the changes in r280840, `-[WebAVPlayerController setRate]`
+        will be called by AVKit only. When a user taps the play/pause button,
+        `-[WebAVPlayerController setRate:fromJavaScript:]` will be called, which
+        does not generate the KVO notification.
+
+        This patch fixes the issue by manually generate the KVO notification.
+
+        To be safe, this patch manually generates the KVO notification for
+        property `defaultPlaybackRate` as well.
+
+        Tested manually.
+
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController setDefaultPlaybackRate:fromJavaScript:]):
+        (-[WebAVPlayerController setRate:fromJavaScript:]):
+
 2021-09-04  Antti Koivisto  <[email protected]>
 
         REGRESSION(r275515): pointer-events:none may get stuck in LFC runs

Modified: trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm (282045 => 282046)


--- trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2021-09-04 13:20:39 UTC (rev 282045)
+++ trunk/Source/WebCore/platform/ios/WebAVPlayerController.mm	2021-09-04 16:55:13 UTC (rev 282046)
@@ -173,7 +173,9 @@
     if (defaultPlaybackRate == _defaultPlaybackRate)
         return;
 
+    [self willChangeValueForKey:@"defaultPlaybackRate"];
     _defaultPlaybackRate = defaultPlaybackRate;
+    [self didChangeValueForKey:@"defaultPlaybackRate"];
 
     if (!fromJavaScript && self.delegate && self.delegate->defaultPlaybackRate() != _defaultPlaybackRate)
         self.delegate->setDefaultPlaybackRate(_defaultPlaybackRate);
@@ -197,7 +199,9 @@
     if (rate == _rate)
         return;
 
+    [self willChangeValueForKey:@"rate"];
     _rate = rate;
+    [self didChangeValueForKey:@"rate"];
 
     // AVKit doesn't have a separate variable for "paused", instead representing it by a `rate` of
     // `0`. Unfortunately, `HTMLMediaElement::play` doesn't call `HTMLMediaElement::setPlaybackRate`
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to