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

Side by Side Diff: chrome/browser/resources/file_manager/audio_player/js/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @param {HTMLElement} container Container element. 8 * @param {HTMLElement} container Container element.
9 * @constructor 9 * @constructor
10 */ 10 */
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (this.player_) 180 if (this.player_)
181 this.player_.onPageUnload(); 181 this.player_.onPageUnload();
182 182
183 if (this.volumeManager_) 183 if (this.volumeManager_)
184 this.volumeManager_.dispose(); 184 this.volumeManager_.dispose();
185 }; 185 };
186 186
187 /** 187 /**
188 * Selects a new track to play. 188 * Selects a new track to play.
189 * @param {number} newTrack New track number. 189 * @param {number} newTrack New track number.
190 * @param {boolean=} opt_restoreState True if restoring the play state from URL.
191 * @private 190 * @private
192 */ 191 */
193 AudioPlayer.prototype.select_ = function(newTrack, opt_restoreState) { 192 AudioPlayer.prototype.select_ = function(newTrack) {
194 if (this.currentTrackIndex_ == newTrack) return; 193 if (this.currentTrackIndex_ == newTrack) return;
195 194
196 this.currentTrackIndex_ = newTrack; 195 this.currentTrackIndex_ = newTrack;
197 this.player_.currentTrackIndex = this.currentTrackIndex_; 196 this.player_.currentTrackIndex = this.currentTrackIndex_;
197 Platform.performMicrotaskCheckpoint();
198
199 if (!window.appReopen)
200 this.player_.audioElement.play();
198 201
199 window.appState.position = this.currentTrackIndex_; 202 window.appState.position = this.currentTrackIndex_;
200 window.appState.time = 0; 203 window.appState.time = 0;
201 util.saveAppState(); 204 util.saveAppState();
202 205
203 var entry = this.entries_[this.currentTrackIndex_]; 206 var entry = this.entries_[this.currentTrackIndex_];
204 207
205 this.fetchMetadata_(entry, function(metadata) { 208 this.fetchMetadata_(entry, function(metadata) {
206 if (this.currentTrackIndex_ != newTrack) 209 if (this.currentTrackIndex_ != newTrack)
207 return; 210 return;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 this.title = (metadata.media && metadata.media.title) || 408 this.title = (metadata.media && metadata.media.title) ||
406 this.getDefaultTitle(); 409 this.getDefaultTitle();
407 this.artist = error || 410 this.artist = error ||
408 (metadata.media && metadata.media.artist) || this.getDefaultArtist(); 411 (metadata.media && metadata.media.artist) || this.getDefaultArtist();
409 }; 412 };
410 413
411 // Starts loading the audio player. 414 // Starts loading the audio player.
412 window.addEventListener('WebComponentsReady', function(e) { 415 window.addEventListener('WebComponentsReady', function(e) {
413 AudioPlayer.load(); 416 AudioPlayer.load();
414 }); 417 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698