AVKit play button bypasses MediaElementSession playbackPermitted() checks.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 21:26:33 +0000 (21:26 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 21:26:33 +0000 (21:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198813

Reviewed by Eric Carlson.

HTMLMediaElement::togglePlayState() is an internal-only method that doesn't
run playbackPermitted() checks. For our imitation AVPlayerController, translate
requests to -togglePlayback: into calls to play() and pause() depending on
playback state.

* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController togglePlayback:]):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/WebAVPlayerController.mm

index 6ef0baa..c577e5d 100644 (file)
@@ -1,3 +1,18 @@
+2019-06-13  Jer Noble  <jer.noble@apple.com>
+
+        AVKit play button bypasses MediaElementSession playbackPermitted() checks.
+        https://bugs.webkit.org/show_bug.cgi?id=198813
+
+        Reviewed by Eric Carlson.
+
+        HTMLMediaElement::togglePlayState() is an internal-only method that doesn't
+        run playbackPermitted() checks. For our imitation AVPlayerController, translate
+        requests to -togglePlayback: into calls to play() and pause() depending on
+        playback state.
+
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController togglePlayback:]):
+
 2019-06-13  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r246396 and r246397.
index ab5562d..d59ba87 100644 (file)
@@ -126,8 +126,13 @@ static double WebAVPlayerControllerLiveStreamSeekableTimeRangeMinimumDuration =
 - (void)togglePlayback:(id)sender
 {
     UNUSED_PARAM(sender);
-    if (self.delegate)
-        self.delegate->togglePlayState();
+    if (!self.delegate)
+        return;
+
+    if (self.delegate->isPlaying())
+        self.delegate->pause();
+    else
+        self.delegate->play();
 }
 
 - (void)togglePlaybackEvenWhenInBackground:(id)sender