| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 /** | 490 /** |
| 491 * Set the list of casts. | 491 * Set the list of casts. |
| 492 * @param {Array.<Object>} casts List of casts. | 492 * @param {Array.<Object>} casts List of casts. |
| 493 */ | 493 */ |
| 494 VideoPlayer.prototype.setCastList = function(casts) { | 494 VideoPlayer.prototype.setCastList = function(casts) { |
| 495 var button = document.querySelector('.cast-button'); | 495 var button = document.querySelector('.cast-button'); |
| 496 var menu = document.querySelector('#cast-menu'); | 496 var menu = document.querySelector('#cast-menu'); |
| 497 menu.innerHTML = ''; | 497 menu.innerHTML = ''; |
| 498 | 498 |
| 499 // TODO(yoshiki): Handle the case that the current cast disapears. | 499 // TODO(yoshiki): Handle the case that the current cast disappears. |
| 500 | 500 |
| 501 if (casts.length === 0) { | 501 if (casts.length === 0) { |
| 502 button.classList.add('hidden'); | 502 button.classList.add('hidden'); |
| 503 if (this.currentCast_) | 503 if (this.currentCast_) |
| 504 this.onCurrentCastDisappear_(); | 504 this.onCurrentCastDisappear_(); |
| 505 return; | 505 return; |
| 506 } | 506 } |
| 507 | 507 |
| 508 if (this.currentCast_) { | 508 if (this.currentCast_) { |
| 509 var currentCastAvailable = casts.some(function(cast) { | 509 var currentCastAvailable = casts.some(function(cast) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 var initPromise = Promise.all( | 577 var initPromise = Promise.all( |
| 578 [new Promise(initVideos.wrap(null)), | 578 [new Promise(initVideos.wrap(null)), |
| 579 new Promise(initStrings.wrap(null)), | 579 new Promise(initStrings.wrap(null)), |
| 580 new Promise(util.addPageLoadHandler.wrap(null))]); | 580 new Promise(util.addPageLoadHandler.wrap(null))]); |
| 581 | 581 |
| 582 initPromise.then(function(results) { | 582 initPromise.then(function(results) { |
| 583 var videos = results[0]; | 583 var videos = results[0]; |
| 584 player.prepare(videos); | 584 player.prepare(videos); |
| 585 return new Promise(player.playFirstVideo.wrap(player)); | 585 return new Promise(player.playFirstVideo.wrap(player)); |
| 586 }.wrap(null)); | 586 }.wrap(null)); |
| OLD | NEW |