| 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 '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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 videoPlayerElement.removeAttribute('last-video'); | 300 videoPlayerElement.removeAttribute('last-video'); |
| 301 | 301 |
| 302 if (this.currentPos_ === 0) | 302 if (this.currentPos_ === 0) |
| 303 videoPlayerElement.setAttribute('first-video', true); | 303 videoPlayerElement.setAttribute('first-video', true); |
| 304 else | 304 else |
| 305 videoPlayerElement.removeAttribute('first-video'); | 305 videoPlayerElement.removeAttribute('first-video'); |
| 306 | 306 |
| 307 // Re-enables ui and hides error message if already displayed. | 307 // Re-enables ui and hides error message if already displayed. |
| 308 document.querySelector('#video-player').removeAttribute('disabled'); | 308 document.querySelector('#video-player').removeAttribute('disabled'); |
| 309 document.querySelector('#error').removeAttribute('visible'); | 309 document.querySelector('#error').removeAttribute('visible'); |
| 310 this.controls.detachMedia(); |
| 310 this.controls.inactivityWatcher.disabled = true; | 311 this.controls.inactivityWatcher.disabled = true; |
| 311 this.controls.decodeErrorOccured = false; | 312 this.controls.decodeErrorOccured = false; |
| 312 this.controls.casting = !!this.currentCast_; | 313 this.controls.casting = !!this.currentCast_; |
| 313 | 314 |
| 314 videoPlayerElement.setAttribute('loading', true); | 315 videoPlayerElement.setAttribute('loading', true); |
| 315 | 316 |
| 316 var media = new MediaManager(video.entry); | 317 var media = new MediaManager(video.entry); |
| 317 | 318 |
| 318 Promise.all([media.getThumbnail(), media.getToken()]).then( | 319 Promise.all([media.getThumbnail(), media.getToken()]).then( |
| 319 function(results) { | 320 function(results) { |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 var initPromise = Promise.all( | 669 var initPromise = Promise.all( |
| 669 [new Promise(initVideos.wrap(null)), | 670 [new Promise(initVideos.wrap(null)), |
| 670 new Promise(initStrings.wrap(null)), | 671 new Promise(initStrings.wrap(null)), |
| 671 new Promise(util.addPageLoadHandler.wrap(null))]); | 672 new Promise(util.addPageLoadHandler.wrap(null))]); |
| 672 | 673 |
| 673 initPromise.then(function(results) { | 674 initPromise.then(function(results) { |
| 674 var videos = results[0]; | 675 var videos = results[0]; |
| 675 player.prepare(videos); | 676 player.prepare(videos); |
| 676 return new Promise(player.playFirstVideo.wrap(player)); | 677 return new Promise(player.playFirstVideo.wrap(player)); |
| 677 }.wrap(null)); | 678 }.wrap(null)); |
| OLD | NEW |