<!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>[201153] branches/safari-602.1.32-branch/Source/WebCore</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/201153">201153</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-05-19 01:41:20 -0700 (Thu, 19 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/201119">r201119</a>. rdar://problem/26225793</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602132branchSourceWebCoreChangeLog">branches/safari-602.1.32-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementh">branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementmm">branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreplatformiosWebVideoFullscreenControllerAVKitmm">branches/safari-602.1.32-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602132branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/ChangeLog (201152 => 201153)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/ChangeLog        2016-05-19 08:41:15 UTC (rev 201152)
+++ branches/safari-602.1.32-branch/Source/WebCore/ChangeLog        2016-05-19 08:41:20 UTC (rev 201153)
</span><span class="lines">@@ -1,5 +1,53 @@
</span><span class="cx"> 2016-05-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r201119. rdar://problem/26225793
+
+ 2016-05-18 Eric Carlson <eric.carlson@apple.com>
+
+ [iOS] Fullscreen video playback broken in WK1 apps
+ https://bugs.webkit.org/show_bug.cgi?id=157847
+ <rdar://problem/25879521>
+
+ Reviewed by Jer Noble.
+
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
+ (WebCore::WebVideoFullscreenModelVideoElement::playbackSessionModel): New, model accessor.
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
+ (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface): Set model's playback interface.
+ (WebVideoFullscreenModelVideoElement::setVideoElement): Set model's video element.
+
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (WebVideoFullscreenControllerContext::didCleanupFullscreen): Clear m_sessionModel.
+ (WebVideoFullscreenControllerContext::setVideoDimensions): This is called from both the UI and
+ Web threads, so dispatch to the UI thread when necessary.
+ (WebVideoFullscreenControllerContext::play): Call the model's playback session on the Web thread.
+ (WebVideoFullscreenControllerContext::pause): Ditto.
+ (WebVideoFullscreenControllerContext::togglePlayState): Ditto.
+ (WebVideoFullscreenControllerContext::beginScrubbing): Ditto.
+ (WebVideoFullscreenControllerContext::endScrubbing): Ditto.
+ (WebVideoFullscreenControllerContext::seekToTime): Ditto.
+ (WebVideoFullscreenControllerContext::fastSeek): Ditto.
+ (WebVideoFullscreenControllerContext::beginScanningForward): Ditto.
+ (WebVideoFullscreenControllerContext::beginScanningBackward): Ditto.
+ (WebVideoFullscreenControllerContext::endScanning): Ditto.
+ (WebVideoFullscreenControllerContext::selectAudioMediaOption): Ditto.
+ (WebVideoFullscreenControllerContext::selectLegibleMediaOption): Ditto.
+ (WebVideoFullscreenControllerContext::setUpFullscreen): Create and configure a session model.
+ (WebVideoFullscreenSessionModel::play): Pass call back to the controller.
+ (WebVideoFullscreenSessionModel::pause): Ditto.
+ (WebVideoFullscreenSessionModel::togglePlayState): Ditto.
+ (WebVideoFullscreenSessionModel::beginScrubbing): Ditto.
+ (WebVideoFullscreenSessionModel::endScrubbing): Ditto.
+ (WebVideoFullscreenSessionModel::seekToTime): Ditto.
+ (WebVideoFullscreenSessionModel::fastSeek): Ditto.
+ (WebVideoFullscreenSessionModel::beginScanningForward): Ditto.
+ (WebVideoFullscreenSessionModel::beginScanningBackward): Ditto.
+ (WebVideoFullscreenSessionModel::endScanning): Ditto.
+ (WebVideoFullscreenSessionModel::selectAudioMediaOption): Ditto.
+ (WebVideoFullscreenSessionModel::selectLegibleMediaOption): Ditto.
+
+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r201103. rdar://problem/26339922
</span><span class="cx">
</span><span class="cx"> 2016-05-18 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h (201152 => 201153)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h        2016-05-19 08:41:15 UTC (rev 201152)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h        2016-05-19 08:41:20 UTC (rev 201153)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> WEBCORE_EXPORT void setVideoElement(HTMLVideoElement*);
</span><span class="cx"> WEBCORE_EXPORT HTMLVideoElement* videoElement() const { return m_videoElement.get(); }
</span><span class="cx"> WEBCORE_EXPORT void setVideoFullscreenLayer(PlatformLayer*);
</span><ins>+ WebPlaybackSessionModelMediaElement& playbackSessionModel() { return m_playbackSessionModel; }
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) override;
</span><span class="cx"> void updateForEventName(const WTF::AtomicString&);
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm (201152 => 201153)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm        2016-05-19 08:41:15 UTC (rev 201152)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm        2016-05-19 08:41:20 UTC (rev 201153)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_videoFullscreenInterface = interface;
</span><ins>+ m_playbackSessionModel->setWebPlaybackSessionInterface(interface);
</ins><span class="cx">
</span><span class="cx"> if (m_videoFullscreenInterface && m_videoElement)
</span><span class="cx"> m_videoFullscreenInterface->setVideoDimensions(true, m_videoElement->videoWidth(), m_videoElement->videoHeight());
</span><span class="lines">@@ -87,6 +88,7 @@
</span><span class="cx"> m_isListening = false;
</span><span class="cx">
</span><span class="cx"> m_videoElement = videoElement;
</span><ins>+ m_playbackSessionModel->setMediaElement(videoElement);
</ins><span class="cx">
</span><span class="cx"> if (!m_videoElement)
</span><span class="cx"> return;
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreplatformiosWebVideoFullscreenControllerAVKitmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (201152 => 201153)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm        2016-05-19 08:41:15 UTC (rev 201152)
+++ branches/safari-602.1.32-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm        2016-05-19 08:41:20 UTC (rev 201153)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class WebVideoFullscreenControllerContext;
</span><ins>+class WebVideoFullscreenSessionModel;
</ins><span class="cx">
</span><span class="cx"> @interface WebVideoFullscreenController (delegate)
</span><span class="cx"> -(void)didFinishFullscreen:(WebVideoFullscreenControllerContext*)context;
</span><span class="lines">@@ -104,13 +105,26 @@
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new WebVideoFullscreenControllerContext);
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> void setController(WebVideoFullscreenController* controller) { m_controller = controller; }
</span><span class="cx"> void setUpFullscreen(HTMLVideoElement&, UIView *, HTMLMediaElementEnums::VideoFullscreenMode);
</span><span class="cx"> void exitFullscreen();
</span><span class="cx"> void requestHideAndExitFullscreen();
</span><span class="cx"> void invalidate();
</span><span class="cx">
</span><ins>+ void play();
+ void pause();
+ void togglePlayState();
+ void beginScrubbing();
+ void endScrubbing();
+ void seekToTime(double);
+ void fastSeek(double time);
+ void beginScanningForward();
+ void beginScanningBackward();
+ void endScanning();
+ void selectAudioMediaOption(uint64_t);
+ void selectLegibleMediaOption(uint64_t);
+
</ins><span class="cx"> private:
</span><span class="cx"> WebVideoFullscreenControllerContext() { }
</span><span class="cx">
</span><span class="lines">@@ -120,7 +134,7 @@
</span><span class="cx"> void didExitFullscreen() override;
</span><span class="cx"> void didCleanupFullscreen() override;
</span><span class="cx"> void fullscreenMayReturnToInline() override;
</span><del>-
</del><ins>+
</ins><span class="cx"> // WebVideoFullscreenInterface
</span><span class="cx"> void resetMediaState() override;
</span><span class="cx"> void setDuration(double) override;
</span><span class="lines">@@ -147,8 +161,83 @@
</span><span class="cx"> RefPtr<HTMLVideoElement> m_videoElement;
</span><span class="cx"> RetainPtr<UIView> m_videoFullscreenView;
</span><span class="cx"> RetainPtr<WebVideoFullscreenController> m_controller;
</span><ins>+ RefPtr<WebVideoFullscreenSessionModel> m_sessionModel;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+
+class WebVideoFullscreenSessionModel final: public RefCounted<WebVideoFullscreenSessionModel>, public WebCore::WebPlaybackSessionModel {
+public:
+ static Ref<WebVideoFullscreenSessionModel> create(WebVideoFullscreenControllerContext& controller)
+ {
+ return adoptRef(*new WebVideoFullscreenSessionModel(controller));
+ }
+ virtual ~WebVideoFullscreenSessionModel() { }
+
+ void invalidate() { m_controller = nullptr; }
+
+ void setDuration(double duration) { m_duration = duration; }
+ void setCurrentTime(double currentTime) { m_currentTime = currentTime; }
+ void setBufferedTime(double bufferedTime) { m_bufferedTime = bufferedTime; }
+ void setIsPlaying(bool isPlaying) { m_isPlaying = isPlaying; }
+ void setPlaybackRate(float playbackRate) { m_playbackRate = playbackRate; }
+ void setSeekableRanges(WebCore::TimeRanges& seekableRanges) { m_seekableRanges = seekableRanges; }
+ void setCanPlayFastReverse(bool canPlayFastReverse) { m_canPlayFastReverse = canPlayFastReverse; }
+ void setAudioMediaSelectionOptions(const Vector<WTF::String>& audioMediaSelectionOptions) { m_audioMediaSelectionOptions = audioMediaSelectionOptions; }
+ void setAudioMediaSelectedIndex(uint64_t audioMediaSelectedIndex) { m_audioMediaSelectedIndex = audioMediaSelectedIndex; }
+ void setLegibleMediaSelectionOptions(const Vector<WTF::String>& legibleMediaSelectionOptions) { m_legibleMediaSelectionOptions = legibleMediaSelectionOptions; }
+ void setLegibleMediaSelectedIndex(uint64_t legibleMediaSelectedIndex) { m_legibleMediaSelectedIndex = legibleMediaSelectedIndex; }
+ void setExternalPlaybackEnabled(bool externalPlaybackEnabled) { m_externalPlaybackEnabled = externalPlaybackEnabled; }
+ void setWirelessVideoPlaybackDisabled(bool wirelessVideoPlaybackDisabled) { m_wirelessVideoPlaybackDisabled = wirelessVideoPlaybackDisabled; }
+
+private:
+ WebVideoFullscreenSessionModel(WebVideoFullscreenControllerContext& controller)
+ : m_controller(&controller)
+ {
+ }
+
+ void play() final;
+ void pause() final;
+ void togglePlayState() final;
+ void beginScrubbing() final;
+ void endScrubbing() final;
+ void seekToTime(double) final;
+ void fastSeek(double time) final;
+ void beginScanningForward() final;
+ void beginScanningBackward() final;
+ void endScanning() final;
+ void selectAudioMediaOption(uint64_t) final;
+ void selectLegibleMediaOption(uint64_t) final;
+
+ double duration() const final { return m_duration; }
+ double currentTime() const final { return m_currentTime; }
+ double bufferedTime() const final { return m_bufferedTime; }
+ bool isPlaying() const final { return m_isPlaying; }
+ float playbackRate() const final { return m_playbackRate; }
+ Ref<WebCore::TimeRanges> seekableRanges() const final { return m_seekableRanges.copyRef(); }
+ bool canPlayFastReverse() const final { return m_canPlayFastReverse; }
+ Vector<WTF::String> audioMediaSelectionOptions() const final { return m_audioMediaSelectionOptions; }
+ uint64_t audioMediaSelectedIndex() const final { return m_audioMediaSelectedIndex; }
+ Vector<WTF::String> legibleMediaSelectionOptions() const final { return m_legibleMediaSelectionOptions; }
+ uint64_t legibleMediaSelectedIndex() const final { return m_legibleMediaSelectedIndex; }
+ bool externalPlaybackEnabled() const final { return m_externalPlaybackEnabled; }
+ bool wirelessVideoPlaybackDisabled() const final { return m_wirelessVideoPlaybackDisabled; }
+
+ WebVideoFullscreenControllerContext* m_controller;
+ double m_duration { 0 };
+ double m_currentTime { 0 };
+ double m_bufferedTime { 0 };
+ bool m_isPlaying { false };
+ float m_playbackRate { 0 };
+ Ref<WebCore::TimeRanges> m_seekableRanges { WebCore::TimeRanges::create() };
+ bool m_canPlayFastReverse { false };
+ Vector<WTF::String> m_audioMediaSelectionOptions;
+ uint64_t m_audioMediaSelectedIndex { 0 };
+ Vector<WTF::String> m_legibleMediaSelectionOptions;
+ uint64_t m_legibleMediaSelectedIndex { 0 };
+ bool m_externalPlaybackEnabled { false };
+ bool m_wirelessVideoPlaybackDisabled { false };
+};
+
</ins><span class="cx"> #pragma mark WebVideoFullscreenChangeObserver
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenControllerContext::didSetupFullscreen()
</span><span class="lines">@@ -184,7 +273,10 @@
</span><span class="cx"> m_interface->setWebVideoFullscreenChangeObserver(nullptr);
</span><span class="cx"> m_interface = nullptr;
</span><span class="cx"> m_videoFullscreenView = nil;
</span><del>-
</del><ins>+
+ m_sessionModel->invalidate();
+ m_sessionModel = nullptr;
+
</ins><span class="cx"> RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
</span><span class="cx"> WebThreadRun([strongThis, this] {
</span><span class="cx"> m_model->setVideoFullscreenLayer(nil);
</span><span class="lines">@@ -192,7 +284,7 @@
</span><span class="cx"> m_model->setVideoElement(nullptr);
</span><span class="cx"> m_model = nullptr;
</span><span class="cx"> m_videoElement = nullptr;
</span><del>-
</del><ins>+
</ins><span class="cx"> [m_controller didFinishFullscreen:this];
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="lines">@@ -263,12 +355,17 @@
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenControllerContext::setVideoDimensions(bool hasVideo, float width, float height)
</span><span class="cx"> {
</span><del>- ASSERT(WebThreadIsCurrent());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- dispatch_async(dispatch_get_main_queue(), [strongThis, this, hasVideo, width, height] {
- if (m_interface)
- m_interface->setVideoDimensions(hasVideo, width, height);
- });
</del><ins>+ if (WebThreadIsCurrent()) {
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ dispatch_async(dispatch_get_main_queue(), [strongThis, this, hasVideo, width, height] {
+ if (m_interface)
+ m_interface->setVideoDimensions(hasVideo, width, height);
+ });
+ return;
+ }
+
+ if (m_interface)
+ m_interface->setVideoDimensions(hasVideo, width, height);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenControllerContext::setSeekableRanges(const TimeRanges& timeRanges)
</span><span class="lines">@@ -412,6 +509,128 @@
</span><span class="cx"> return m_model ? m_model->isVisible() : false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#pragma mark - WebPlaybackSessionModelContext
+
+void WebVideoFullscreenControllerContext::play()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().play();
+ });
+}
+
+void WebVideoFullscreenControllerContext::pause()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().pause();
+ });
+}
+
+void WebVideoFullscreenControllerContext::togglePlayState()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().togglePlayState();
+ });
+}
+
+void WebVideoFullscreenControllerContext::beginScrubbing()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().beginScrubbing();
+ });
+}
+
+void WebVideoFullscreenControllerContext::endScrubbing()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().endScrubbing();
+ });
+}
+
+void WebVideoFullscreenControllerContext::seekToTime(double time)
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this, time] {
+ if (m_model)
+ m_model->playbackSessionModel().seekToTime(time);
+ });
+}
+
+void WebVideoFullscreenControllerContext::fastSeek(double time)
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this, time] {
+ if (m_model)
+ m_model->playbackSessionModel().fastSeek(time);
+ });
+}
+
+void WebVideoFullscreenControllerContext::beginScanningForward()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().beginScanningForward();
+ });
+}
+
+void WebVideoFullscreenControllerContext::beginScanningBackward()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().beginScanningBackward();
+ });
+}
+
+void WebVideoFullscreenControllerContext::endScanning()
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this] {
+ if (m_model)
+ m_model->playbackSessionModel().endScanning();
+ });
+}
+
+void WebVideoFullscreenControllerContext::selectAudioMediaOption(uint64_t index)
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this, index] {
+ if (m_model)
+ m_model->playbackSessionModel().selectAudioMediaOption(index);
+ });
+}
+
+void WebVideoFullscreenControllerContext::selectLegibleMediaOption(uint64_t index)
+{
+ ASSERT(isUIThread());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this, index] {
+ if (m_model)
+ m_model->playbackSessionModel().selectLegibleMediaOption(index);
+ });
+}
+
</ins><span class="cx"> #pragma mark Other
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenControllerContext::setUpFullscreen(HTMLVideoElement& videoElement, UIView *view, HTMLMediaElementEnums::VideoFullscreenMode mode)
</span><span class="lines">@@ -424,9 +643,15 @@
</span><span class="cx"> dispatch_async(dispatch_get_main_queue(), [strongThis, this, viewRef, mode] {
</span><span class="cx"> ASSERT(isUIThread());
</span><span class="cx">
</span><del>- m_interface = WebVideoFullscreenInterfaceAVKit::create(WebPlaybackSessionInterfaceAVKit::create().get());
</del><ins>+ Ref<WebPlaybackSessionInterfaceAVKit> sessionInterface = WebPlaybackSessionInterfaceAVKit::create();
+ m_interface = WebVideoFullscreenInterfaceAVKit::create(sessionInterface.get());
+
+ m_sessionModel = WebVideoFullscreenSessionModel::create(*this);
+ sessionInterface->setWebPlaybackSessionModel(m_sessionModel.get());
+
+ m_interface->setWebVideoFullscreenModel(this);
</ins><span class="cx"> m_interface->setWebVideoFullscreenChangeObserver(this);
</span><del>- m_interface->setWebVideoFullscreenModel(this);
</del><ins>+
</ins><span class="cx"> m_videoFullscreenView = adoptNS([[getUIViewClass() alloc] init]);
</span><span class="cx">
</span><span class="cx"> RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
</span><span class="lines">@@ -434,13 +659,12 @@
</span><span class="cx"> m_model = WebVideoFullscreenModelVideoElement::create(WebPlaybackSessionModelMediaElement::create().get());
</span><span class="cx"> m_model->setWebVideoFullscreenInterface(this);
</span><span class="cx"> m_model->setVideoElement(m_videoElement.get());
</span><del>-
- bool allowsPictureInPicture = m_videoElement->mediaSession().allowsPictureInPicture(*m_videoElement.get());
</del><span class="cx">
</span><span class="cx"> IntRect videoElementClientRect = elementRectInWindow(m_videoElement.get());
</span><span class="cx"> FloatRect videoLayerFrame = FloatRect(FloatPoint(), videoElementClientRect.size());
</span><span class="cx"> m_model->setVideoLayerFrame(videoLayerFrame);
</span><span class="cx">
</span><ins>+ bool allowsPictureInPicture = m_videoElement->mediaSession().allowsPictureInPicture(*m_videoElement.get());
</ins><span class="cx"> dispatch_async(dispatch_get_main_queue(), [strongThis, this, videoElementClientRect, viewRef, mode, allowsPictureInPicture] {
</span><span class="cx"> m_interface->setupFullscreen(*m_videoFullscreenView.get(), videoElementClientRect, viewRef.get(), mode, allowsPictureInPicture);
</span><span class="cx"> });
</span><span class="lines">@@ -465,6 +689,81 @@
</span><span class="cx"> m_interface->requestHideAndExitFullscreen();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#pragma mark WebPlaybackSessionModel
+
+void WebVideoFullscreenSessionModel::play()
+{
+ if (m_controller)
+ m_controller->play();
+}
+
+void WebVideoFullscreenSessionModel::pause()
+{
+ if (m_controller)
+ m_controller->pause();
+}
+
+void WebVideoFullscreenSessionModel::togglePlayState()
+{
+ if (m_controller)
+ m_controller->togglePlayState();
+}
+
+void WebVideoFullscreenSessionModel::beginScrubbing()
+{
+ if (m_controller)
+ m_controller->beginScrubbing();
+}
+
+void WebVideoFullscreenSessionModel::endScrubbing()
+{
+ if (m_controller)
+ m_controller->endScrubbing();
+}
+
+void WebVideoFullscreenSessionModel::seekToTime(double time)
+{
+ if (m_controller)
+ m_controller->seekToTime(time);
+}
+
+void WebVideoFullscreenSessionModel::fastSeek(double time)
+{
+ if (m_controller)
+ m_controller->fastSeek(time);
+}
+
+void WebVideoFullscreenSessionModel::beginScanningForward()
+{
+ if (m_controller)
+ m_controller->beginScanningForward();
+}
+
+void WebVideoFullscreenSessionModel::beginScanningBackward()
+{
+ if (m_controller)
+ m_controller->beginScanningBackward();
+}
+
+void WebVideoFullscreenSessionModel::endScanning()
+{
+ if (m_controller)
+ m_controller->endScanning();
+}
+
+void WebVideoFullscreenSessionModel::selectAudioMediaOption(uint64_t optionId)
+{
+ if (m_controller)
+ m_controller->selectAudioMediaOption(optionId);
+}
+
+void WebVideoFullscreenSessionModel::selectLegibleMediaOption(uint64_t optionId)
+{
+ if (m_controller)
+ m_controller->selectLegibleMediaOption(optionId);
+}
+
+
</ins><span class="cx"> @implementation WebVideoFullscreenController {
</span><span class="cx"> RefPtr<WebVideoFullscreenControllerContext> _context;
</span><span class="cx"> RefPtr<HTMLVideoElement> _videoElement;
</span></span></pre>
</div>
</div>
</body>
</html>