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

Side by Side Diff: ui/file_manager/video_player/js/cast/caster.js

Issue 1987173002: Video Player: Support Media Router to cast Drive videos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 7 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
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 // This hack prevents a bug on the cast extension. 5 // This hack prevents a bug on the cast extension.
6 // TODO(yoshiki): Remove this once the cast extension supports Chrome apps. 6 // TODO(yoshiki): Remove this once the cast extension supports Chrome apps.
7 // Although localStorage in Chrome app is not supported, but it's used in the 7 // Although localStorage in Chrome app is not supported, but it's used in the
8 // cast extension. This line prevents an exception on using localStorage. 8 // cast extension. This line prevents an exception on using localStorage.
9 Object.defineProperty(window, 'localStorage', { 9 Object.defineProperty(window, 'localStorage', {
10 get: function() { return {}; } 10 get: function() { return {}; }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 /** 127 /**
128 * Called when receiver availability is changed. This method is also called when 128 * Called when receiver availability is changed. This method is also called when
129 * initialization is completed. 129 * initialization is completed.
130 * 130 *
131 * @param {chrome.cast.ReceiverAvailability} availability Availability of casts. 131 * @param {chrome.cast.ReceiverAvailability} availability Availability of casts.
132 * @param {Array<Object>} receivers List of casts. 132 * @param {Array<Object>} receivers List of casts.
133 */ 133 */
134 function onReceiver(availability, receivers) { 134 function onReceiver(availability, receivers) {
135 if (chrome.cast.usingPresentationApi) {
136 player.setCastAvailability(
137 availability === chrome.cast.ReceiverAvailability.AVAILABLE);
138 return;
139 }
140
135 if (availability === chrome.cast.ReceiverAvailability.AVAILABLE) { 141 if (availability === chrome.cast.ReceiverAvailability.AVAILABLE) {
136 if (!receivers) { 142 if (!receivers) {
137 console.error('Receiver list is empty.'); 143 console.error('Receiver list is empty.');
138 receivers = []; 144 receivers = [];
139 } 145 }
140 146
141 metrics.recordNumberOfCastDevices(receivers.length); 147 metrics.recordNumberOfCastDevices(receivers.length);
142 player.setCastList(receivers); 148 player.setCastList(receivers);
143 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) { 149 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) {
144 metrics.recordNumberOfCastDevices(0); 150 metrics.recordNumberOfCastDevices(0);
145 player.setCastList([]); 151 player.setCastList([]);
146 } else { 152 } else {
147 console.error('Unexpected response in onReceiver.', arguments); 153 console.error('Unexpected response in onReceiver.', arguments);
148 player.setCastList([]); 154 player.setCastList([]);
149 } 155 }
150 } 156 }
OLDNEW
« no previous file with comments | « ui/file_manager/video_player/js/cast/cast_video_element.js ('k') | ui/file_manager/video_player/js/media_controls.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698