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

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

Issue 1403303011: AudioPlayer: Update control panel with playback progress bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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.
*/

Powered by Google App Engine
This is Rietveld 408576698