First Auto-PiP from Fullscreen too small & animation blocks
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 17:29:40 +0000 (17:29 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 17:29:40 +0000 (17:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187745
<rdar://problem/42316583>

Reviewed by Jon Lee.

1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
ahead of time; we get notified that PiP has already started. The area of the code
which does this just-in-time setup needs to set the video layer's frame so that the
transform within the PiP window is correct.

2) We generate a placeholder image when going into fullscreen, but we need to do
so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
time wherever AVPIVO is available.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::doSetup):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm

index 556c499..49b9fb0 100644 (file)
@@ -1,3 +1,25 @@
+2018-07-20  Jer Noble  <jer.noble@apple.com>
+
+        First Auto-PiP from Fullscreen too small & animation blocks
+        https://bugs.webkit.org/show_bug.cgi?id=187745
+        <rdar://problem/42316583>
+
+        Reviewed by Jon Lee.
+
+        1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
+        ahead of time; we get notified that PiP has already started. The area of the code
+        which does this just-in-time setup needs to set the video layer's frame so that the
+        transform within the PiP window is correct.
+
+        2) We generate a placeholder image when going into fullscreen, but we need to do
+        so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
+        time wherever AVPIVO is available.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (VideoFullscreenInterfaceAVKit::doSetup):
+
 2018-07-20  Antoine Quint  <graouts@apple.com>
 
         DeclarativeAnimation should suspend, resume, & stop m_eventQueue
index 7db7cb0..5cc320e 100644 (file)
@@ -1668,9 +1668,12 @@ void VideoFullscreenInterfaceAVKit::doSetup()
 
     WebAVPlayerLayer *playerLayer = (WebAVPlayerLayer *)[m_playerLayerView playerLayer];
 
-    [playerLayer setModelVideoLayerFrame:CGRectMake(0, 0, m_inlineRect.width(), m_inlineRect.height())];
+    auto modelVideoLayerFrame = CGRectMake(0, 0, m_inlineRect.width(), m_inlineRect.height());
+    [playerLayer setModelVideoLayerFrame:modelVideoLayerFrame];
     [playerLayer setVideoDimensions:[playerController() contentDimensions]];
     playerLayer.fullscreenInterface = this;
+    if (m_videoFullscreenModel)
+        m_videoFullscreenModel->setVideoLayerFrame(modelVideoLayerFrame);
 
     if (!m_playerViewController)
         m_playerViewController = adoptNS([[WebAVPlayerViewController alloc] initWithFullscreenInterface:this]);