<!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>[167044] 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/167044">167044</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-04-09 15:33:23 -0700 (Wed, 09 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Enable fullscreen captions selection
https://bugs.webkit.org/show_bug.cgi?id=131069
Patch by Jeremy Jones <jeremyj@apple.com> on 2014-04-09
Reviewed by Eric Carlson.
Source/WebCore:
Enable media selection options from fullscreen. i.e. captions.
* WebCore.exp.in:
Add exports for
setAudioMediaSelectionOptions
setLegibleMediaSelectionOptions
selectAudioMediaOption
selectLegibleMediaOption
* platform/ios/WebVideoFullscreenInterface.h:
Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
* platform/ios/WebVideoFullscreenInterfaceAVKit.h:
Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
(-[WebAVPlayerController dealloc]):
(-[WebAVPlayerController hasMediaSelectionOptions]):
(+[WebAVPlayerController keyPathsForValuesAffectingHasMediaSelectionOptions]):
(-[WebAVPlayerController hasAudioMediaSelectionOptions]):
(+[WebAVPlayerController keyPathsForValuesAffectingHasAudioMediaSelectionOptions]):
(-[WebAVPlayerController hasLegibleMediaSelectionOptions]):
(+[WebAVPlayerController keyPathsForValuesAffectingHasLegibleMediaSelectionOptions]):
(-[WebAVPlayerController currentAudioMediaSelectionOption]):
(-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]):
(-[WebAVPlayerController currentLegibleMediaSelectionOption]):
(-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]):
(WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions):
(WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions):
* platform/ios/WebVideoFullscreenModel.h:
Add selectAudioMediaOption/selectLegibleMediaOption
* platform/ios/WebVideoFullscreenModelMediaElement.h:
Add selectAudioMediaOption/selectLegibleMediaOption
* platform/ios/WebVideoFullscreenModelMediaElement.mm:
Add selectAudioMediaOption/selectLegibleMediaOption
(WebVideoFullscreenModelMediaElement::setMediaElement):
Send initial media selection options.
(WebVideoFullscreenModelMediaElement::selectAudioMediaOption):
Will be implemented when audio track slection is implemented.
(WebVideoFullscreenModelMediaElement::selectLegibleMediaOption):
Select corresponding text track on HTMLMediaElement.
Source/WebKit2:
Enable media selection in fullscreen.
setLegibleMediaSelectionOptions/setAudioMediaSelectionOptions provide a list of options.
selectAudioMediaOption/selectLegibleMediaOption change the selected option.
* UIProcess/ios/WebVideoFullscreenManagerProxy.h:
Add selectAudioMediaOption/selectLegibleMediaOption
* UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
Add selectAudioMediaOption/selectLegibleMediaOption
* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::selectAudioMediaOption):
Add selectAudioMediaOption
(WebKit::WebVideoFullscreenManagerProxy::selectLegibleMediaOption):
Add selectLegibleMediaOption
* WebProcess/ios/WebVideoFullscreenManager.h:
Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
* WebProcess/ios/WebVideoFullscreenManager.messages.in:
Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
* WebProcess/ios/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::setAudioMediaSelectionOptions):
Add setAudioMediaSelectionOptions
(WebKit::WebVideoFullscreenManager::setLegibleMediaSelectionOptions):
Add setLegibleMediaSelectionOptions</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="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h</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="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermessagesin">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in</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 (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/ChangeLog        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-04-09 Jeremy Jones <jeremyj@apple.com>
+
+ Enable fullscreen captions selection
+ https://bugs.webkit.org/show_bug.cgi?id=131069
+
+ Reviewed by Eric Carlson.
+
+ Enable media selection options from fullscreen. i.e. captions.
+
+ * WebCore.exp.in:
+ Add exports for
+ setAudioMediaSelectionOptions
+ setLegibleMediaSelectionOptions
+ selectAudioMediaOption
+ selectLegibleMediaOption
+
+ * platform/ios/WebVideoFullscreenInterface.h:
+ Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
+
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+ Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
+
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
+
+ (-[WebAVPlayerController dealloc]):
+ (-[WebAVPlayerController hasMediaSelectionOptions]):
+ (+[WebAVPlayerController keyPathsForValuesAffectingHasMediaSelectionOptions]):
+ (-[WebAVPlayerController hasAudioMediaSelectionOptions]):
+ (+[WebAVPlayerController keyPathsForValuesAffectingHasAudioMediaSelectionOptions]):
+ (-[WebAVPlayerController hasLegibleMediaSelectionOptions]):
+ (+[WebAVPlayerController keyPathsForValuesAffectingHasLegibleMediaSelectionOptions]):
+ (-[WebAVPlayerController currentAudioMediaSelectionOption]):
+ (-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]):
+ (-[WebAVPlayerController currentLegibleMediaSelectionOption]):
+ (-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]):
+ (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions):
+ (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions):
+ * platform/ios/WebVideoFullscreenModel.h:
+ Add selectAudioMediaOption/selectLegibleMediaOption
+
+ * platform/ios/WebVideoFullscreenModelMediaElement.h:
+ Add selectAudioMediaOption/selectLegibleMediaOption
+
+ * platform/ios/WebVideoFullscreenModelMediaElement.mm:
+ Add selectAudioMediaOption/selectLegibleMediaOption
+
+ (WebVideoFullscreenModelMediaElement::setMediaElement):
+ Send initial media selection options.
+
+ (WebVideoFullscreenModelMediaElement::selectAudioMediaOption):
+ Will be implemented when audio track slection is implemented.
+
+ (WebVideoFullscreenModelMediaElement::selectLegibleMediaOption):
+ Select corresponding text track on HTMLMediaElement.
+
</ins><span class="cx"> 2014-04-09 Antti Koivisto <antti@apple.com>
</span><span class="cx">
</span><span class="cx"> TileGrid should be PlatformCALayerClient instead of TileController
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -3283,7 +3283,9 @@
</span><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElement18setVideoLayerFrameENS_9FloatRectE
</span><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElement20setVideoLayerGravityENS_23WebVideoFullscreenModel12VideoGravityE
</span><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElement21requestExitFullscreenEv
</span><ins>+__ZN7WebCore35WebVideoFullscreenModelMediaElement22selectAudioMediaOptionEy
</ins><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElement23setVideoFullscreenLayerEP7CALayer
</span><ins>+__ZN7WebCore35WebVideoFullscreenModelMediaElement24selectLegibleMediaOptionEy
</ins><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElement4playEv
</span><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElement5pauseEv
</span><span class="cx"> __ZN7WebCore35WebVideoFullscreenModelMediaElementC2Ev
</span><span class="lines">@@ -3302,6 +3304,8 @@
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17setSeekableRangesERKNS_10TimeRangesE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit26setWebVideoFullscreenModelEPNS_23WebVideoFullscreenModelE
</span><ins>+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit29setAudioMediaSelectionOptionsERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEEy
+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit31setLegibleMediaSelectionOptionsERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEEy
</ins><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit35setWebVideoFullscreenChangeObserverEPNS_32WebVideoFullscreenChangeObserverE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit7setRateEbf
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKitC2Ev
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -29,6 +29,12 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">
</span><ins>+#include <wtf/Vector.h>
+
+namespace WTF {
+class String;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class TimeRanges;
</span><span class="lines">@@ -41,6 +47,8 @@
</span><span class="cx"> virtual void setRate(bool isPlaying, float playbackRate) = 0;
</span><span class="cx"> virtual void setVideoDimensions(bool hasVideo, float width, float height) = 0;
</span><span class="cx"> virtual void setSeekableRanges(const TimeRanges&) = 0;
</span><ins>+ virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 0;
+ virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) = 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 (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -81,7 +81,9 @@
</span><span class="cx"> virtual void setRate(bool isPlaying, float playbackRate) override;
</span><span class="cx"> virtual void setVideoDimensions(bool hasVideo, float width, float height) override;
</span><span class="cx"> virtual void setSeekableRanges(const TimeRanges&) override;
</span><del>-
</del><ins>+ virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
+ virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
+
</ins><span class="cx"> virtual void enterFullscreen(PlatformLayer&);
</span><span class="cx"> virtual void exitFullscreen();
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -72,7 +72,13 @@
</span><span class="cx"> SOFT_LINK(CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
</span><span class="cx"> SOFT_LINK(CoreMedia, CMTimeSubtract, CMTime, (CMTime minuend, CMTime subtrahend), (minuend, subtrahend))
</span><span class="cx">
</span><ins>+@class WebAVMediaSelectionOption;
+
</ins><span class="cx"> @interface WebAVPlayerController : NSObject <AVPlayerViewControllerDelegate>
</span><ins>+{
+ WebAVMediaSelectionOption *_currentAudioMediaSelectionOption;
+ WebAVMediaSelectionOption *_currentLegibleMediaSelectionOption;
+}
</ins><span class="cx">
</span><span class="cx"> @property(retain) AVPlayerController* playerControllerProxy;
</span><span class="cx"> @property(assign) WebVideoFullscreenModel* delegate;
</span><span class="lines">@@ -95,6 +101,14 @@
</span><span class="cx"> @property(retain) AVValueTiming *timing;
</span><span class="cx"> @property(retain) NSArray *seekableTimeRanges;
</span><span class="cx">
</span><ins>+@property (readonly) BOOL hasMediaSelectionOptions;
+@property (readonly) BOOL hasAudioMediaSelectionOptions;
+@property (retain) NSArray *audioMediaSelectionOptions;
+@property (retain) WebAVMediaSelectionOption *currentAudioMediaSelectionOption;
+@property (readonly) BOOL hasLegibleMediaSelectionOptions;
+@property (retain) NSArray *legibleMediaSelectionOptions;
+@property (retain) WebAVMediaSelectionOption *currentLegibleMediaSelectionOption;
+
</ins><span class="cx"> - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldDismissWithReason:(AVPlayerViewControllerExitFullScreenReason)reason;
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="lines">@@ -116,6 +130,10 @@
</span><span class="cx"> [_loadedTimeRanges release];
</span><span class="cx"> [_seekableTimeRanges release];
</span><span class="cx"> [_timing release];
</span><ins>+ [_audioMediaSelectionOptions release];
+ [_legibleMediaSelectionOptions release];
+ [_currentAudioMediaSelectionOption release];
+ [_currentLegibleMediaSelectionOption release];
</ins><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -227,8 +245,91 @@
</span><span class="cx"> [self seekToTime:timeAtEndOfSeekableTimeRanges];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)hasMediaSelectionOptions
+{
+ return [self hasAudioMediaSelectionOptions] || [self hasLegibleMediaSelectionOptions];
+}
+
++ (NSSet *)keyPathsForValuesAffectingHasMediaSelectionOptions
+{
+ return [NSSet setWithObjects:@"hasAudioMediaSelectionOptions", @"hasLegibleMediaSelectionOptions", nil];
+}
+
+- (BOOL)hasAudioMediaSelectionOptions
+{
+ return [[self audioMediaSelectionOptions] count] > 0;
+}
+
++ (NSSet *)keyPathsForValuesAffectingHasAudioMediaSelectionOptions
+{
+ return [NSSet setWithObject:@"audioMediaSelectionOptions"];
+}
+
+- (BOOL)hasLegibleMediaSelectionOptions
+{
+ return [[self legibleMediaSelectionOptions] count] > 0;
+}
+
++ (NSSet *)keyPathsForValuesAffectingHasLegibleMediaSelectionOptions
+{
+ return [NSSet setWithObject:@"legibleMediaSelectionOptions"];
+}
+
+- (WebAVMediaSelectionOption *)currentAudioMediaSelectionOption
+{
+ return _currentAudioMediaSelectionOption;
+}
+
+- (void)setCurrentAudioMediaSelectionOption:(WebAVMediaSelectionOption *)option
+{
+ if (option == _currentAudioMediaSelectionOption)
+ return;
+
+ [_currentAudioMediaSelectionOption release];
+ _currentAudioMediaSelectionOption = [option retain];
+
+ ASSERT(self.delegate);
+
+ NSInteger index = NSNotFound;
+
+ if (option && self.audioMediaSelectionOptions)
+ index = [self.audioMediaSelectionOptions indexOfObject:option];
+
+ self.delegate->selectAudioMediaOption(index != NSNotFound ? index : UINT64_MAX);
+}
+
+- (WebAVMediaSelectionOption *)currentLegibleMediaSelectionOption
+{
+ return _currentLegibleMediaSelectionOption;
+}
+
+- (void)setCurrentLegibleMediaSelectionOption:(WebAVMediaSelectionOption *)option
+{
+ if (option == _currentLegibleMediaSelectionOption)
+ return;
+
+ [_currentLegibleMediaSelectionOption release];
+ _currentLegibleMediaSelectionOption = [option retain];
+
+ ASSERT(self.delegate);
+
+ NSInteger index = NSNotFound;
+
+ if (option && self.legibleMediaSelectionOptions)
+ index = [self.legibleMediaSelectionOptions indexOfObject:option];
+
+ self.delegate->selectLegibleMediaOption(index != NSNotFound ? index : UINT64_MAX);
+}
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><ins>+@interface WebAVMediaSelectionOption : NSObject
+@property (retain) NSString *localizedDisplayName;
+@end
+
+@implementation WebAVMediaSelectionOption
+@end
+
</ins><span class="cx"> @interface WebAVVideoLayer : CALayer <AVVideoLayer>
</span><span class="cx"> +(WebAVVideoLayer *)videoLayer;
</span><span class="cx"> @property (nonatomic) AVVideoLayerGravity videoLayerGravity;
</span><span class="lines">@@ -380,6 +481,34 @@
</span><span class="cx"> playerController().seekableTimeRanges = seekableRanges;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static NSMutableArray *mediaSelectionOptions(const Vector<String>& options)
+{
+ NSMutableArray *webOptions = [NSMutableArray arrayWithCapacity:options.size()];
+ for (auto& name : options) {
+ RetainPtr<WebAVMediaSelectionOption> webOption = adoptNS([[WebAVMediaSelectionOption alloc] init]);
+ RetainPtr<NSString> nameString = adoptNS([[NSString alloc] initWithUTF8String:name.utf8().data()]);
+ [webOption setLocalizedDisplayName:nameString.get()];
+ [webOptions addObject:webOption.get()];
+ }
+ return webOptions;
+}
+
+void WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex)
+{
+ NSMutableArray *webOptions = mediaSelectionOptions(options);
+ playerController().audioMediaSelectionOptions = webOptions;
+ if (selectedIndex < webOptions.count)
+ playerController().currentAudioMediaSelectionOption = webOptions[(size_t)selectedIndex];
+}
+
+void WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex)
+{
+ NSMutableArray *webOptions = mediaSelectionOptions(options);
+ playerController().legibleMediaSelectionOptions = webOptions;
+ if (selectedIndex < webOptions.count)
+ playerController().currentLegibleMediaSelectionOption = webOptions[(size_t)selectedIndex];
+}
+
</ins><span class="cx"> void WebVideoFullscreenInterfaceAVKit::enterFullscreen(PlatformLayer& videoLayer)
</span><span class="cx"> {
</span><span class="cx"> __block RefPtr<WebVideoFullscreenInterfaceAVKit> protect(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -44,6 +44,8 @@
</span><span class="cx"> virtual void setVideoLayerFrame(FloatRect) = 0;
</span><span class="cx"> enum VideoGravity { VideoGravityResize, VideoGravityResizeAspect, VideoGravityResizeAspectFill };
</span><span class="cx"> virtual void setVideoLayerGravity(VideoGravity) = 0;
</span><ins>+ virtual void selectAudioMediaOption(uint64_t index) = 0;
+ virtual void selectLegibleMediaOption(uint64_t index) = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -65,7 +65,8 @@
</span><span class="cx"> virtual void requestExitFullscreen() override;
</span><span class="cx"> virtual void setVideoLayerFrame(FloatRect) override;
</span><span class="cx"> virtual void setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity) override;
</span><del>-
</del><ins>+ virtual void selectAudioMediaOption(uint64_t index) override;
+ virtual void selectLegibleMediaOption(uint64_t index) override;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -87,6 +87,13 @@
</span><span class="cx"> m_videoFullscreenInterface->setSeekableRanges(*m_mediaElement->seekable());
</span><span class="cx"> m_videoFullscreenInterface->setRate(!m_mediaElement->paused(), m_mediaElement->playbackRate());
</span><span class="cx">
</span><ins>+ Vector<String> legibleOptions;
+
+ for (auto& textTrack : m_mediaElement->platformTextTracks())
+ legibleOptions.append(textTrack->label());
+
+ m_videoFullscreenInterface->setLegibleMediaSelectionOptions(legibleOptions, 0);
+
</ins><span class="cx"> m_videoFullscreenInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
</span><span class="cx">
</span><span class="cx"> if (isHTMLVideoElement(m_mediaElement.get())) {
</span><span class="lines">@@ -196,4 +203,19 @@
</span><span class="cx"> m_mediaElement->setVideoFullscreenGravity(videoGravity);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebVideoFullscreenModelMediaElement::selectAudioMediaOption(uint64_t)
+{
+ // FIXME: 131236 Implement audio track selection.
+}
+
+void WebVideoFullscreenModelMediaElement::selectLegibleMediaOption(uint64_t index)
+{
+ RefPtr<PlatformTextTrack> platformTrack;
+
+ if (index < m_mediaElement->platformTextTracks().size())
+ platformTrack = m_mediaElement->platformTextTracks()[static_cast<size_t>(index)];
+
+ m_mediaElement->setSelectedTextTrack(platformTrack);
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/ChangeLog        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2014-04-09 Jeremy Jones <jeremyj@apple.com>
+
+ Enable fullscreen captions selection
+ https://bugs.webkit.org/show_bug.cgi?id=131069
+
+ Reviewed by Eric Carlson.
+
+ Enable media selection in fullscreen.
+ setLegibleMediaSelectionOptions/setAudioMediaSelectionOptions provide a list of options.
+ selectAudioMediaOption/selectLegibleMediaOption change the selected option.
+
+ * UIProcess/ios/WebVideoFullscreenManagerProxy.h:
+ Add selectAudioMediaOption/selectLegibleMediaOption
+
+ * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
+ Add selectAudioMediaOption/selectLegibleMediaOption
+
+ * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenManagerProxy::selectAudioMediaOption):
+ Add selectAudioMediaOption
+
+ (WebKit::WebVideoFullscreenManagerProxy::selectLegibleMediaOption):
+ Add selectLegibleMediaOption
+
+ * WebProcess/ios/WebVideoFullscreenManager.h:
+ Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
+
+ * WebProcess/ios/WebVideoFullscreenManager.messages.in:
+ Add setAudioMediaSelectionOptions/setLegibleMediaSelectionOptions
+
+ * WebProcess/ios/WebVideoFullscreenManager.mm:
+ (WebKit::WebVideoFullscreenManager::setAudioMediaSelectionOptions):
+ Add setAudioMediaSelectionOptions
+
+ (WebKit::WebVideoFullscreenManager::setLegibleMediaSelectionOptions):
+ Add setLegibleMediaSelectionOptions
+
</ins><span class="cx"> 2014-04-09 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Rename some dragging functions
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -67,6 +67,8 @@
</span><span class="cx"> virtual void seekToTime(double) override;
</span><span class="cx"> virtual void setVideoLayerFrame(WebCore::FloatRect) override;
</span><span class="cx"> virtual void setVideoLayerGravity(WebCore::WebVideoFullscreenModel::VideoGravity) override;
</span><ins>+ virtual void selectAudioMediaOption(uint64_t) override;
+ virtual void selectLegibleMediaOption(uint64_t) override;
</ins><span class="cx">
</span><span class="cx"> WebPageProxy* m_page;
</span><span class="cx"> RetainPtr<PlatformLayer> m_layerHost;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -25,6 +25,8 @@
</span><span class="cx"> SetCurrentTime(double currentTime, double hostTime)
</span><span class="cx"> SetVideoDimensions(bool hasVideo, unsigned width, unsigned height)
</span><span class="cx"> SetSeekableRangesVector(Vector<std::pair<double, double>> ranges);
</span><ins>+ SetAudioMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex);
+ SetLegibleMediaSelectionOptions(Vector<String> options, uint64_t selectedIndex);
</ins><span class="cx"> SetDuration(double duration)
</span><span class="cx"> SetRate(bool isPlaying, double rate)
</span><span class="cx"> EnterFullscreenWithID(uint32_t videoLayerID)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -125,6 +125,16 @@
</span><span class="cx"> {
</span><span class="cx"> m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerGravityEnum((unsigned)gravity), m_page->pageID());
</span><span class="cx"> }
</span><ins>+
+void WebVideoFullscreenManagerProxy::selectAudioMediaOption(uint64_t index)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::SelectAudioMediaOption(index), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::selectLegibleMediaOption(uint64_t index)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::SelectLegibleMediaOption(index), m_page->pageID());
+}
</ins><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -71,6 +71,8 @@
</span><span class="cx"> virtual void setRate(bool isPlaying, float playbackRate) override;
</span><span class="cx"> virtual void setVideoDimensions(bool hasVideo, float width, float height) override;
</span><span class="cx"> virtual void setSeekableRanges(const WebCore::TimeRanges&) override;
</span><ins>+ virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
+ virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
</ins><span class="cx">
</span><span class="cx"> // additional incoming
</span><span class="cx"> virtual void didEnterFullscreen();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -31,5 +31,7 @@
</span><span class="cx"> DidEnterFullscreen()
</span><span class="cx"> SetVideoLayerFrame(WebCore::FloatRect bounds)
</span><span class="cx"> SetVideoLayerGravityEnum(unsigned gravity)
</span><ins>+ SelectAudioMediaOption(uint64_t index)
+ SelectLegibleMediaOption(uint64_t index)
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (167043 => 167044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-04-09 22:33:16 UTC (rev 167043)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-04-09 22:33:23 UTC (rev 167044)
</span><span class="lines">@@ -135,6 +135,16 @@
</span><span class="cx"> m_page->send(Messages::WebVideoFullscreenManagerProxy::SetSeekableRangesVector(std::move(rangesVector)), m_page->pageID());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebVideoFullscreenManager::setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetAudioMediaSelectionOptions(options, selectedIndex), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetLegibleMediaSelectionOptions(options, selectedIndex), 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>