- Revision
- 184760
- Author
- jer.no...@apple.com
- Date
- 2015-05-21 23:57:30 -0700 (Thu, 21 May 2015)
Log Message
[iOS] Tell AVPlayerLayer when we enter optimized fullscreen mode.
https://bugs.webkit.org/show_bug.cgi?id=145289
Reviewed by Eric Carlson.
AVFoundation would normally already know that its AVPlayerLayer is in optimized
fullscreen mode, but because of the WebProcess/UIProcess split, they need to be
told explicitly in the WebProcess when the UIProcess enters optimized fullscreen
mode.
* html/HTMLMediaElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::fullscreenModeChanged): Pass to private().
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setVideoFullscreenMode): Pass to m_private.
(WebCore::MediaPlayer::fullscreenMode): Pass to m_client.
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerFullscreenMode): Default implementation returns None.
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setVideoFullscreenMode): Default implementation is a no-op.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Get the fullscreen
mode from MediaPlayer and tell the AVPlayerLayer if the mode is optimized.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
Ditto.
* platform/spi/mac/AVFoundationSPI.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (184759 => 184760)
--- trunk/Source/WebCore/ChangeLog 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/ChangeLog 2015-05-22 06:57:30 UTC (rev 184760)
@@ -1,3 +1,33 @@
+2015-05-21 Jer Noble <jer.no...@apple.com>
+
+ [iOS] Tell AVPlayerLayer when we enter optimized fullscreen mode.
+ https://bugs.webkit.org/show_bug.cgi?id=145289
+
+ Reviewed by Eric Carlson.
+
+ AVFoundation would normally already know that its AVPlayerLayer is in optimized
+ fullscreen mode, but because of the WebProcess/UIProcess split, they need to be
+ told explicitly in the WebProcess when the UIProcess enters optimized fullscreen
+ mode.
+
+ * html/HTMLMediaElement.h:
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::fullscreenModeChanged): Pass to private().
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::setVideoFullscreenMode): Pass to m_private.
+ (WebCore::MediaPlayer::fullscreenMode): Pass to m_client.
+ * platform/graphics/MediaPlayer.h:
+ (WebCore::MediaPlayerClient::mediaPlayerFullscreenMode): Default implementation returns None.
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenMode): Default implementation is a no-op.
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Get the fullscreen
+ mode from MediaPlayer and tell the AVPlayerLayer if the mode is optimized.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
+ Ditto.
+ * platform/spi/mac/AVFoundationSPI.h:
+
2015-05-21 Joanmarie Diggs <jdi...@igalia.com>
AX: [GTK] Implement computedRoleString in AccessibilityUIElement
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (184759 => 184760)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2015-05-22 06:57:30 UTC (rev 184760)
@@ -580,6 +580,7 @@
virtual void mediaPlayerEngineFailedToLoad() const override final;
virtual double mediaPlayerRequestedPlaybackRate() const override final;
+ virtual VideoFullscreenMode mediaPlayerFullscreenMode() const override final { return fullscreenMode(); }
void pendingActionTimerFired();
void progressEventTimerFired();
Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (184759 => 184760)
--- trunk/Source/WebCore/html/HTMLVideoElement.cpp 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp 2015-05-22 06:57:30 UTC (rev 184760)
@@ -419,6 +419,9 @@
scheduleEvent(eventNames().webkitpresentationmodechangedEvent);
}
+ if (player())
+ player()->setVideoFullscreenMode(mode);
+
HTMLMediaElement::fullscreenModeChanged(mode);
}
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (184759 => 184760)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2015-05-22 06:57:30 UTC (rev 184760)
@@ -620,6 +620,16 @@
m_private->setVideoFullscreenGravity(gravity);
}
+void MediaPlayer::setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode mode)
+{
+ m_private->setVideoFullscreenMode(mode);
+}
+
+MediaPlayer::VideoFullscreenMode MediaPlayer::fullscreenMode() const
+{
+ return m_client.mediaPlayerFullscreenMode();
+}
+
NSArray* MediaPlayer::timedMetadata() const
{
return m_private->timedMetadata();
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (184759 => 184760)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2015-05-22 06:57:30 UTC (rev 184760)
@@ -276,6 +276,7 @@
virtual void mediaPlayerEngineFailedToLoad() const { }
virtual double mediaPlayerRequestedPlaybackRate() const { return 0; }
+ virtual MediaPlayerEnums::VideoFullscreenMode mediaPlayerFullscreenMode() const { return MediaPlayerEnums::VideoFullscreenModeNone; }
};
class MediaPlayerSupportsTypeClient {
@@ -314,6 +315,8 @@
void setVideoFullscreenFrame(FloatRect);
using MediaPlayerEnums::VideoGravity;
void setVideoFullscreenGravity(VideoGravity);
+ void setVideoFullscreenMode(VideoFullscreenMode);
+ VideoFullscreenMode fullscreenMode() const;
NSArray *timedMetadata() const;
String accessLog() const;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (184759 => 184760)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2015-05-22 06:57:30 UTC (rev 184760)
@@ -61,6 +61,7 @@
virtual void setVideoFullscreenLayer(PlatformLayer*) { }
virtual void setVideoFullscreenFrame(FloatRect) { }
virtual void setVideoFullscreenGravity(MediaPlayer::VideoGravity) { }
+ virtual void setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode) { }
virtual NSArray *timedMetadata() const { return 0; }
virtual String accessLog() const { return emptyString(); }
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (184759 => 184760)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2015-05-22 06:57:30 UTC (rev 184760)
@@ -159,6 +159,7 @@
virtual void setVideoFullscreenLayer(PlatformLayer*);
virtual void setVideoFullscreenFrame(FloatRect);
virtual void setVideoFullscreenGravity(MediaPlayer::VideoGravity);
+ virtual void setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode) override;
virtual NSArray *timedMetadata() const override;
virtual String accessLog() const;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (184759 => 184760)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2015-05-22 06:57:30 UTC (rev 184760)
@@ -693,6 +693,8 @@
[m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
[m_videoLayer setFrame:m_videoInlineLayer.get().bounds];
}
+ if ([m_videoLayer respondsToSelector:@selector(setEnterOptimizedFullscreenModeEnabled:)])
+ [m_videoLayer setEnterOptimizedFullscreenModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModeOptimized)];
#else
[m_videoLayer setFrame:CGRectMake(0, 0, defaultSize.width(), defaultSize.height())];
#endif
@@ -1182,6 +1184,12 @@
[m_videoLayer setVideoGravity:videoGravity];
}
+void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode mode)
+{
+ if (m_videoLayer && [m_videoLayer respondsToSelector:@selector(setEnterOptimizedFullscreenModeEnabled:)])
+ [m_videoLayer setEnterOptimizedFullscreenModeEnabled:(mode & MediaPlayer::VideoFullscreenModeOptimized)];
+}
+
NSArray *MediaPlayerPrivateAVFoundationObjC::timedMetadata() const
{
if (m_currentMetaData)
Modified: trunk/Source/WebCore/platform/spi/mac/AVFoundationSPI.h (184759 => 184760)
--- trunk/Source/WebCore/platform/spi/mac/AVFoundationSPI.h 2015-05-22 06:36:57 UTC (rev 184759)
+++ trunk/Source/WebCore/platform/spi/mac/AVFoundationSPI.h 2015-05-22 06:57:30 UTC (rev 184760)
@@ -49,4 +49,19 @@
#endif
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+
+#if PLATFORM(IOS)
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <AVKit/AVPlayerViewController_WebKitOnly.h>
#endif
+
+#import <AVFoundation/AVPlayerLayer.h>
+
+@interface AVPlayerLayer (AVPlayerLayerOptimizedFullscreenModeSupportPrivate)
+- (void)setEnterOptimizedFullscreenModeEnabled:(BOOL)flag;
+@end
+
+#endif
+