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'); |
+ } |
}, |
/** |