[EME] Bug 20337 (follow-up): Use setMediaKeys() in the examples instead of assigning to the keys attribute.
authorDavid Dorwin <ddorwin@google.com>
Fri, 24 May 2013 16:29:51 -0700
changeset 128 b96bdeaf7857
parent 127 80be415b8be1
child 129 fc9e628b538f
[EME] Bug 20337 (follow-up): Use setMediaKeys() in the examples instead of assigning to the keys attribute.

This updates the examples to match the API changes in changeset 58.
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Fri May 24 16:17:20 2013 -0700
+++ b/encrypted-media/encrypted-media.html	Fri May 24 16:29:51 2013 -0700
@@ -1037,7 +1037,7 @@
     var video = document.getElementById("video");
 
     if (!video.<a href="#dom-keys">keys</a>)
-      video.<a href="#dom-keys">keys</a> = video.<a href="#dom-mediakeys">MediaKeys</a>("org.w3.clearkey");
+      video.<a href="#dom-setmediakeys">setMediaKeys</a>(new <a href="#dom-mediakeys">MediaKeys</a>("org.w3.clearkey"));
     if (!video.<a href="#dom-keys">keys</a>)
       throw "Could not create MediaKeys";
 
@@ -1077,7 +1077,7 @@
     var initData = event.<a href="#dom-initdata">initData</a>;
 
     if (!video.<a href="#dom-keys">keys</a>)
-      video.<a href="#dom-keys">keys</a> = video.<a href="#dom-mediakeys">MediaKeys</a>("org.w3.clearkey");
+      video.<a href="#dom-setmediakeys">setMediaKeys</a>(new <a href="#dom-mediakeys">MediaKeys</a>("org.w3.clearkey"));
     if (!video.<a href="#dom-keys">keys</a>)
       throw "Could not create MediaKeys";
 
@@ -1118,7 +1118,7 @@
     var initData = event.<a href="#dom-initdata">initData</a>;
 
     if (!video.<a href="#dom-keys">keys</a>)
-      video.<a href="#dom-keys">keys</a> = video.<a href="#dom-mediakeys">MediaKeys</a>("com.example.somesystem.1_0");
+      video.<a href="#dom-setmediakeys">setMediaKeys</a>(new <a href="#dom-mediakeys">MediaKeys</a>("com.example.somesystem.1_0"));
     if (!video.<a href="#dom-keys">keys</a>)
       throw "Could not create MediaKeys";
 
@@ -1182,7 +1182,7 @@
 
     if (!video.<a href="#dom-keys">keys</a>) {
       selectKeySystem();
-      video.<a href="#dom-keys">keys</a> = video.<a href="#dom-mediakeys">MediaKeys</a>(keySystem);
+      video.<a href="#dom-setmediakeys">setMediaKeys</a>(new <a href="#dom-mediakeys">MediaKeys</a>(keySystem));
     }
     if (!video.<a href="#dom-keys">keys</a>)
       throw "Could not create MediaKeys";
@@ -1262,7 +1262,7 @@
 
     if (!video.<a href="#dom-keys">keys</a>) {
       selectKeySystem();  // See previous example for implementation.
-      video.<a href="#dom-keys">keys</a> = video.<a href="#dom-mediakeys">MediaKeys</a>(keySystem);
+      video.<a href="#dom-setmediakeys">setMediaKeys</a>(new <a href="#dom-mediakeys">MediaKeys</a>(keySystem));
     }
     if (!video.<a href="#dom-keys">keys</a>)
       throw "Could not create MediaKeys";
--- a/encrypted-media/encrypted-media.xml	Fri May 24 16:17:20 2013 -0700
+++ b/encrypted-media/encrypted-media.xml	Fri May 24 16:29:51 2013 -0700
@@ -982,7 +982,7 @@
     var video = document.getElementById("video");
 
     if (!video.<precoderef>keys</precoderef>)
-      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>("org.w3.clearkey");
+      video.<premethodref>setMediaKeys</premethodref>(new <precoderef>MediaKeys</precoderef>("org.w3.clearkey"));
     if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
@@ -1022,7 +1022,7 @@
     var initData = event.<precoderef>initData</precoderef>;
 
     if (!video.<precoderef>keys</precoderef>)
-      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>("org.w3.clearkey");
+      video.<premethodref>setMediaKeys</premethodref>(new <precoderef>MediaKeys</precoderef>("org.w3.clearkey"));
     if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
@@ -1063,7 +1063,7 @@
     var initData = event.<precoderef>initData</precoderef>;
 
     if (!video.<precoderef>keys</precoderef>)
-      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>("com.example.somesystem.1_0");
+      video.<premethodref>setMediaKeys</premethodref>(new <precoderef>MediaKeys</precoderef>("com.example.somesystem.1_0"));
     if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
@@ -1127,7 +1127,7 @@
 
     if (!video.<precoderef>keys</precoderef>) {
       selectKeySystem();
-      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>(keySystem);
+      video.<premethodref>setMediaKeys</premethodref>(new <precoderef>MediaKeys</precoderef>(keySystem));
     }
     if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
@@ -1207,7 +1207,7 @@
 
     if (!video.<precoderef>keys</precoderef>) {
       selectKeySystem();  // See previous example for implementation.
-      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>(keySystem);
+      video.<premethodref>setMediaKeys</premethodref>(new <precoderef>MediaKeys</precoderef>(keySystem));
     }
     if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";