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// This file contains global constant variables used by the application. 6 7// Heart beat message header. 8var HEART_BEAT_HEADER = 'HEARTBEAT'; 9 10// Default key used to encrypt many media files used in browser tests. 11var KEY = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, 12 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]); 13 14var DEFAULT_LICENSE_SERVER = document.location.origin + '/license_server'; 15 16var DEFAULT_MEDIA_FILE = 'http://shadi.kir/alcatraz/Chrome_44-enc_av.webm'; 17 18// Key ID used for init data. 19var KEY_ID = '0123456789012345'; 20 21// Unique strings to identify test result expectations. 22var KEY_ERROR = 'KEY_ERROR'; 23var FILE_IO_TEST_RESULT_HEADER = 'FILEIOTESTRESULT'; 24var FILE_IO_TEST_SUCCESS = 'FILE_IO_TEST_SUCCESS'; 25var PREFIXED_API_LOAD_SESSION_HEADER = 'LOAD_SESSION|'; 26var NOTSUPPORTEDERROR = 'NOTSUPPORTEDERROR'; 27 28// Available EME key systems to use. 29var PREFIXED_CLEARKEY = 'webkit-org.w3.clearkey'; 30var CLEARKEY = 'org.w3.clearkey'; 31var EXTERNAL_CLEARKEY = 'org.chromium.externalclearkey'; 32var WIDEVINE_KEYSYSTEM = 'com.widevine.alpha'; 33var FILE_IO_TEST_KEYSYSTEM = 'org.chromium.externalclearkey.fileiotest'; 34var EME_PREFIXED_VERSION = 'Prefixed EME (v 0.1b)'; 35var EME_UNPREFIXED_VERSION = 'Unprefixed EME (Working draft)'; 36 37// Key system name:value map to show on the document page. 38var KEY_SYSTEMS = { 39 'Widevine': WIDEVINE_KEYSYSTEM, 40 'Clearkey': CLEARKEY, 41 'External Clearkey': EXTERNAL_CLEARKEY 42}; 43 44// General WebM and MP4 name:content_type map to show on the document page. 45var MEDIA_TYPES = { 46 'WebM - Audio Video': 'video/webm; codecs="vorbis, vp8"', 47 'WebM - Video Only': 'video/webm; codecs="vp8"', 48 'WebM - Audio Only': 'video/webm; codecs="vorbis"', 49 'MP4 - Video Only': 'video/mp4; codecs="avc1.4D4041"', 50 'MP4 - Audio Only': 'audio/mp4; codecs="mp4a.40.2"' 51}; 52 53// Update the EME versions list by checking runtime support by the browser. 54var EME_VERSIONS_OPTIONS = {}; 55EME_VERSIONS_OPTIONS[EME_UNPREFIXED_VERSION] = EME_UNPREFIXED_VERSION; 56EME_VERSIONS_OPTIONS[EME_PREFIXED_VERSION] = EME_PREFIXED_VERSION; 57 58var EME_DISABLED_OPTIONS = []; 59if (!document.createElement('video').webkitAddKey) 60 EME_DISABLED_OPTIONS.push(EME_PREFIXED_VERSION); 61if (!document.createElement('video').setMediaKeys) 62 EME_DISABLED_OPTIONS.push(EME_UNPREFIXED_VERSION); 63 64// Global document elements ID's. 65var VIDEO_ELEMENT_ID = 'video'; 66var MEDIA_FILE_ELEMENT_ID = 'mediaFile'; 67var LICENSE_SERVER_ELEMENT_ID = 'licenseServer'; 68var KEYSYSTEM_ELEMENT_ID = 'keySystemList'; 69var MEDIA_TYPE_ELEMENT_ID = 'mediaTypeList'; 70var USE_MSE_ELEMENT_ID = 'useMSE'; 71var USE_PREFIXED_EME_ID = 'usePrefixedEME'; 72 73// These variables get updated every second, so better to have global pointers. 74var decodedFPSElement = document.getElementById('decodedFPS'); 75var droppedFPSElement = document.getElementById('droppedFPS'); 76var droppedFramesElement = document.getElementById('droppedFrames'); 77var docLogs = document.getElementById('logs'); 78