[EME] Cleaned up examples.
Added links, removed invalid event handler registration, and fixed mistake (bug 19078).
--- 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 @@
</script>
<body onload="load()">
- <video src="foo.webm" autoplay id="video" on<precoderef>keymessage</precoderef>="handleMessage(event)"></video>
+ <video src="foo.webm" autoplay id="video"></video>
</body></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 @@
}
</script>
-<video src="foo.webm" autoplay on<precoderef>needkey</precoderef>="handleKeyNeeded(event)" on<precoderef>keymessage</precoderef>="handleMessage(event)"></video></pre>
+<video src="foo.webm" autoplay on<precoderef>needkey</precoderef>="handleKeyNeeded(event)"></video></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";