Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: media/test/data/eme_player_js/player_utils.js

Issue 648303002: Correct logic to bind "encrypted" event in EME player_utils.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 Utils.failTest(error, KEY_ERROR); 78 Utils.failTest(error, KEY_ERROR);
79 }); 79 });
80 } 80 }
81 } catch (e) { 81 } catch (e) {
82 Utils.failTest(e); 82 Utils.failTest(e);
83 } 83 }
84 } 84 }
85 85
86 // TODO(sandersd): Stop registering 'needkey' after it is renamed to 86 // TODO(sandersd): Stop registering 'needkey' after it is renamed to
87 // 'encrypted'. 87 // 'encrypted'.
88 if (player.video.onencrypted) { 88 player.video.addEventListener('encrypted', encrypted_handler);
89 player.video.addEventListener('encrypted', encrypted_handler); 89 player.video.addEventListener('needkey', encrypted_handler);
90 } else {
91 player.video.addEventListener('needkey', encrypted_handler);
92 }
93 90
94 this.registerDefaultEventListeners(player); 91 this.registerDefaultEventListeners(player);
95 try { 92 try {
96 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); 93 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem);
97 MediaKeys.create(player.testConfig.keySystem).then(function(mediaKeys) { 94 MediaKeys.create(player.testConfig.keySystem).then(function(mediaKeys) {
98 player.video.setMediaKeys(mediaKeys); 95 player.video.setMediaKeys(mediaKeys);
99 }).catch(function(error) { 96 }).catch(function(error) {
100 Utils.failTest(error, NOTSUPPORTEDERROR); 97 Utils.failTest(error, NOTSUPPORTEDERROR);
101 }); 98 });
102 } catch (e) { 99 } catch (e) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 default: 190 default:
194 Utils.timeLog(keySystem + ' is not a known key system'); 191 Utils.timeLog(keySystem + ' is not a known key system');
195 if (usePrefixedEME) 192 if (usePrefixedEME)
196 return PrefixedClearKeyPlayer; 193 return PrefixedClearKeyPlayer;
197 return ClearKeyPlayer; 194 return ClearKeyPlayer;
198 } 195 }
199 } 196 }
200 var Player = getPlayerType(testConfig.keySystem); 197 var Player = getPlayerType(testConfig.keySystem);
201 return new Player(video, testConfig); 198 return new Player(video, testConfig);
202 }; 199 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698