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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 } | 587 } |
588 } | 588 } |
589 }; | 589 }; |
590 | 590 |
591 /** | 591 /** |
592 * Called when the current cast is disappear from the cast list. | 592 * Called when the current cast is disappear from the cast list. |
593 * @private | 593 * @private |
594 */ | 594 */ |
595 VideoPlayer.prototype.onCurrentCastDisappear_ = function() { | 595 VideoPlayer.prototype.onCurrentCastDisappear_ = function() { |
596 this.currentCast_ = null; | 596 this.currentCast_ = null; |
597 this.currentSession_.removeUpdateListener(this.onCastSessionUpdateBound_); | 597 if (this.currentSession_) { |
598 this.currentSession_ = null; | 598 this.currentSession_.removeUpdateListener(this.onCastSessionUpdateBound_); |
| 599 this.currentSession_ = null; |
| 600 } |
599 this.controls.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); | 601 this.controls.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); |
600 this.unloadVideo(); | 602 this.unloadVideo(); |
601 }; | 603 }; |
602 | 604 |
603 /** | 605 /** |
604 * This method should be called when the session is updated. | 606 * This method should be called when the session is updated. |
605 * @param {boolean} alive Whether the session is alive or not. | 607 * @param {boolean} alive Whether the session is alive or not. |
606 * @private | 608 * @private |
607 */ | 609 */ |
608 VideoPlayer.prototype.onCastSessionUpdate_ = function(alive) { | 610 VideoPlayer.prototype.onCastSessionUpdate_ = function(alive) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 var initPromise = Promise.all( | 649 var initPromise = Promise.all( |
648 [new Promise(initVideos.wrap(null)), | 650 [new Promise(initVideos.wrap(null)), |
649 new Promise(initStrings.wrap(null)), | 651 new Promise(initStrings.wrap(null)), |
650 new Promise(util.addPageLoadHandler.wrap(null))]); | 652 new Promise(util.addPageLoadHandler.wrap(null))]); |
651 | 653 |
652 initPromise.then(function(results) { | 654 initPromise.then(function(results) { |
653 var videos = results[0]; | 655 var videos = results[0]; |
654 player.prepare(videos); | 656 player.prepare(videos); |
655 return new Promise(player.playFirstVideo.wrap(player)); | 657 return new Promise(player.playFirstVideo.wrap(player)); |
656 }.wrap(null)); | 658 }.wrap(null)); |
OLD | NEW |