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

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

Issue 1581573004: Audio Player: Notify track metadata update to track-list element explicitly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a check for index range. Created 4 years, 11 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
« no previous file with comments | « no previous file | ui/file_manager/audio_player/js/audio_player.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 this.$.trackList.tracks = tracks; 343 this.$.trackList.tracks = tracks;
344 var currentTrack = this.$.trackList.getCurrentTrack(); 344 var currentTrack = this.$.trackList.getCurrentTrack();
345 if (currentTrack && currentTrack.url != this.$.audio.src) { 345 if (currentTrack && currentTrack.url != this.$.audio.src) {
346 this.$.audio.src = currentTrack.url; 346 this.$.audio.src = currentTrack.url;
347 this.$.audio.play(); 347 this.$.audio.play();
348 } 348 }
349 }, 349 },
350 350
351 /** 351 /**
352 * Notifis the track-list element that the metadata for specified track is
353 * updated.
354 * @param {number} index The index of the track whose metadata is updated.
355 */
356 notifyTrackMetadataUpdated: function(index) {
357 if (index < 0 || index >= this.tracks.length)
358 return;
359
360 this.$.trackList.notifyPath('tracks.' + index + '.title',
361 this.tracks[index].title);
362 this.$.trackList.notifyPath('tracks.' + index + '.artist',
363 this.tracks[index].artist);
364 },
365
366 /**
352 * Invoked when the audio player is being unloaded. 367 * Invoked when the audio player is being unloaded.
353 */ 368 */
354 onPageUnload: function() { 369 onPageUnload: function() {
355 this.$.audio.src = ''; // Hack to prevent crashing. 370 this.$.audio.src = ''; // Hack to prevent crashing.
356 }, 371 },
357 372
358 /** 373 /**
359 * Invoked when dragging state of seek bar on control panel is changed. 374 * Invoked when dragging state of seek bar on control panel is changed.
360 * During the user is dragging it, audio playback is paused temporalily. 375 * During the user is dragging it, audio playback is paused temporalily.
361 */ 376 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 411
397 /** 412 /**
398 * Computes volume value for audio element. (should be in [0.0, 1.0]) 413 * Computes volume value for audio element. (should be in [0.0, 1.0])
399 * @param {number} volume Volume which is set in the UI. ([0, 100]) 414 * @param {number} volume Volume which is set in the UI. ([0, 100])
400 * @return {number} 415 * @return {number}
401 */ 416 */
402 computeAudioVolume_: function(volume) { 417 computeAudioVolume_: function(volume) {
403 return volume / 100; 418 return volume / 100;
404 } 419 }
405 }); 420 });
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/audio_player/js/audio_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698