<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169545] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169545">169545</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-06-02 14:13:12 -0700 (Mon, 02 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Send external playback properties to fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=133366
Patch by Jeremy Jones <jeremyj@apple.com> on 2014-06-02
Reviewed by Simon Fraser.
Source/WebCore:
Refactor property updates in WebVideoFullscreenModelMediaElement and update
setExternalPlayback on webkitcurrentplaybacktargetiswirelesschangedEvent.
* WebCore.exp.in: Add export for setExternalPlayback.
* platform/ios/WebVideoFullscreenInterface.h: add setExternalPlayback
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: add setExternalPlayback
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerController isPlayingOnExternalScreen]): added
(+[WebAVPlayerController keyPathsForValuesAffectingPlayingOnExternalScreen]): added
(WebVideoFullscreenInterfaceAVKit::setExternalPlayback): added
(WebVideoFullscreenInterfaceAVKit::enterFullscreen): added
* platform/ios/WebVideoFullscreenModelMediaElement.h: add updateForEventName
* platform/ios/WebVideoFullscreenModelMediaElement.mm:
(WebVideoFullscreenModelMediaElement::setMediaElement): refactor property changes into updateForEventName()
(WebVideoFullscreenModelMediaElement::handleEvent): refactor property changes into updateForEventName()
(WebVideoFullscreenModelMediaElement::updateForEventName): remove duplicate code, implement for setExternalPlayback
Source/WebKit2:
Forward setExternalPlayback.
* UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: add setExternalPlaybackProperties
* WebProcess/ios/WebVideoFullscreenManager.h: add setExternalPlaybackProperties
* WebProcess/ios/WebVideoFullscreenManager.mm: add setExternalPlaybackProperties
(WebKit::WebVideoFullscreenManager::setExternalPlaybackProperties): added</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKith">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagerh">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/ChangeLog        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-06-02 Jeremy Jones <jeremyj@apple.com>
+
+ Send external playback properties to fullscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=133366
+
+ Reviewed by Simon Fraser.
+
+ Refactor property updates in WebVideoFullscreenModelMediaElement and update
+ setExternalPlayback on webkitcurrentplaybacktargetiswirelesschangedEvent.
+
+ * WebCore.exp.in: Add export for setExternalPlayback.
+ * platform/ios/WebVideoFullscreenInterface.h: add setExternalPlayback
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h: add setExternalPlayback
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (-[WebAVPlayerController isPlayingOnExternalScreen]): added
+ (+[WebAVPlayerController keyPathsForValuesAffectingPlayingOnExternalScreen]): added
+ (WebVideoFullscreenInterfaceAVKit::setExternalPlayback): added
+ (WebVideoFullscreenInterfaceAVKit::enterFullscreen): added
+ * platform/ios/WebVideoFullscreenModelMediaElement.h: add updateForEventName
+ * platform/ios/WebVideoFullscreenModelMediaElement.mm:
+ (WebVideoFullscreenModelMediaElement::setMediaElement): refactor property changes into updateForEventName()
+ (WebVideoFullscreenModelMediaElement::handleEvent): refactor property changes into updateForEventName()
+ (WebVideoFullscreenModelMediaElement::updateForEventName): remove duplicate code, implement for setExternalPlayback
+
</ins><span class="cx"> 2014-06-02 Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com>
</span><span class="cx">
</span><span class="cx"> WebCore build fix for webreplay
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -3388,6 +3388,7 @@
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit15enterFullscreenER7CALayerNS_7IntRectE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17setSeekableRangesERKNS_10TimeRangesE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff
</span><ins>+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit19setExternalPlaybackEbNS_27WebVideoFullscreenInterface26ExternalPlaybackTargetTypeEN3WTF6StringE
</ins><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit26setWebVideoFullscreenModelEPNS_23WebVideoFullscreenModelE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit28requestHideAndExitFullscreenEv
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit29setAudioMediaSelectionOptionsERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEEy
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -41,6 +41,8 @@
</span><span class="cx">
</span><span class="cx"> class WebVideoFullscreenInterface {
</span><span class="cx"> public:
</span><ins>+ enum ExternalPlaybackTargetType { TargetTypeNone, TargetTypeAirPlay, TargetTypeTVOut };
+
</ins><span class="cx"> virtual ~WebVideoFullscreenInterface() { };
</span><span class="cx"> virtual void setDuration(double) = 0;
</span><span class="cx"> virtual void setCurrentTime(double currentTime, double anchorTime) = 0;
</span><span class="lines">@@ -49,6 +51,7 @@
</span><span class="cx"> virtual void setSeekableRanges(const TimeRanges&) = 0;
</span><span class="cx"> virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0;
</span><span class="cx"> virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0;
</span><ins>+ virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKith"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> virtual void setSeekableRanges(const TimeRanges&) override;
</span><span class="cx"> virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
</span><span class="cx"> virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
</span><ins>+ virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) override;
</ins><span class="cx">
</span><span class="cx"> virtual void enterFullscreen(PlatformLayer&, WebCore::IntRect initialRect);
</span><span class="cx"> virtual void exitFullscreen(WebCore::IntRect finalRect);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -121,6 +121,11 @@
</span><span class="cx"> @property (retain) NSArray *legibleMediaSelectionOptions;
</span><span class="cx"> @property (retain) WebAVMediaSelectionOption *currentLegibleMediaSelectionOption;
</span><span class="cx">
</span><ins>+@property (readonly, getter=isPlayingOnExternalScreen) BOOL playingOnExternalScreen;
+@property (getter=isExternalPlaybackActive) BOOL externalPlaybackActive;
+@property AVPlayerControllerExternalPlaybackType externalPlaybackType;
+@property (retain) NSString *externalPlaybackAirPlayDeviceLocalizedName;
+
</ins><span class="cx"> - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldExitFullScreenWithReason:(AVPlayerViewControllerExitFullScreenReason)reason;
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="lines">@@ -442,6 +447,16 @@
</span><span class="cx"> self.delegate->selectLegibleMediaOption(index != NSNotFound ? index : UINT64_MAX);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)isPlayingOnExternalScreen
+{
+ return [self isExternalPlaybackActive];
+}
+
++ (NSSet *)keyPathsForValuesAffectingPlayingOnExternalScreen
+{
+ return [NSSet setWithObjects:@"externalPlaybackActive", nil];
+}
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @interface WebAVMediaSelectionOption : NSObject
</span><span class="lines">@@ -659,6 +674,20 @@
</span><span class="cx"> playerController().currentLegibleMediaSelectionOption = webOptions[(size_t)selectedIndex];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebVideoFullscreenInterfaceAVKit::setExternalPlayback(bool enabled, ExternalPlaybackTargetType targetType, String localizedDeviceName)
+{
+ AVPlayerControllerExternalPlaybackType externalPlaybackType = AVPlayerControllerExternalPlaybackTypeNone;
+ if (targetType == TargetTypeAirPlay)
+ externalPlaybackType = AVPlayerControllerExternalPlaybackTypeAirPlay;
+ else if (targetType == TargetTypeTVOut)
+ externalPlaybackType = AVPlayerControllerExternalPlaybackTypeTVOut;
+
+ playerController().externalPlaybackAirPlayDeviceLocalizedName = localizedDeviceName;
+ playerController().externalPlaybackType = externalPlaybackType;
+ playerController().externalPlaybackActive = enabled;
+ [m_videoLayerContainer.get() setHidden:enabled];
+}
+
</ins><span class="cx"> void WebVideoFullscreenInterfaceAVKit::enterFullscreen(PlatformLayer& videoLayer, WebCore::IntRect initialRect)
</span><span class="cx"> {
</span><span class="cx"> __block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
</span><span class="lines">@@ -673,6 +702,7 @@
</span><span class="cx"> [m_videoLayer removeFromSuperlayer];
</span><span class="cx">
</span><span class="cx"> m_videoLayerContainer = [WebAVVideoLayer videoLayer];
</span><ins>+ [m_videoLayerContainer setHidden:playerController().externalPlaybackActive];
</ins><span class="cx"> [m_videoLayerContainer addSublayer:m_videoLayer.get()];
</span><span class="cx">
</span><span class="cx"> CGSize videoSize = playerController().contentDimensions;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> void setVideoFullscreenLayer(PlatformLayer*);
</span><span class="cx">
</span><span class="cx"> virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) override;
</span><ins>+ void updateForEventName(const WTF::AtomicString&);
</ins><span class="cx"> bool operator==(const EventListener& rhs) override
</span><span class="cx"> {return static_cast<WebCore::EventListener*>(this) == &rhs;}
</span><span class="cx">
</span><span class="lines">@@ -71,6 +72,9 @@
</span><span class="cx"> virtual void selectLegibleMediaOption(uint64_t index) override;
</span><span class="cx">
</span><span class="cx"> private:
</span><ins>+ static const Vector<WTF::AtomicString>& observedEventNames();
+ const WTF::AtomicString& eventNameAll();
+
</ins><span class="cx"> RefPtr<HTMLMediaElement> m_mediaElement;
</span><span class="cx"> RetainPtr<PlatformLayer> m_videoFullscreenLayer;
</span><span class="cx"> bool m_isListening;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -47,8 +47,10 @@
</span><span class="cx"> #import <WebCore/TimeRanges.h>
</span><span class="cx"> #import <WebCore/WebCoreThreadRun.h>
</span><span class="cx"> #import <QuartzCore/CoreAnimation.h>
</span><ins>+#import <wtf/NeverDestroyed.h>
</ins><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> WebVideoFullscreenModelMediaElement::WebVideoFullscreenModelMediaElement()
</span><span class="lines">@@ -67,13 +69,8 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (m_mediaElement && m_isListening) {
</span><del>- m_mediaElement->removeEventListener(eventNames().durationchangeEvent, this, false);
- m_mediaElement->removeEventListener(eventNames().pauseEvent, this, false);
- m_mediaElement->removeEventListener(eventNames().playEvent, this, false);
- m_mediaElement->removeEventListener(eventNames().ratechangeEvent, this, false);
- m_mediaElement->removeEventListener(eventNames().timeupdateEvent, this, false);
- m_mediaElement->removeEventListener(eventNames().addtrackEvent, this, false);
- m_mediaElement->removeEventListener(eventNames().removetrackEvent, this, false);
</del><ins>+ for (auto eventName : observedEventNames())
+ m_mediaElement->removeEventListener(eventName, this, false);
</ins><span class="cx"> }
</span><span class="cx"> m_isListening = false;
</span><span class="cx">
</span><span class="lines">@@ -82,23 +79,12 @@
</span><span class="cx"> if (!m_mediaElement)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- m_mediaElement->addEventListener(eventNames().durationchangeEvent, this, false);
- m_mediaElement->addEventListener(eventNames().pauseEvent, this, false);
- m_mediaElement->addEventListener(eventNames().playEvent, this, false);
- m_mediaElement->addEventListener(eventNames().ratechangeEvent, this, false);
- m_mediaElement->addEventListener(eventNames().timeupdateEvent, this, false);
- m_mediaElement->addEventListener(eventNames().addtrackEvent, this, false);
- m_mediaElement->addEventListener(eventNames().removetrackEvent, this, false);
</del><ins>+ for (auto eventName : observedEventNames())
+ m_mediaElement->addEventListener(eventName, this, false);
</ins><span class="cx"> m_isListening = true;
</span><span class="cx">
</span><del>- m_videoFullscreenInterface->setDuration(m_mediaElement->duration());
- m_videoFullscreenInterface->setSeekableRanges(*m_mediaElement->seekable());
- m_videoFullscreenInterface->setRate(!m_mediaElement->paused(), m_mediaElement->playbackRate());
</del><ins>+ updateForEventName(eventNameAll());
</ins><span class="cx">
</span><del>- updateLegibleOptions();
-
- m_videoFullscreenInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
-
</del><span class="cx"> if (isHTMLVideoElement(m_mediaElement.get())) {
</span><span class="cx"> HTMLVideoElement *videoElement = toHTMLVideoElement(m_mediaElement.get());
</span><span class="cx"> m_videoFullscreenInterface->setVideoDimensions(true, videoElement->videoWidth(), videoElement->videoHeight());
</span><span class="lines">@@ -108,23 +94,58 @@
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenModelMediaElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
</span><span class="cx"> {
</span><ins>+ LOG(Media, "handleEvent %s", event->type().characters8());
+ updateForEventName(event->type());
+}
+
+void WebVideoFullscreenModelMediaElement::updateForEventName(const WTF::AtomicString& eventName)
+{
</ins><span class="cx"> if (!m_mediaElement || !m_videoFullscreenInterface)
</span><span class="cx"> return;
</span><ins>+
+ bool all = eventName == eventNameAll();
</ins><span class="cx">
</span><del>- LOG(Media, "handleEvent %s", event->type().characters8());
-
- if (event->type() == eventNames().durationchangeEvent)
</del><ins>+ if (all
+ || eventName == eventNames().durationchangeEvent)
</ins><span class="cx"> m_videoFullscreenInterface->setDuration(m_mediaElement->duration());
</span><del>- else if (event->type() == eventNames().pauseEvent
- || event->type() == eventNames().playEvent
- || event->type() == eventNames().ratechangeEvent)
</del><ins>+
+ if (all
+ || eventName == eventNames().pauseEvent
+ || eventName == eventNames().playEvent
+ || eventName == eventNames().ratechangeEvent)
</ins><span class="cx"> m_videoFullscreenInterface->setRate(!m_mediaElement->paused(), m_mediaElement->playbackRate());
</span><del>- else if (event->type() == eventNames().timeupdateEvent) {
</del><ins>+
+ if (all
+ || eventName == eventNames().timeupdateEvent) {
</ins><span class="cx"> m_videoFullscreenInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
</span><span class="cx"> // FIXME: 130788 - find a better event to update seekable ranges from.
</span><span class="cx"> m_videoFullscreenInterface->setSeekableRanges(*m_mediaElement->seekable());
</span><del>- } else if (event->type() == eventNames().addtrackEvent || event->type() == eventNames().removetrackEvent)
</del><ins>+ }
+
+ if (all
+ || eventName == eventNames().addtrackEvent
+ || eventName == eventNames().removetrackEvent)
</ins><span class="cx"> updateLegibleOptions();
</span><ins>+
+ if (all
+ || eventName == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent) {
+ bool enabled = m_mediaElement->mediaSession().currentPlaybackTargetIsWireless(*m_mediaElement);
+ WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType = WebVideoFullscreenInterface::TargetTypeNone;
+ String localizedDeviceName;
+
+ if (m_mediaElement->mediaControlsHost()) {
+ DEPRECATED_DEFINE_STATIC_LOCAL(String, airplay, (ASCIILiteral("airplay")));
+ DEPRECATED_DEFINE_STATIC_LOCAL(String, tvout, (ASCIILiteral("tvout")));
+
+ String type = m_mediaElement->mediaControlsHost()->externalDeviceType();
+ if (type == airplay)
+ targetType = WebVideoFullscreenInterface::TargetTypeAirPlay;
+ else if (type == tvout)
+ targetType = WebVideoFullscreenInterface::TargetTypeTVOut;
+ localizedDeviceName = m_mediaElement->mediaControlsHost()->externalDeviceDisplayName();
+ }
+ m_videoFullscreenInterface->setExternalPlayback(enabled, targetType, localizedDeviceName);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenModelMediaElement::setVideoFullscreenLayer(PlatformLayer* videoLayer)
</span><span class="lines">@@ -333,4 +354,27 @@
</span><span class="cx"> m_videoFullscreenInterface->setLegibleMediaSelectionOptions(trackDisplayNames, selectedIndex);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const Vector<AtomicString>& WebVideoFullscreenModelMediaElement::observedEventNames()
+{
+ static NeverDestroyed<Vector<AtomicString>> sEventNames;
+
+ if (!sEventNames.get().size()) {
+ sEventNames.get().append(eventNames().durationchangeEvent);
+ sEventNames.get().append(eventNames().pauseEvent);
+ sEventNames.get().append(eventNames().playEvent);
+ sEventNames.get().append(eventNames().ratechangeEvent);
+ sEventNames.get().append(eventNames().timeupdateEvent);
+ sEventNames.get().append(eventNames().addtrackEvent);
+ sEventNames.get().append(eventNames().removetrackEvent);
+ sEventNames.get().append(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
+ }
+ return sEventNames.get();
+}
+
+const AtomicString& WebVideoFullscreenModelMediaElement::eventNameAll()
+{
+ static NeverDestroyed<AtomicString> sEventNameAll = "allEvents";
+ return sEventNameAll;
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-06-02 Jeremy Jones <jeremyj@apple.com>
+
+ Send external playback properties to fullscreen.
+ https://bugs.webkit.org/show_bug.cgi?id=133366
+
+ Reviewed by Simon Fraser.
+
+ Forward setExternalPlayback.
+
+ * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in: add setExternalPlaybackProperties
+ * WebProcess/ios/WebVideoFullscreenManager.h: add setExternalPlaybackProperties
+ * WebProcess/ios/WebVideoFullscreenManager.mm: add setExternalPlaybackProperties
+ (WebKit::WebVideoFullscreenManager::setExternalPlaybackProperties): added
+
</ins><span class="cx"> 2014-06-02 Enrica Casucci <enrica@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove unintentional changes to WKContentViewInteraction.mm
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -57,7 +57,8 @@
</span><span class="cx"> // Translate to FullscreenInterface
</span><span class="cx"> void enterFullscreenWithID(uint32_t, WebCore::IntRect initialRect);
</span><span class="cx"> void setSeekableRangesVector(Vector<std::pair<double, double>>&);
</span><del>-
</del><ins>+ void setExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
+
</ins><span class="cx"> // Fullscreen Observer
</span><span class="cx"> virtual void didExitFullscreen() override;
</span><span class="cx"> virtual void didEnterFullscreen() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> SetSeekableRangesVector(Vector<std::pair<double, double>> ranges);
</span><span class="cx"> SetAudioMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex);
</span><span class="cx"> SetLegibleMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex);
</span><ins>+ SetExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
</ins><span class="cx"> SetDuration(double duration)
</span><span class="cx"> SetRate(bool isPlaying, double rate)
</span><span class="cx"> EnterFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -92,6 +92,15 @@
</span><span class="cx"> setSeekableRanges(*timeRanges);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebVideoFullscreenManagerProxy::setExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName)
+{
+ WebVideoFullscreenInterface::ExternalPlaybackTargetType type = static_cast<WebVideoFullscreenInterface::ExternalPlaybackTargetType>(targetType);
+
+ ASSERT(type == WebVideoFullscreenInterface::TargetTypeAirPlay || type == WebVideoFullscreenInterface::TargetTypeTVOut || type == WebVideoFullscreenInterface::TargetTypeNone);
+
+ setExternalPlayback(enabled, type, localizedDeviceName);
+}
+
</ins><span class="cx"> void WebVideoFullscreenManagerProxy::requestExitFullscreen()
</span><span class="cx"> {
</span><span class="cx"> m_page->send(Messages::WebVideoFullscreenManager::RequestExitFullscreen(), m_page->pageID());
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -73,7 +73,8 @@
</span><span class="cx"> virtual void setSeekableRanges(const WebCore::TimeRanges&) override;
</span><span class="cx"> virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
</span><span class="cx"> virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
</span><del>-
</del><ins>+ virtual void setExternalPlayback(bool enabled, WebVideoFullscreenInterface::ExternalPlaybackTargetType, String localizedDeviceName) override;
+
</ins><span class="cx"> // additional incoming
</span><span class="cx"> virtual void didEnterFullscreen();
</span><span class="cx"> virtual void didExitFullscreen();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (169544 => 169545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-06-02 20:53:58 UTC (rev 169544)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-06-02 21:13:12 UTC (rev 169545)
</span><span class="lines">@@ -160,7 +160,12 @@
</span><span class="cx"> {
</span><span class="cx"> m_page->send(Messages::WebVideoFullscreenManagerProxy::SetLegibleMediaSelectionOptions(options, selectedIndex), m_page->pageID());
</span><span class="cx"> }
</span><del>-
</del><ins>+
+void WebVideoFullscreenManager::setExternalPlayback(bool enabled, WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType, String localizedDeviceName)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetExternalPlaybackProperties(enabled, static_cast<uint32_t>(targetType), localizedDeviceName), m_page->pageID());
+}
+
</ins><span class="cx"> void WebVideoFullscreenManager::didEnterFullscreen()
</span><span class="cx"> {
</span><span class="cx"> m_isAnimating = false;
</span></span></pre>
</div>
</div>
</body>
</html>