Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / media / eme_player_js / prefixed_widevine_player.js
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Widevine player responsible for playing media using Widevine key system
6 // and prefixed EME API.
7 function PrefixedWidevinePlayer() {
8 }
9
10 PrefixedWidevinePlayer.prototype.init = function(video) {
11   InitPrefixedEMEPlayer(this, video);
12 };
13
14 PrefixedWidevinePlayer.prototype.onWebkitKeyMessage = function(message) {
15   function onSuccess(response) {
16     var key = new Uint8Array(response);
17     Utils.timeLog('Adding key to sessionID: ' + message.sessionId, key);
18     message.target.webkitAddKey(TestConfig.keySystem, key, new Uint8Array(1),
19                                 message.sessionId);
20   }
21   Utils.sendRequest('POST', 'arraybuffer', message.message,
22                     TestConfig.licenseServerURL, onSuccess,
23                     TestConfig.forceInvalidResponse);
24 };