updated test html5 player

This commit is contained in:
Gilles Boccon-Gibod
2015-08-31 20:28:31 -07:00
parent a02a2cdf78
commit f65ae8de8a
3 changed files with 2695 additions and 1389 deletions

View File

@@ -14,20 +14,36 @@ app.onMpdCustom = function() {
app.loadStream = function() {
if (!app.player) {
app.player = new MediaPlayer(new Dash.di.DashContext());
app.player = new MediaPlayer(new Dash.di.DashContext());
app.player.startup();
app.player.attachView(document.querySelector("#videoPlayer"));
}
var protectionData = {
// "org.w3.clearkey": {
// "clearkeys": {
// "IAAAACAAIAAgACAAAAAAAg" : "5t1CjnbMFURBou087OSj2w"
// }
// },
"com.widevine.alpha": {
"laURL": "https://widevine-proxy.appspot.com/proxy"
}
};
var laUrl = document.getElementById('laUrlInput').value;
if (laUrl) {
protectionData['com.widevine.alpha'] = {
'serverURL': laUrl
}
protectionData['com.microsoft.playready'] = {
'serverURL': laUrl
}
} else {
protectionData['com.widevine.alpha'] = {
'serverURL': 'https://widevine-proxy.appspot.com/proxy'
}
}
var clearKey = document.getElementById('clearKeyInput').value;
if (clearKey) {
var clearKeys = clearKey.split(':');
var clearKeysField = {}
clearKeysField[clearKeys[0]] = clearKeys[1];
protectionData['org.w3.clearkey'] = {
'clearkeys': clearKeysField
}
}
var mediaUrl = document.getElementById('manifestUrlInput').value;
app.player.attachSource(mediaUrl, null, protectionData);
}
@@ -36,4 +52,4 @@ if (document.readyState == 'complete' || document.readyState == 'interactive') {
app.init();
} else {
document.addEventListener('DOMContentLoaded', app.init);
}
}

View File

@@ -26,7 +26,16 @@
<tr class="dash">
<td>
Force Clear Key (&lt;kid&gt;:&lt;key&gt; in hex)
License Acquisition URL (optional)
</td>
<td>
<input id="laUrlInput" type="text" style="width: 98%;"></input>
</td>
</tr>
<tr class="dash">
<td>
Force Clear Key (optional: &lt;kid&gt;:&lt;key&gt; in base64)
</td>
<td>
<input id="clearKeyInput" type="text" style="width: 98%;"></input>
@@ -41,7 +50,7 @@
</table>
<br>
<div>
<video id="videoPlayer"
<video id="videoPlayer"
width="600" height="400"
crossorigin="anonymous"
autoplay controls>
@@ -49,4 +58,4 @@
</div>
</body>
</html>
</html>