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 3d5fc01410f187a30115251c438f044aed636760..6c1820f4ee9cbd9ae441741b481e3f9f4eaf2867 100644 |
--- a/ui/file_manager/audio_player/elements/audio_player.js |
+++ b/ui/file_manager/audio_player/elements/audio_player.js |
@@ -90,10 +90,20 @@ Polymer({ |
type: Number, |
value: 0, |
reflectToAttribute: true |
+ }, |
+ |
+ ariaLabels: { |
+ type: Object |
} |
}, |
/** |
+ * The last playing state when user starts dragging the seek bar. |
+ * @private {boolean} |
+ */ |
+ wasPlayingOnDragStart_: false, |
+ |
+ /** |
* Handles change event for shuffle mode. |
* @param {boolean} shuffle |
*/ |
@@ -135,6 +145,9 @@ Polymer({ |
ready: function() { |
this.addEventListener('keydown', this.onKeyDown_.bind(this)); |
+ this.$.audioController.addEventListener('dragging-changed', |
+ this.onDraggingChanged_.bind(this)); |
+ |
this.$.audio.volume = 0; // Temporary initial volume. |
this.$.audio.addEventListener('ended', this.onAudioEnded.bind(this)); |
this.$.audio.addEventListener('error', this.onAudioError.bind(this)); |
@@ -275,6 +288,13 @@ Polymer({ |
}, |
/** |
+ * Invoked when receivig a request to start playing the current music. |
+ */ |
+ onPlayCurrentTrack: function() { |
+ this.$.audio.play(); |
+ }, |
+ |
+ /** |
* Invoked when receiving a request to replay the current music from the track |
* list element. |
*/ |
@@ -396,6 +416,24 @@ Polymer({ |
}, |
/** |
+ * Invoked when dragging state of seek bar on control panel is changed. |
+ * During the user is dragging it, audio playback is paused temporalily. |
+ */ |
+ onDraggingChanged_: function() { |
+ if (this.$.audioController.dragging) { |
+ if (this.playing) { |
+ this.wasPlayingOnDragStart_ = true; |
+ this.$.audio.pause(); |
+ } |
+ } else { |
+ if (this.wasPlayingOnDragStart_) { |
+ this.$.audio.play(); |
+ this.wasPlayingOnDragStart_ = false; |
+ } |
+ } |
+ }, |
+ |
+ /** |
* Invoked when the 'keydown' event is fired. |
* @param {Event} event The event object. |
*/ |