Bug 1001279 - Add support of websites to opt-out of casting videos. r=wesj, a=sledru
authorMark Finkle <mfinkle@mozilla.com>
Thu, 01 May 2014 17:29:00 -0400
changeset 199109 b3973b49fe6c71bc64ce6b13bf3200093f591733
parent 199108 f07eb0415d251aff46c2f66eb6208c7f58675530
child 199110 71190db0a57fc7915afb5aaba336f6056e580cfb
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, sledru
bugs1001279
milestone31.0a2
Bug 1001279 - Add support of websites to opt-out of casting videos. r=wesj, a=sledru
mobile/android/chrome/content/CastingApps.js
--- a/mobile/android/chrome/content/CastingApps.js
+++ b/mobile/android/chrome/content/CastingApps.js
@@ -133,21 +133,27 @@ var CastingApps = {
       }
     } catch(e) {}
 
     // Could be null
     return video;
   },
 
   _getVideo: function(aElement) {
-    // Given the hardware support for H264, let's only look for 'mp4' sources
     if (!aElement instanceof HTMLVideoElement) {
       return null;
     }
 
+    // Allow websites to opt-out using the Apple airplay attribute
+    // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/AirPlayGuide/OptingInorOutofAirPlay/OptingInorOutofAirPlay.html
+    if (aElement.getAttribute("x-webkit-airplay") === "deny") {
+      return null;
+    }
+
+    // Given the hardware support for H264, let's only look for 'mp4' sources
     function allowableExtension(aURI) {
       if (aURI && aURI instanceof Ci.nsIURL) {
         return (aURI.fileExtension == "mp4");
       }
       return false;
     }
 
     // Grab the poster attribute from the <video>