| Index: ui/file_manager/video_player/js/video_player.js
|
| diff --git a/ui/file_manager/video_player/js/video_player.js b/ui/file_manager/video_player/js/video_player.js
|
| index 398cae08ee601e6ac99683c525dc757a1c0c4889..57e6ca855ca71f108f7e35ef76b8cb2745b679cb 100644
|
| --- a/ui/file_manager/video_player/js/video_player.js
|
| +++ b/ui/file_manager/video_player/js/video_player.js
|
| @@ -305,8 +305,6 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) {
|
| document.querySelector('#thumbnail').style.backgroundImage = '';
|
| });
|
|
|
| - var media = new MediaManager(video.entry);
|
| -
|
| var videoElementInitializePromise;
|
| if (this.currentCast_) {
|
| videoPlayerElement.setAttribute('casting', true);
|
| @@ -316,6 +314,8 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) {
|
| document.querySelector('#cast-name').textContent =
|
| this.currentCast_.friendlyName;
|
|
|
| + videoPlayerElement.setAttribute('castable', true);
|
| +
|
| videoElementInitializePromise =
|
| media.isAvailableForCast().then(function(result) {
|
| if (!result)
|
| @@ -340,6 +340,15 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) {
|
| this.controls.attachMedia(this.videoElement_);
|
| this.videoElement_.src = video.url;
|
|
|
| + media.isAvailableForCast().then(function(result) {
|
| + if (result)
|
| + videoPlayerElement.setAttribute('castable', true);
|
| + else
|
| + videoPlayerElement.removeAttribute('castable');
|
| + }).catch(function() {
|
| + videoPlayerElement.setAttribute('castable', true);
|
| + });
|
| +
|
| videoElementInitializePromise = Promise.resolve();
|
| }
|
|
|
| @@ -493,14 +502,14 @@ VideoPlayer.prototype.onCastSelected_ = function(cast) {
|
| * @param {Array.<Object>} casts List of casts.
|
| */
|
| VideoPlayer.prototype.setCastList = function(casts) {
|
| - var button = document.querySelector('.cast-button');
|
| + var videoPlayerElement = document.querySelector('#video-player');
|
| var menu = document.querySelector('#cast-menu');
|
| menu.innerHTML = '';
|
|
|
| // TODO(yoshiki): Handle the case that the current cast disappears.
|
|
|
| if (casts.length === 0) {
|
| - button.classList.add('hidden');
|
| + videoPlayerElement.removeAttribute('cast-available');
|
| if (this.currentCast_)
|
| this.onCurrentCastDisappear_();
|
| return;
|
| @@ -530,7 +539,7 @@ VideoPlayer.prototype.setCastList = function(casts) {
|
| menu.appendChild(item);
|
| }
|
| this.updateCheckOnCastMenu_();
|
| - button.classList.remove('hidden');
|
| + videoPlayerElement.setAttribute('cast-available', true);
|
| };
|
|
|
| /**
|
|
|