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

Side by Side Diff: chrome/browser/resources/file_manager/audio_player/elements/audio_player.js

Issue 221623004: [AudioPleyer] Fix repeat even when there is a single file in the list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 'use strict'; 5 'use strict';
6 6
7 Polymer('audio-player', { 7 Polymer('audio-player', {
8 /** 8 /**
9 * Child Elements 9 * Child Elements
10 */ 10 */
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 * @private 198 * @private
199 */ 199 */
200 advance_: function(forward, repeat) { 200 advance_: function(forward, repeat) {
201 this.cancelAutoAdvance_(); 201 this.cancelAutoAdvance_();
202 202
203 var nextTrackIndex = this.trackList.getNextTrackIndex(forward, true); 203 var nextTrackIndex = this.trackList.getNextTrackIndex(forward, true);
204 var isNextTrackAvailable = 204 var isNextTrackAvailable =
205 (this.trackList.getNextTrackIndex(forward, repeat) !== -1); 205 (this.trackList.getNextTrackIndex(forward, repeat) !== -1);
206 206
207 this.audioController.playing = isNextTrackAvailable; 207 this.audioController.playing = isNextTrackAvailable;
208
209 // If there is only a single file in the list, 'currentTrackInde' is not
210 // changed and the handler is not invoked. Instead, plays here.
211 // TODO(yoshiki): clean up the code around here.
212 if (isNextTrackAvailable &&
213 this.trackList.currentTrackIndex == nextTrackIndex) {
214 this.audioElement.play();
215 }
216
208 this.trackList.currentTrackIndex = nextTrackIndex; 217 this.trackList.currentTrackIndex = nextTrackIndex;
209 218
210 Platform.performMicrotaskCheckpoint(); 219 Platform.performMicrotaskCheckpoint();
211 }, 220 },
212 221
213 /** 222 /**
214 * Timeout ID of auto advance. Used internally in scheduleAutoAdvance_() and 223 * Timeout ID of auto advance. Used internally in scheduleAutoAdvance_() and
215 * cancelAutoAdvance_(). 224 * cancelAutoAdvance_().
216 * @type {number} 225 * @type {number}
217 * @private 226 * @private
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 295 }
287 }, 296 },
288 297
289 /** 298 /**
290 * Invoked when the audio player is being unloaded. 299 * Invoked when the audio player is being unloaded.
291 */ 300 */
292 onPageUnload: function() { 301 onPageUnload: function() {
293 this.audioElement.src = ''; // Hack to prevent crashing. 302 this.audioElement.src = ''; // Hack to prevent crashing.
294 }, 303 },
295 }); 304 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698