[EME] Cleaned up examples.
authorDavid Dorwin <ddorwin@google.com>
Mon, 29 Oct 2012 17:51:00 +0100
changeset 40 ea839d93eee5
parent 39 e029f71aafca
child 41 0d35d1f2a736
[EME] Cleaned up examples.

Added links, removed invalid event handler registration, and fixed mistake (bug 19078).
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.xml	Thu Oct 18 21:46:51 2012 -0700
+++ b/encrypted-media/encrypted-media.xml	Mon Oct 29 17:51:00 2012 +0100
@@ -976,12 +976,12 @@
   function load() {
     var video = document.getElementById("video");
 
-    if (!video.keys)
-      video.keys = MediaKeys("org.w3.clearkey");
-    if (!video.keys)
+    if (!video.<precoderef>keys</precoderef>)
+      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>("org.w3.clearkey");
+    if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
-    var keySession = mediaKeys.createSession();
+    var keySession = video.<precoderef>keys</precoderef>.<premethodref>createSession</premethodref>();
     if (!keySession)
       throw "Could not create key session";
 
@@ -997,7 +997,7 @@
 &lt;/script&gt;
 
 &lt;body onload="load()"&gt;
-  &lt;video src="foo.webm" autoplay id="video" on<precoderef>keymessage</precoderef>="handleMessage(event)"&gt;&lt;/video&gt;
+  &lt;video src="foo.webm" autoplay id="video"&gt;&lt;/video&gt;
 &lt;/body&gt;</pre>
     </div>
 
@@ -1018,12 +1018,12 @@
     var video = event.target;
     var initData = event.<precoderef>initData</precoderef>;
 
-    if (!video.keys)
-      video.keys = MediaKeys("org.w3.clearkey");
-    if (!video.keys)
+    if (!video.<precoderef>keys</precoderef>)
+      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>("org.w3.clearkey");
+    if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
-    var keySession = mediaKeys.createSession(mimeType, initData);
+    var keySession = video.<precoderef>keys</precoderef>.<premethodref>createSession</premethodref>(mimeType, initData);
     if (!keySession)
       throw "Could not create key session";
 
@@ -1042,7 +1042,7 @@
   }
 &lt;/script&gt;
 
-&lt;video src="foo.webm" autoplay on<precoderef>needkey</precoderef>="handleKeyNeeded(event)" on<precoderef>keymessage</precoderef>="handleMessage(event)"&gt;&lt;/video&gt;</pre>
+&lt;video src="foo.webm" autoplay on<precoderef>needkey</precoderef>="handleKeyNeeded(event)"&gt;&lt;/video&gt;</pre>
     </div>
 
     <h4 class="exampleheader">8.2.2. Other Content Decryption Module</h4>
@@ -1055,12 +1055,12 @@
     var video = event.target;
     var initData = event.<precoderef>initData</precoderef>;
 
-    if (!video.keys)
-      video.keys = MediaKeys("com.example.somesystem.1_0");
-    if (!video.keys)
+    if (!video.<precoderef>keys</precoderef>)
+      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>("com.example.somesystem.1_0");
+    if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
-    var keySession = mediaKeys.createSession(mimeType, initData);
+    var keySession = video.<precoderef>keys</precoderef>.<premethodref>createSession</premethodref>(mimeType, initData);
     if (!keySession)
       throw "Could not create key session";
 
@@ -1114,14 +1114,14 @@
     var video = event.target;
     var initData = event.<precoderef>initData</precoderef>;
 
-    if (!video.keys) {
+    if (!video.<precoderef>keys</precoderef>) {
       selectKeySystem(video);
-      video.keys = MediaKeys(keySystem);
+      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>(keySystem);
     }
-    if (!video.keys)
+    if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
-    var keySession = mediaKeys.createSession(mimeType, initData);
+    var keySession = video.<precoderef>keys</precoderef>.<premethodref>createSession</premethodref>(mimeType, initData);
     if (!keySession)
       throw "Could not create key session";
 
@@ -1190,14 +1190,14 @@
     var video = event.target;
     var initData = event.<precoderef>initData</precoderef>;
 
-    if (!video.keys) {
+    if (!video.<precoderef>keys</precoderef>) {
       selectKeySystem(video);  // See previous example for implementation.
-      video.keys = MediaKeys(keySystem);
+      video.<precoderef>keys</precoderef> = video.<precoderef>MediaKeys</precoderef>(keySystem);
     }
-    if (!video.keys)
+    if (!video.<precoderef>keys</precoderef>)
       throw "Could not create MediaKeys";
 
-    var keySession = video.keys.createSession(mimeType, initData);
+    var keySession = video.<precoderef>keys</precoderef>.<premethodref>createSession</premethodref>(mimeType, initData);
     if (!keySession)
       throw "Could not create key session";