<!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>[164519] trunk/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/164519">164519</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-02-21 18:45:01 -0800 (Fri, 21 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS Media] Wireless target UI
https://bugs.webkit.org/show_bug.cgi?id=129189
<rdar://problem/15349928>
<rdar://problem/16100060>
Reviewed by Eric Carlson.
Implement a prototype UI for wireless playback targets. The UI
doesn't currently work, but can be simulated via a class variable
in ControllerIOS.
* Modules/mediacontrols/mediaControlsiOS.css:
(audio::-webkit-media-controls-panel button): Reset the default style of
button elements, to avoid getting a border.
(audio::-webkit-media-controls-wireless-playback-status): Holds the UI showing
the user that the media is playing on another target.
(audio::-webkit-media-controls-wireless-playback-status.hidden):
(audio::-webkit-media-controls-wireless-playback-picker-button): The button to
trigger selection of targets.
(audio::-webkit-media-controls-wireless-playback-picker-button.active):
(audio::-webkit-media-controls-panel): This needs to be position absolute for
the wireless playback status to fill the viewport.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS): Check for targets.
(ControllerIOS.prototype.addVideoListeners):
(ControllerIOS.prototype.removeVideoListeners):
(ControllerIOS.prototype.UIString): New method to return localized strings (with
a FIXME).
(ControllerIOS.prototype.shouldHaveAnyUI): Needs to display if there is a wireless
target.
(ControllerIOS.prototype.currentPlaybackTargetIsWireless):
(ControllerIOS.prototype.updateWirelessPlaybackStatus): Create the status content,
replacing the device name if it is available.
(ControllerIOS.prototype.updateWirelessTargetAvailable):
(ControllerIOS.prototype.createControls):
(ControllerIOS.prototype.configureInlineControls):
(ControllerIOS.prototype.handleWirelessPlaybackChange):
(ControllerIOS.prototype.handleWirelessTargetAvailableChange):
(ControllerIOS.prototype.handleWirelessPickerButtonClicked):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164518 => 164519)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-22 01:58:54 UTC (rev 164518)
+++ trunk/Source/WebCore/ChangeLog        2014-02-22 02:45:01 UTC (rev 164519)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2014-02-21 Dean Jackson <dino@apple.com>
+
+ [iOS Media] Wireless target UI
+ https://bugs.webkit.org/show_bug.cgi?id=129189
+ <rdar://problem/15349928>
+ <rdar://problem/16100060>
+
+ Reviewed by Eric Carlson.
+
+ Implement a prototype UI for wireless playback targets. The UI
+ doesn't currently work, but can be simulated via a class variable
+ in ControllerIOS.
+
+ * Modules/mediacontrols/mediaControlsiOS.css:
+ (audio::-webkit-media-controls-panel button): Reset the default style of
+ button elements, to avoid getting a border.
+ (audio::-webkit-media-controls-wireless-playback-status): Holds the UI showing
+ the user that the media is playing on another target.
+ (audio::-webkit-media-controls-wireless-playback-status.hidden):
+ (audio::-webkit-media-controls-wireless-playback-picker-button): The button to
+ trigger selection of targets.
+ (audio::-webkit-media-controls-wireless-playback-picker-button.active):
+ (audio::-webkit-media-controls-panel): This needs to be position absolute for
+ the wireless playback status to fill the viewport.
+ * Modules/mediacontrols/mediaControlsiOS.js:
+ (ControllerIOS): Check for targets.
+ (ControllerIOS.prototype.addVideoListeners):
+ (ControllerIOS.prototype.removeVideoListeners):
+ (ControllerIOS.prototype.UIString): New method to return localized strings (with
+ a FIXME).
+ (ControllerIOS.prototype.shouldHaveAnyUI): Needs to display if there is a wireless
+ target.
+ (ControllerIOS.prototype.currentPlaybackTargetIsWireless):
+ (ControllerIOS.prototype.updateWirelessPlaybackStatus): Create the status content,
+ replacing the device name if it is available.
+ (ControllerIOS.prototype.updateWirelessTargetAvailable):
+ (ControllerIOS.prototype.createControls):
+ (ControllerIOS.prototype.configureInlineControls):
+ (ControllerIOS.prototype.handleWirelessPlaybackChange):
+ (ControllerIOS.prototype.handleWirelessTargetAvailableChange):
+ (ControllerIOS.prototype.handleWirelessPickerButtonClicked):
+
</ins><span class="cx"> 2014-02-21 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> Make a generic CDMPrivateMediaPlayer and move its CDMSession into platform/.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css (164518 => 164519)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2014-02-22 01:58:54 UTC (rev 164518)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2014-02-22 02:45:01 UTC (rev 164519)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -55,6 +55,47 @@
</span><span class="cx"> font-family: -apple-system-font;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+video::-webkit-media-controls-panel input[type="button"],
+audio::-webkit-media-controls-panel input[type="button"],
+video::-webkit-media-controls-panel button,
+audio::-webkit-media-controls-panel button {
+ padding: 0;
+ border: none;
+ -webkit-appearance: none;
+}
+
+video::-webkit-media-controls-wireless-playback-status,
+audio::-webkit-media-controls-wireless-playback-status {
+ display: block;
+ width: 100%;
+ height: 100%;
+ background-color: black;
+ background-repeat: no-repeat;
+ background-position: 50% 50%;
+ background-size: 100% 50%;
+}
+
+video::-webkit-media-controls-wireless-playback-status.hidden,
+audio::-webkit-media-controls-wireless-playback-status.hidden {
+ display: none;
+}
+
+video::-webkit-media-controls-wireless-playback-picker-button,
+audio::-webkit-media-controls-wireless-playback-picker-button {
+ display: block;
+ width: 21px;
+ height: 21px;
+ background-color: rgb(92, 92, 92);
+ -webkit-mask-repeat: no-repeat;
+ -webkit-mask-position: 0 1px;
+ -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 350 305"><g fill="white"><polygon points="50.699,293 175,146 299.302,293"/><polygon points="9,9 9,213 97.392,213 110.921,197 25,197 25,25 325,25 325,197 239.079,197 252.608,213 341,213 341,9"/></g></svg>');
+}
+
+video::-webkit-media-controls-wireless-playback-picker-button.active,
+audio::-webkit-media-controls-wireless-playback-picker-button.active {
+ background-color: #1060FE;
+}
+
</ins><span class="cx"> video::-webkit-media-text-track-container,
</span><span class="cx"> audio::-webkit-media-text-track-container {
</span><span class="cx"> position: relative;
</span><span class="lines">@@ -64,7 +105,7 @@
</span><span class="cx"> video::-webkit-media-controls-panel,
</span><span class="cx"> audio::-webkit-media-controls-panel {
</span><span class="cx"> box-sizing: border-box;
</span><del>- position: relative;
</del><ins>+ position: absolute;
</ins><span class="cx"> bottom: 0;
</span><span class="cx"> width: 100%;
</span><span class="cx"> padding-bottom: 1px;
</span><span class="lines">@@ -91,7 +132,6 @@
</span><span class="cx"> opacity: 1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> video::-webkit-media-controls-rewind-button,
</span><span class="cx"> audio::-webkit-media-controls-rewind-button,
</span><span class="cx"> video::-webkit-media-controls-panel .mute-box,
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (164518 => 164519)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2014-02-22 01:58:54 UTC (rev 164518)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2014-02-22 02:45:01 UTC (rev 164519)
</span><span class="lines">@@ -5,18 +5,31 @@
</span><span class="cx">
</span><span class="cx"> function ControllerIOS(root, video, host)
</span><span class="cx"> {
</span><ins>+ this.hasWirelessPlaybackTargets = false;
</ins><span class="cx"> Controller.call(this, root, video, host);
</span><ins>+
+ this.updateWirelessTargetAvailable();
+ this.updateWirelessPlaybackStatus();
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* Enums */
</span><span class="cx"> ControllerIOS.StartPlaybackControls = 2;
</span><span class="cx">
</span><ins>+/* Globals */
+ControllerIOS.gWirelessImage = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 245"><g fill="#1060FE"><path d="M193.6,6.3v121.6H6.4V6.3H193.6 M199.1,0.7H0.9v132.7h198.2V0.7L199.1,0.7z"/><path d="M43.5,139.3c15.8,8,35.3,12.7,56.5,12.7s40.7-4.7,56.5-12.7H43.5z"/></g><g text-anchor="middle" font-family="Helvetica Neue"><text x="100" y="204" fill="white" font-size="24">##DEVICE_TYPE##</text><text x="100" y="234" fill="#5C5C5C" font-size="21">##DEVICE_NAME##</text></g></svg>';
+ControllerIOS.gSimulateWirelessPlaybackTarget = false; // Used for testing when there are no wireless targets.
+
</ins><span class="cx"> ControllerIOS.prototype = {
</span><span class="cx"> addVideoListeners: function() {
</span><span class="cx"> Controller.prototype.addVideoListeners.call(this);
</span><span class="cx">
</span><span class="cx"> this.listenFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
</span><span class="cx"> this.listenFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
</span><ins>+
+ if (window.WebKitPlaybackTargetAvailabilityEvent) {
+ this.listenFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
+ this.listenFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> removeVideoListeners: function() {
</span><span class="lines">@@ -24,9 +37,13 @@
</span><span class="cx">
</span><span class="cx"> this.stopListeningFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
</span><span class="cx"> this.stopListeningFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
</span><ins>+
+ if (window.WebKitPlaybackTargetAvailabilityEvent) {
+ this.stopListeningFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
+ this.stopListeningFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><del>-
</del><span class="cx"> createBase: function() {
</span><span class="cx"> Controller.prototype.createBase.call(this);
</span><span class="cx">
</span><span class="lines">@@ -39,6 +56,22 @@
</span><span class="cx"> this.stopListeningFor(this.base, 'mouseout', this.handleWrapperMouseOut);
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ UIString: function(s){
+ var string = Controller.prototype.UIString.call(this, s);
+ if (string)
+ return string;
+
+ if (this.localizedStrings[s])
+ return this.localizedStrings[s];
+ else
+ return s; // FIXME: LOG something if string not localized.
+ },
+ localizedStrings: {
+ // FIXME: Move localization to ext strings file <http://webkit.org/b/120956>
+ '##DEVICE_TYPE##': 'AirPlay',
+ '##DEVICE_NAME##': 'This video is playing on "##DEVICE_NAME##".',
+ },
+
</ins><span class="cx"> shouldHaveStartPlaybackButton: function() {
</span><span class="cx"> var allowsInline = this.host.mediaPlaybackAllowsInline;
</span><span class="cx">
</span><span class="lines">@@ -68,12 +101,60 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> shouldHaveAnyUI: function() {
</span><del>- return this.shouldHaveStartPlaybackButton() || Controller.prototype.shouldHaveAnyUI.call(this);
</del><ins>+ return this.shouldHaveStartPlaybackButton() || Controller.prototype.shouldHaveAnyUI.call(this) || this.currentPlaybackTargetIsWireless();
</ins><span class="cx"> },
</span><span class="cx">
</span><ins>+ currentPlaybackTargetIsWireless: function()
+ {
+ return ControllerIOS.gSimulateWirelessPlaybackTarget || ((typeof this.video.webkitCurrentPlaybackTargetIsWireless === "function") && this.video.webkitCurrentPlaybackTargetIsWireless());
+ },
+
+ updateWirelessPlaybackStatus: function()
+ {
+ if (this.currentPlaybackTargetIsWireless()) {
+ var backgroundImageSVG = "url('" + ControllerIOS.gWirelessImage + "')";
+
+ var deviceType = this.UIString('##DEVICE_TYPE##');
+ backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_TYPE##', deviceType);
+
+ // FIXME: Get the device type and name from the host.
+ var deviceName = "unknown";
+ var deviceName = this.UIString('##DEVICE_NAME##').replace('##DEVICE_NAME##', deviceName);;
+ backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_NAME##', deviceName);
+
+ this.controls.wirelessPlaybackStatus.style.backgroundImage = backgroundImageSVG;
+ this.controls.wirelessPlaybackStatus.setAttribute('aria-label', deviceType + ", " + deviceName);
+
+ this.controls.wirelessPlaybackStatus.classList.remove(this.ClassNames.hidden);
+ this.controls.wirelessTargetPicker.classList.add(this.ClassNames.active);
+ } else {
+ this.controls.wirelessPlaybackStatus.classList.add(this.ClassNames.hidden);
+ this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.active);
+ }
+ },
+
+ updateWirelessTargetAvailable: function()
+ {
+ if (ControllerIOS.gSimulateWirelessPlaybackTarget || this.hasWirelessPlaybackTargets)
+ this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.hidden);
+ else
+ this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
+ },
+
</ins><span class="cx"> createControls: function() {
</span><span class="cx"> Controller.prototype.createControls.call(this);
</span><span class="cx">
</span><ins>+ var wirelessPlaybackStatus = this.controls.wirelessPlaybackStatus = document.createElement('div');
+ wirelessPlaybackStatus.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-status');
+ wirelessPlaybackStatus.classList.add(this.ClassNames.hidden);
+
+ var wirelessTargetPicker = this.controls.wirelessTargetPicker = document.createElement('button');
+ wirelessTargetPicker.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-picker-button');
+ wirelessTargetPicker.setAttribute('aria-label', this.UIString('Choose Wireless Display'));
+ this.listenFor(wirelessTargetPicker, 'click', this.handleWirelessPickerButtonClicked);
+ if (!ControllerIOS.gSimulateWirelessPlaybackTarget)
+ wirelessTargetPicker.classList.add(this.ClassNames.hidden);
+
</ins><span class="cx"> this.listenFor(this.controls.startPlaybackButton, 'touchstart', this.handleStartPlaybackButtonTouchStart);
</span><span class="cx"> this.listenFor(this.controls.startPlaybackButton, 'touchend', this.handleStartPlaybackButtonTouchEnd);
</span><span class="cx"> this.listenFor(this.controls.startPlaybackButton, 'touchcancel', this.handleStartPlaybackButtonTouchCancel);
</span><span class="lines">@@ -111,8 +192,11 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> configureInlineControls: function() {
</span><ins>+ this.base.appendChild(this.controls.wirelessPlaybackStatus);
+
</ins><span class="cx"> this.controls.panel.appendChild(this.controls.playButton);
</span><span class="cx"> this.controls.panel.appendChild(this.controls.timelineBox);
</span><ins>+ this.controls.panel.appendChild(this.controls.wirelessTargetPicker);
</ins><span class="cx"> this.controls.timelineBox.appendChild(this.controls.currentTime);
</span><span class="cx"> this.controls.timelineBox.appendChild(this.controls.timeline);
</span><span class="cx"> this.controls.timelineBox.appendChild(this.controls.remainingTime);
</span><span class="lines">@@ -274,6 +358,21 @@
</span><span class="cx"> this.updateControls();
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ handleWirelessPlaybackChange: function(event)
+ {
+ updateWirelessPlaybackStatus();
+ },
+
+ handleWirelessTargetAvailableChange: function(event)
+ {
+ this.hasWirelessPlaybackTargets = event.availability == "available";
+ updateWirelessTargetAvailable();
+ },
+
+ handleWirelessPickerButtonClicked: function(event)
+ {
+ video.webkitShowPlaybackTargetPicker();
+ },
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> Object.create(Controller.prototype).extend(ControllerIOS.prototype);
</span></span></pre>
</div>
</div>
</body>
</html>