Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: ui/file_manager/video_player/js/video_player.js

Issue 381073003: Video Player: Add a cast menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 0f520015817b4fadc634158a980a38c3252478ea..20c101c75827a920589e2756d21156bde281c62f 100644
--- a/ui/file_manager/video_player/js/video_player.js
+++ b/ui/file_manager/video_player/js/video_player.js
@@ -165,6 +165,18 @@ VideoPlayer.prototype.prepare = function(videos) {
}.wrap(null));
closeButton.addEventListener('mousedown', preventDefault);
+ var castButton = document.querySelector('.cast-button');
+ cr.ui.decorate(castButton, cr.ui.MenuButton);
+ castButton.addEventListener(
+ 'click',
+ function(event) {
+ event.stopPropagation();
+ }.wrap(null));
+ castButton.addEventListener('mousedown', preventDefault);
+
+ var menu = document.querySelector('#cast-menu');
+ cr.ui.decorate(menu, cr.ui.Menu);
+
this.controls_ = new FullWindowVideoControls(
document.querySelector('#video-player'),
document.querySelector('#video-container'),
@@ -346,6 +358,28 @@ VideoPlayer.prototype.reloadCurrentVideo_ = function(opt_callback) {
};
/**
+ * Set the list of casts.
+ * @param {Array.<Object>} casts List of casts.
+ */
+VideoPlayer.prototype.setCastList = function(casts) {
+ var button = document.querySelector('.cast-button');
+ var menu = document.querySelector('#cast-menu');
+ menu.innerHTML = '';
+
+ if (casts.length === 0) {
+ button.classList.add('hidden');
+ return;
+ }
+
+ for (var i = 0; i < casts.length; i++) {
+ var item = new cr.ui.MenuItem();
+ item.textContent = casts[i].name;
+ menu.appendChild(item);
+ }
+ button.classList.remove('hidden');
+};
+
+/**
* Initialize the list of videos.
* @param {function(Array.<Object>)} callback Called with the video list when
* it is ready.

Powered by Google App Engine
This is Rietveld 408576698