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

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

Issue 574293002: Files.app: Show thumbnail of non-image file even when the file cache is present (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 | « ui/file_manager/file_manager/foreground/js/thumbnail_loader.js ('k') | 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @param {Element} playerContainer Main container. 8 * @param {Element} playerContainer Main container.
9 * @param {Element} videoContainer Container for the video element. 9 * @param {Element} videoContainer Container for the video element.
10 * @param {Element} controlsContainer Container for video controls. 10 * @param {Element} controlsContainer Container for video controls.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 this.controls.casting = !!this.currentCast_; 308 this.controls.casting = !!this.currentCast_;
309 309
310 videoPlayerElement.setAttribute('loading', true); 310 videoPlayerElement.setAttribute('loading', true);
311 311
312 var media = new MediaManager(video.entry); 312 var media = new MediaManager(video.entry);
313 313
314 Promise.all([media.getThumbnail(), media.getToken()]) 314 Promise.all([media.getThumbnail(), media.getToken()])
315 .then(function(results) { 315 .then(function(results) {
316 var url = results[0]; 316 var url = results[0];
317 var token = results[1]; 317 var token = results[1];
318 document.querySelector('#thumbnail').style.backgroundImage = 318 if (url && token) {
319 'url(' + url + '&access_token=' + token + ')'; 319 document.querySelector('#thumbnail').style.backgroundImage =
320 'url(' + url + '&access_token=' + token + ')';
321 } else {
322 document.querySelector('#thumbnail').style.backgroundImage = '';
323 }
320 }) 324 })
321 .catch(function() { 325 .catch(function() {
322 // Shows no image on error. 326 // Shows no image on error.
323 document.querySelector('#thumbnail').style.backgroundImage = ''; 327 document.querySelector('#thumbnail').style.backgroundImage = '';
324 }); 328 });
325 329
326 var videoElementInitializePromise; 330 var videoElementInitializePromise;
327 if (this.currentCast_) { 331 if (this.currentCast_) {
328 videoPlayerElement.setAttribute('casting', true); 332 videoPlayerElement.setAttribute('casting', true);
329 333
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 var initPromise = Promise.all( 671 var initPromise = Promise.all(
668 [new Promise(initVideos.wrap(null)), 672 [new Promise(initVideos.wrap(null)),
669 new Promise(initStrings.wrap(null)), 673 new Promise(initStrings.wrap(null)),
670 new Promise(util.addPageLoadHandler.wrap(null))]); 674 new Promise(util.addPageLoadHandler.wrap(null))]);
671 675
672 initPromise.then(function(results) { 676 initPromise.then(function(results) {
673 var videos = results[0]; 677 var videos = results[0];
674 player.prepare(videos); 678 player.prepare(videos);
675 return new Promise(player.playFirstVideo.wrap(player)); 679 return new Promise(player.playFirstVideo.wrap(player));
676 }.wrap(null)); 680 }.wrap(null));
OLDNEW
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/thumbnail_loader.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698