Title: [277645] trunk/Source/WebKit
Revision
277645
Author
you...@apple.com
Date
2021-05-18 01:10:35 -0700 (Tue, 18 May 2021)

Log Message

Resurrect WKWebView media controls API removed in https://bugs.webkit.org/show_bug.cgi?id=221929
https://bugs.webkit.org/show_bug.cgi?id=225696
<rdar://77863194>

Reviewed by Alex Christensen.

Revert closeAllMediaPresentations, pauseAllMediaPlayback, resumeAllMediaPlayback, suspendAllMediaPlayback and requestMediaPlaybackState.
Mark them as deprecated in favor of the latest API versions and implement them based on the latest API versions.
No change of behavior.

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView closeAllMediaPresentations:]):
(-[WKWebView pauseAllMediaPlayback:]):
(-[WKWebView resumeAllMediaPlayback:]):
(-[WKWebView suspendAllMediaPlayback:]):
(-[WKWebView requestMediaPlaybackState:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (277644 => 277645)


--- trunk/Source/WebKit/ChangeLog	2021-05-18 07:01:07 UTC (rev 277644)
+++ trunk/Source/WebKit/ChangeLog	2021-05-18 08:10:35 UTC (rev 277645)
@@ -1,3 +1,23 @@
+2021-05-18  Youenn Fablet  <you...@apple.com>
+
+        Resurrect WKWebView media controls API removed in https://bugs.webkit.org/show_bug.cgi?id=221929
+        https://bugs.webkit.org/show_bug.cgi?id=225696
+        <rdar://77863194>
+
+        Reviewed by Alex Christensen.
+
+        Revert closeAllMediaPresentations, pauseAllMediaPlayback, resumeAllMediaPlayback, suspendAllMediaPlayback and requestMediaPlaybackState.
+        Mark them as deprecated in favor of the latest API versions and implement them based on the latest API versions.
+        No change of behavior.
+
+        * UIProcess/API/Cocoa/WKWebView.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView closeAllMediaPresentations:]):
+        (-[WKWebView pauseAllMediaPlayback:]):
+        (-[WKWebView resumeAllMediaPlayback:]):
+        (-[WKWebView suspendAllMediaPlayback:]):
+        (-[WKWebView requestMediaPlaybackState:]):
+
 2021-05-17  Ryosuke Niwa  <rn...@webkit.org>
 
         Enabling IPC testing API should prevent WebContent process from getting terminated in more cases

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (277644 => 277645)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h	2021-05-18 07:01:07 UTC (rev 277644)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h	2021-05-18 08:10:35 UTC (rev 277645)
@@ -343,11 +343,17 @@
  @discussion Includes picture-in-picture and fullscreen.
  */
 - (void)closeAllMediaPresentationsWithCompletionHandler:(void (^_Nullable)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+#ifndef __swift__
+- (void)closeAllMediaPresentations:(void (^_Nullable)(void))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("closeAllMediaPresentationsWithCompletionHandler:", macos(11.3, WK_MAC_TBA), ios(14.5, WK_IOS_TBA));
+#endif
 
 /*! @abstract Pauses media playback in WKWebView.
  @discussion Pauses media playback. Media in the page can be restarted by calling play() on a media element or resume() on an AudioContext in _javascript_. A user can also use media controls to play media content after it has been paused.
  */
 - (void)pauseAllMediaPlaybackWithCompletionHandler:(void (^_Nullable)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+#ifndef __swift__
+- (void)pauseAllMediaPlayback:(void (^_Nullable)(void))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("pauseAllMediaPlaybackWithCompletionHandler:", macos(11.3, WK_MAC_TBA), ios(14.5, WK_IOS_TBA));
+#endif
 
 /*! @abstract Suspends or resumes all media playback in WKWebView.
   @param suspended Whether media playback should be suspended or resumed.
@@ -354,6 +360,10 @@
   @discussion If suspended is true, this pauses media playback and blocks all attempts by the page or the user to resume until setAllMediaPlaybackSuspended is called again with suspended set to false. Media playback should always be suspended and resumed in pairs.
 */
 - (void)setAllMediaPlaybackSuspended:(BOOL)suspended completionHandler:(void (^_Nullable)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+#ifndef __swift__
+- (void)resumeAllMediaPlayback:(void (^ _Nullable)(void))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("setAllMediaPlaybackSuspended:completionHandler:", macos(11.3, WK_MAC_TBA), ios(14.5, WK_IOS_TBA));
+- (void)suspendAllMediaPlayback:(void (^_Nullable)(void))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("setAllMediaPlaybackSuspended:completionHandler:", macos(11.3, WK_MAC_TBA), ios(14.5, WK_IOS_TBA));
+#endif
 
 /*! @abstract Get the current media playback state of a WKWebView.
  @param completionHandler A block to invoke with the return value of the function call.
@@ -363,8 +373,10 @@
  WKMediaPlaybackStateNone.
  */
 - (void)requestMediaPlaybackStateWithCompletionHandler:(void (^)(WKMediaPlaybackState))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+#ifndef __swift__
+- (void)requestMediaPlaybackState:(void (^)(WKMediaPlaybackState))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("requestMediaPlaybackStateWithCompletionHandler:", macos(11.3, WK_MAC_TBA), ios(14.5, WK_IOS_TBA));
+#endif
 
-
 /*! @abstract The state of camera capture on a web page.
  @discussion @link WKWebView @/link is key-value observing (KVO) compliant
  for this property.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (277644 => 277645)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-05-18 07:01:07 UTC (rev 277644)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-05-18 08:10:35 UTC (rev 277645)
@@ -935,6 +935,11 @@
     return false;
 }
 
+- (void)closeAllMediaPresentations:(void (^)(void))completionHandler
+{
+    [self closeAllMediaPresentationsWithCompletionHandler:completionHandler];
+}
+
 - (void)closeAllMediaPresentationsWithCompletionHandler:(void (^)(void))completionHandler
 {
     THROW_IF_SUSPENDED;
@@ -952,6 +957,11 @@
 #endif
 }
 
+- (void)pauseAllMediaPlayback:(void (^)(void))completionHandler
+{
+    [self pauseAllMediaPlaybackWithCompletionHandler:completionHandler];
+}
+
 - (void)pauseAllMediaPlaybackWithCompletionHandler:(void (^)(void))completionHandler
 {
     THROW_IF_SUSPENDED;
@@ -963,6 +973,16 @@
     _page->pauseAllMediaPlayback(makeBlockPtr(completionHandler));
 }
 
+- (void)resumeAllMediaPlayback:(void (^)(void))completionHandler
+{
+    [self setAllMediaPlaybackSuspended:NO completionHandler:completionHandler];
+}
+
+- (void)suspendAllMediaPlayback:(void (^)(void))completionHandler
+{
+    [self setAllMediaPlaybackSuspended:YES completionHandler:completionHandler];
+}
+
 - (void)setAllMediaPlaybackSuspended:(BOOL)suspended completionHandler:(void (^)(void))completionHandler
 {
     THROW_IF_SUSPENDED;
@@ -994,6 +1014,11 @@
     return WKMediaPlaybackStateNone;
 }
 
+- (void)requestMediaPlaybackState:(void (^)(WKMediaPlaybackState))completionHandler
+{
+    [self requestMediaPlaybackStateWithCompletionHandler:completionHandler];
+}
+
 - (void)requestMediaPlaybackStateWithCompletionHandler:(void (^)(WKMediaPlaybackState))completionHandler
 {
     THROW_IF_SUSPENDED;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to