Chromium Code Reviews| 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..42d5b0ca3baceaaf643814df69752870f9ea16a8 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); |
|
hirono
2014/08/14 09:37:18
Is it OK to remove this line?
yoshiki
2014/08/14 10:17:43
This is a dup with L295.
|
| - |
| 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,13 @@ VideoPlayer.prototype.loadVideo_ = function(video, opt_callback) { |
| this.controls.attachMedia(this.videoElement_); |
| this.videoElement_.src = video.url; |
| + media.isAvailableForCast().then(function(result) { |
|
hirono
2014/08/14 09:37:18
Can we assign the return value to videoElementInit
yoshiki
2014/08/14 10:17:43
I don't think this block the initialization. It ju
hirono
2014/08/14 10:35:47
SGTM. So please add an error handler after then.
yoshiki
2014/08/14 10:52:13
Done.
|
| + if (result) |
| + videoPlayerElement.setAttribute('castable', true); |
| + else |
| + videoPlayerElement.removeAttribute('castable'); |
| + }.bind(this)); |
| + |
| videoElementInitializePromise = Promise.resolve(); |
| } |
| @@ -493,14 +500,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 +537,7 @@ VideoPlayer.prototype.setCastList = function(casts) { |
| menu.appendChild(item); |
| } |
| this.updateCheckOnCastMenu_(); |
| - button.classList.remove('hidden'); |
| + videoPlayerElement.setAttribute('cast-available', true); |
| }; |
| /** |