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

Unified Diff: chrome/browser/resources/file_manager/audio_player/elements/audio_player.js

Issue 182733009: [AudioPlayer] Don't start a playback automatically when reopening (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/audio_player/js/audio_player.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/audio_player/elements/audio_player.js
diff --git a/chrome/browser/resources/file_manager/audio_player/elements/audio_player.js b/chrome/browser/resources/file_manager/audio_player/elements/audio_player.js
index c6b76b3fbc8fb1398ebd6cae56f5316004e4cf13..0694030f7abb54c6ccc6766acc1eaa12e298a68d 100644
--- a/chrome/browser/resources/file_manager/audio_player/elements/audio_player.js
+++ b/chrome/browser/resources/file_manager/audio_player/elements/audio_player.js
@@ -12,7 +12,9 @@ Polymer('audio-player', {
audioElement: null,
trackList: null,
- // Attributes of the element (little charactor only)
+ // Attributes of the element (little charactor only).
+ // These value must be used only to data binding and shouldn't be assignred
+ // anu value nowhere except in the handler.
playing: false,
currenttrackurl: '',
@@ -70,7 +72,8 @@ Polymer('audio-player', {
if (currentTrack && currentTrack.url != this.audioElement.src) {
this.audioElement.src = currentTrack.url;
currentTrackUrl = this.audioElement.src;
- this.audioElement.play();
+ if (this.audioController.playing)
+ this.audioElement.play();
}
}
@@ -103,7 +106,6 @@ Polymer('audio-player', {
// When the new status is "stopped".
this.cancelAutoAdvance_();
- this.audioController.playing = false;
this.audioElement.pause();
this.currenttrackurl = '';
this.lastAudioUpdateTime_ = null;
@@ -202,15 +204,10 @@ Polymer('audio-player', {
var isNextTrackAvailable =
(this.trackList.getNextTrackIndex(forward, repeat) !== -1);
+ this.audioController.playing = isNextTrackAvailable;
this.trackList.currentTrackIndex = nextTrackIndex;
- if (isNextTrackAvailable) {
- var nextTrack = this.trackList.tracks[nextTrackIndex];
- this.audioElement.src = nextTrack.url;
- this.audioElement.play();
- } else {
- this.audioElement.pause();
- }
+ Platform.performMicrotaskCheckpoint();
},
/**
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/audio_player/js/audio_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698