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

Side by Side Diff: ui/file_manager/audio_player/elements/audio_player.js

Issue 1431523003: AudioPlayer: Start playing a track when play icon on the track list is clicked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'audio-player', 6 is: 'audio-player',
7 7
8 properties: { 8 properties: {
9 /** 9 /**
10 * Flag whether the audio is playing or paused. True if playing, or false 10 * Flag whether the audio is playing or paused. True if playing, or false
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 * This handler is registered in this.ready(). 268 * This handler is registered in this.ready().
269 * @private 269 * @private
270 */ 270 */
271 onAudioStatusUpdate_: function() { 271 onAudioStatusUpdate_: function() {
272 this.time = (this.lastAudioUpdateTime_ = this.$.audio.currentTime * 1000); 272 this.time = (this.lastAudioUpdateTime_ = this.$.audio.currentTime * 1000);
273 this.duration = this.$.audio.duration * 1000; 273 this.duration = this.$.audio.duration * 1000;
274 this.playing = !this.$.audio.paused; 274 this.playing = !this.$.audio.paused;
275 }, 275 },
276 276
277 /** 277 /**
278 * Invoked when receivig a request to start playing the current music.
279 */
280 onPlayCurrentTrack: function() {
281 this.$.audio.play();
282 },
283
284 /**
278 * Invoked when receiving a request to replay the current music from the track 285 * Invoked when receiving a request to replay the current music from the track
279 * list element. 286 * list element.
280 */ 287 */
281 onReplayCurrentTrack: function() { 288 onReplayCurrentTrack: function() {
282 // Changes the current time back to the beginning, regardless of the current 289 // Changes the current time back to the beginning, regardless of the current
283 // status (playing or paused). 290 // status (playing or paused).
284 this.$.audio.currentTime = 0; 291 this.$.audio.currentTime = 0;
285 this.time = 0; 292 this.time = 0;
286 }, 293 },
287 294
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 441
435 /** 442 /**
436 * Computes volume value for audio element. (should be in [0.0, 1.0]) 443 * Computes volume value for audio element. (should be in [0.0, 1.0])
437 * @param {number} volume Volume which is set in the UI. ([0, 100]) 444 * @param {number} volume Volume which is set in the UI. ([0, 100])
438 * @return {number} 445 * @return {number}
439 */ 446 */
440 computeAudioVolume_: function(volume) { 447 computeAudioVolume_: function(volume) {
441 return volume / 100; 448 return volume / 100;
442 } 449 }
443 }); 450 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698