OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The PlayerUtils provides utility functions to binding common media events | 5 // The PlayerUtils provides utility functions to binding common media events |
6 // to specific player functions. It also provides functions to load media source | 6 // to specific player functions. It also provides functions to load media source |
7 // base on test configurations. | 7 // base on test configurations. |
8 var PlayerUtils = new function() { | 8 var PlayerUtils = new function() { |
9 } | 9 } |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 } catch (e) { | 92 } catch (e) { |
93 Utils.failTest(e); | 93 Utils.failTest(e); |
94 } | 94 } |
95 }); | 95 }); |
96 | 96 |
97 this.registerDefaultEventListeners(player); | 97 this.registerDefaultEventListeners(player); |
98 player.video.receivedKeyMessage = false; | 98 player.video.receivedKeyMessage = false; |
99 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); | 99 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); |
100 var config = {}; | 100 var config = {}; |
| 101 // The File IO test requires persistent state support. |
| 102 if (player.testConfig.keySystem == |
| 103 'org.chromium.externalclearkey.fileiotest') { |
| 104 config = {persistentState: "required"}; |
| 105 } |
101 if (player.testConfig.sessionToLoad) { | 106 if (player.testConfig.sessionToLoad) { |
102 config = { | 107 config = { |
103 persistentState: "required", | 108 persistentState: "required", |
104 sessionTypes: ["temporary", "persistent-license"] | 109 sessionTypes: ["temporary", "persistent-license"] |
105 }; | 110 }; |
106 } | 111 } |
107 return navigator.requestMediaKeySystemAccess( | 112 return navigator.requestMediaKeySystemAccess( |
108 player.testConfig.keySystem, [config]) | 113 player.testConfig.keySystem, [config]) |
109 .then(function(access) { return access.createMediaKeys(); }) | 114 .then(function(access) { return access.createMediaKeys(); }) |
110 .then(function(mediaKeys) { | 115 .then(function(mediaKeys) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 default: | 221 default: |
217 Utils.timeLog(keySystem + ' is not a known key system'); | 222 Utils.timeLog(keySystem + ' is not a known key system'); |
218 if (usePrefixedEME) | 223 if (usePrefixedEME) |
219 return PrefixedClearKeyPlayer; | 224 return PrefixedClearKeyPlayer; |
220 return ClearKeyPlayer; | 225 return ClearKeyPlayer; |
221 } | 226 } |
222 } | 227 } |
223 var Player = getPlayerType(testConfig.keySystem); | 228 var Player = getPlayerType(testConfig.keySystem); |
224 return new Player(video, testConfig); | 229 return new Player(video, testConfig); |
225 }; | 230 }; |
OLD | NEW |