[Media iOS] Ensure there is a nice default fallback for missing wireless target names
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Aug 2014 19:42:06 +0000 (19:42 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Aug 2014 19:42:06 +0000 (19:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135488
<rdar://problem/17879156>

Reviewed by Eric Carlson.

We occasionally run into cases where this.host.externalDeviceDisplayName
is empty or null, creating a pretty ugly/confusing string in the
wireless playback status screen.

If this happens, we should default to using "Apple TV".

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.updateWirelessPlaybackStatus): Check if the externalDeviceDisplayName
is empty or null, and fall back to "Apple TV" if so.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171944 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js

index c445d9b..791a588 100644 (file)
@@ -1,3 +1,21 @@
+2014-07-31  Dean Jackson  <dino@apple.com>
+
+        [Media iOS] Ensure there is a nice default fallback for missing wireless target names
+        https://bugs.webkit.org/show_bug.cgi?id=135488
+        <rdar://problem/17879156>
+
+        Reviewed by Eric Carlson.
+
+        We occasionally run into cases where this.host.externalDeviceDisplayName
+        is empty or null, creating a pretty ugly/confusing string in the
+        wireless playback status screen.
+
+        If this happens, we should default to using "Apple TV".
+
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.updateWirelessPlaybackStatus): Check if the externalDeviceDisplayName
+        is empty or null, and fall back to "Apple TV" if so.
+
 2014-07-30  Myles C. Maxfield  <mmaxfield@apple.com>
 
         URLs in srcset attributes are not made absolute upon copy and paste
index bda9f1e..3eb3200 100644 (file)
@@ -110,13 +110,16 @@ ControllerIOS.prototype = {
             var deviceType = "";
             var type = this.host.externalDeviceType;
             if (type == "airplay") {
+                var externalDeviceDisplayName = this.host.externalDeviceDisplayName;
+                if (!externalDeviceDisplayName || externalDeviceDisplayName == "")
+                    externalDeviceDisplayName = "Apple TV";
                 deviceType = this.UIString('##WIRELESS_PLAYBACK_DEVICE_TYPE##');
-                deviceName = this.UIString('##WIRELESS_PLAYBACK_DEVICE_NAME##', '##DEVICE_NAME##', this.host.externalDeviceDisplayName);
+                deviceName = this.UIString('##WIRELESS_PLAYBACK_DEVICE_NAME##', '##DEVICE_NAME##', externalDeviceDisplayName);
             } else if (type == "tvout") {
                 deviceType = this.UIString('##TVOUT_DEVICE_TYPE##');
                 deviceName = this.UIString('##TVOUT_DEVICE_NAME##');
             }
-            
+
             backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_TYPE##', deviceType);
             backgroundImageSVG = backgroundImageSVG.replace('##DEVICE_NAME##', deviceName);