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

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: Fix null-pointer exception 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
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 this.controls.casting = !!this.currentCast_; 313 this.controls.casting = !!this.currentCast_;
314 314
315 videoPlayerElement.setAttribute('loading', true); 315 videoPlayerElement.setAttribute('loading', true);
316 316
317 var media = new MediaManager(video.entry); 317 var media = new MediaManager(video.entry);
318 318
319 Promise.all([media.getThumbnail(), media.getToken()]).then( 319 Promise.all([media.getThumbnail(), media.getToken()]).then(
320 function(results) { 320 function(results) {
321 var url = results[0]; 321 var url = results[0];
322 var token = results[1]; 322 var token = results[1];
323 document.querySelector('#thumbnail').style.backgroundImage = 323 if (url && token) {
324 'url(' + url + '&access_token=' + token + ')'; 324 document.querySelector('#thumbnail').style.backgroundImage =
325 'url(' + url + '&access_token=' + token + ')';
mtomasz 2014/09/17 09:29:48 Can we append the access token in C++? I'm working
yoshiki 2014/09/17 09:57:09 I'll do it. But please leave it as it is at this t
326 } else {
327 document.querySelector('#thumbnail').style.backgroundImage = '';
328 }
325 }).catch(function() { 329 }).catch(function() {
326 // Shows no image on error. 330 // Shows no image on error.
327 document.querySelector('#thumbnail').style.backgroundImage = ''; 331 document.querySelector('#thumbnail').style.backgroundImage = '';
328 }); 332 });
329 333
330 var videoElementInitializePromise; 334 var videoElementInitializePromise;
331 if (this.currentCast_) { 335 if (this.currentCast_) {
332 videoPlayerElement.setAttribute('casting', true); 336 videoPlayerElement.setAttribute('casting', true);
333 337
334 document.querySelector('#cast-name-label').textContent = 338 document.querySelector('#cast-name-label').textContent =
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 var initPromise = Promise.all( 673 var initPromise = Promise.all(
670 [new Promise(initVideos.wrap(null)), 674 [new Promise(initVideos.wrap(null)),
671 new Promise(initStrings.wrap(null)), 675 new Promise(initStrings.wrap(null)),
672 new Promise(util.addPageLoadHandler.wrap(null))]); 676 new Promise(util.addPageLoadHandler.wrap(null))]);
673 677
674 initPromise.then(function(results) { 678 initPromise.then(function(results) {
675 var videos = results[0]; 679 var videos = results[0];
676 player.prepare(videos); 680 player.prepare(videos);
677 return new Promise(player.playFirstVideo.wrap(player)); 681 return new Promise(player.playFirstVideo.wrap(player));
678 }.wrap(null)); 682 }.wrap(null));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698