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..31a48010cc1b9f4225f624ecc0a911aeb58f6b45 100644 |
--- a/ui/file_manager/audio_player/elements/audio_player.js |
+++ b/ui/file_manager/audio_player/elements/audio_player.js |
@@ -94,6 +94,12 @@ Polymer({ |
}, |
/** |
+ * 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 +141,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)); |
@@ -396,6 +405,24 @@ Polymer({ |
}, |
/** |
+ * Invoked then dragging state of seek bar on control panel is changed. |
yawano
2015/10/30 01:59:53
typo: then -> when
fukino
2015/10/30 04:25:53
Done.
|
+ * 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. |
*/ |