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

Unified Diff: ui/file_manager/audio_player/elements/audio_player.js

Issue 1681843002: restarts a song when the next track button is clicked and there is only one song in audio player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update condition 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/audio_player/elements/audio_player.js
diff --git a/ui/file_manager/audio_player/elements/audio_player.js b/ui/file_manager/audio_player/elements/audio_player.js
index 8a20662957ea56fb193ac4a5a9b62dc734b40231..fa1213a61623277f85d2bb743e974bda3177f2e9 100644
--- a/ui/file_manager/audio_player/elements/audio_player.js
+++ b/ui/file_manager/audio_player/elements/audio_player.js
@@ -271,15 +271,16 @@ Polymer({
this.playing = isNextTrackAvailable;
- // If there is only a single file in the list, 'currentTrackInde' is not
- // changed and the handler is not invoked. Instead, plays here.
- // TODO(yoshiki): clean up the code around here.
- if (isNextTrackAvailable &&
- this.$.trackList.currentTrackIndex == nextTrackIndex) {
- this.$.audio.play();
- }
-
+ var shouldFireEvent = this.$.trackList.currentTrackIndex === nextTrackIndex;
this.$.trackList.currentTrackIndex = nextTrackIndex;
+ this.$.audio.currentTime = 0;
+ // If the next track and current track is the same,
+ // the event will not be fired.
+ // So we will fire the event here.
+ // This happenes if there is only one song.
+ if (shouldFireEvent) {
+ this.$.trackList.fire('current-track-index-changed');
+ }
},
/**
« 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