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.
5 // This file contains global constant variables used by the application.
7 // Renewal message header. External Clear Key implementation returns this as
8 // part of renewal messages.
9 var PREFIXED_EME_RENEWAL_MESSAGE_HEADER = 'RENEWAL';
11 // Default key used to encrypt many media files used in browser tests.
12 var KEY = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
13 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
15 var DEFAULT_LICENSE_SERVER = document.location.origin + '/license_server';
17 var DEFAULT_MEDIA_FILE = 'http://shadi.kir/alcatraz/Chrome_44-enc_av.webm';
19 // Key ID used for init data.
20 var KEY_ID = '0123456789012345';
22 // Unique strings to identify test result expectations.
23 var FILE_IO_TEST_SUCCESS = 'FILE_IO_TEST_SUCCESS';
24 var NOTSUPPORTEDERROR = 'NOTSUPPORTEDERROR';
25 var EME_GENERATEREQUEST_FAILED = 'EME_GENERATEREQUEST_FAILED';
26 var EME_SESSION_NOT_FOUND = 'EME_SESSION_NOT_FOUND';
27 var EME_LOAD_FAILED = 'EME_LOAD_FAILED';
28 var EME_UPDATE_FAILED = 'EME_UPDATE_FAILED';
29 var EME_ERROR_EVENT = 'EME_ERROR_EVENT';
30 var EME_MESSAGE_UNEXPECTED_TYPE = 'EME_MESSAGE_UNEXPECTED_TYPE';
31 var PREFIXED_EME_RENEWAL_MISSING_HEADER = 'PREFIXED_EME_RENEWAL_MISSING_HEADER';
32 var PREFIXED_EME_ERROR_EVENT = 'PREFIXED_EME_ERROR_EVENT';
34 // Headers used when testing file I/O.
35 var FILE_IO_TEST_RESULT_HEADER = 'FILEIOTESTRESULT';
36 var PREFIXED_EME_API_LOAD_SESSION_HEADER = 'LOAD_SESSION|';
38 // Available EME key systems to use.
39 var PREFIXED_CLEARKEY = 'webkit-org.w3.clearkey';
40 var CLEARKEY = 'org.w3.clearkey';
41 var EXTERNAL_CLEARKEY = 'org.chromium.externalclearkey';
42 var WIDEVINE_KEYSYSTEM = 'com.widevine.alpha';
43 var FILE_IO_TEST_KEYSYSTEM = 'org.chromium.externalclearkey.fileiotest';
44 var EME_PREFIXED_VERSION = 'Prefixed EME (v 0.1b)';
45 var EME_UNPREFIXED_VERSION = 'Unprefixed EME (Working draft)';
47 // Key system name:value map to show on the document page.
49 'Widevine': WIDEVINE_KEYSYSTEM,
51 'External Clearkey': EXTERNAL_CLEARKEY
54 // General WebM and MP4 name:content_type map to show on the document page.
56 'WebM - Audio Video': 'video/webm; codecs="vorbis, vp8"',
57 'WebM - Video Only': 'video/webm; codecs="vp8"',
58 'WebM - Audio Only': 'video/webm; codecs="vorbis"',
59 'MP4 - Video Only': 'video/mp4; codecs="avc1.4D4041"',
60 'MP4 - Audio Only': 'audio/mp4; codecs="mp4a.40.2"'
63 // Update the EME versions list by checking runtime support by the browser.
64 var EME_VERSIONS_OPTIONS = {};
65 EME_VERSIONS_OPTIONS[EME_UNPREFIXED_VERSION] = EME_UNPREFIXED_VERSION;
66 EME_VERSIONS_OPTIONS[EME_PREFIXED_VERSION] = EME_PREFIXED_VERSION;
68 var EME_DISABLED_OPTIONS = [];
69 if (!document.createElement('video').webkitAddKey)
70 EME_DISABLED_OPTIONS.push(EME_PREFIXED_VERSION);
71 if (!document.createElement('video').setMediaKeys)
72 EME_DISABLED_OPTIONS.push(EME_UNPREFIXED_VERSION);
74 // Global document elements ID's.
75 var VIDEO_ELEMENT_ID = 'video';
76 var MEDIA_FILE_ELEMENT_ID = 'mediaFile';
77 var LICENSE_SERVER_ELEMENT_ID = 'licenseServer';
78 var KEYSYSTEM_ELEMENT_ID = 'keySystemList';
79 var MEDIA_TYPE_ELEMENT_ID = 'mediaTypeList';
80 var USE_MSE_ELEMENT_ID = 'useMSE';
81 var USE_PREFIXED_EME_ID = 'usePrefixedEME';
82 var USE_PLAY_TWICE_ELEMENT_ID = 'playTwice';
84 // These variables get updated every second, so better to have global pointers.
85 var decodedFPSElement = document.getElementById('decodedFPS');
86 var droppedFPSElement = document.getElementById('droppedFPS');
87 var droppedFramesElement = document.getElementById('droppedFrames');
88 var docLogs = document.getElementById('logs');