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

Side by Side Diff: ui/file_manager/audio_player/elements/audio_player.js

Issue 1657623002: Implement "expand/collapse artwork" button in audio player. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sorting css prop. Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 Polymer({ 5 Polymer({
6 is: 'audio-player', 6 is: 'audio-player',
7 7
8 properties: { 8 properties: {
9 /** 9 /**
10 * Flag whether the audio is playing or paused. True if playing, or false 10 * Flag whether the audio is playing or paused. True if playing, or false
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 * @param {number} newValue new value. 130 * @param {number} newValue new value.
131 * @param {number} oldValue old value. 131 * @param {number} oldValue old value.
132 */ 132 */
133 currentTrackIndexChanged: function(newValue, oldValue) { 133 currentTrackIndexChanged: function(newValue, oldValue) {
134 var currentTrackUrl = ''; 134 var currentTrackUrl = '';
135 135
136 if (oldValue != newValue) { 136 if (oldValue != newValue) {
137 var currentTrack = this.$.trackList.getCurrentTrack(); 137 var currentTrack = this.$.trackList.getCurrentTrack();
138 if(currentTrack && currentTrack != this.$.trackInfo.track){ 138 if(currentTrack && currentTrack != this.$.trackInfo.track){
139 this.$.trackInfo.track = currentTrack; 139 this.$.trackInfo.track = currentTrack;
140 this.$.trackInfo.artworkAvailable = !!currentTrack.artworkUrl;
140 } 141 }
141 if (currentTrack && currentTrack.url != this.$.audio.src) { 142 if (currentTrack && currentTrack.url != this.$.audio.src) {
142 this.$.audio.src = currentTrack.url; 143 this.$.audio.src = currentTrack.url;
143 currentTrackUrl = this.$.audio.src; 144 currentTrackUrl = this.$.audio.src;
144 if (this.playing) 145 if (this.playing)
145 this.$.audio.play(); 146 this.$.audio.play();
146 } 147 }
147 } 148 }
148 149
149 // The attributes may be being watched, so we change it at the last. 150 // The attributes may be being watched, so we change it at the last.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 this.$.trackList.notifyPath('tracks.' + index + '.title', 371 this.$.trackList.notifyPath('tracks.' + index + '.title',
371 this.tracks[index].title); 372 this.tracks[index].title);
372 this.$.trackList.notifyPath('tracks.' + index + '.artist', 373 this.$.trackList.notifyPath('tracks.' + index + '.artist',
373 this.tracks[index].artist); 374 this.tracks[index].artist);
374 375
375 if (this.$.trackInfo.track && 376 if (this.$.trackInfo.track &&
376 this.$.trackInfo.track.url === this.tracks[index].url){ 377 this.$.trackInfo.track.url === this.tracks[index].url){
377 this.$.trackInfo.notifyPath('track.title', this.tracks[index].title); 378 this.$.trackInfo.notifyPath('track.title', this.tracks[index].title);
378 this.$.trackInfo.notifyPath('track.artist', this.tracks[index].artist); 379 this.$.trackInfo.notifyPath('track.artist', this.tracks[index].artist);
379 var artworkUrl = this.tracks[index].artworkUrl; 380 var artworkUrl = this.tracks[index].artworkUrl;
380 if (!artworkUrl || artworkUrl !== '') 381 if (!artworkUrl && artworkUrl !== '') {
381 this.$.trackInfo.notifyPath('track.artworkUrl', 382 this.$.trackInfo.notifyPath('track.artworkUrl',
382 this.tracks[index].artworkUrl); 383 this.tracks[index].artworkUrl);
383 else 384 this.$.trackInfo.artworkAvailable = true;
385 } else {
384 this.$.trackInfo.notifyPath('track.artworkUrl', undefined); 386 this.$.trackInfo.notifyPath('track.artworkUrl', undefined);
387 this.$.trackInfo.artworkAvailable = false;
388 }
385 } 389 }
386 }, 390 },
387 391
388 /** 392 /**
389 * Invoked when the audio player is being unloaded. 393 * Invoked when the audio player is being unloaded.
390 */ 394 */
391 onPageUnload: function() { 395 onPageUnload: function() {
392 this.$.audio.src = ''; // Hack to prevent crashing. 396 this.$.audio.src = ''; // Hack to prevent crashing.
393 }, 397 },
394 398
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 437
434 /** 438 /**
435 * Computes volume value for audio element. (should be in [0.0, 1.0]) 439 * Computes volume value for audio element. (should be in [0.0, 1.0])
436 * @param {number} volume Volume which is set in the UI. ([0, 100]) 440 * @param {number} volume Volume which is set in the UI. ([0, 100])
437 * @return {number} 441 * @return {number}
438 */ 442 */
439 computeAudioVolume_: function(volume) { 443 computeAudioVolume_: function(volume) {
440 return volume / 100; 444 return volume / 100;
441 } 445 }
442 }); 446 });
OLDNEW
« no previous file with comments | « ui/file_manager/audio_player/css/audio_player.css ('k') | ui/file_manager/audio_player/elements/track_info_panel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698