OLD | NEW |
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 /** | 5 /** |
6 * @param {HTMLElement} container Container element. | 6 * @param {HTMLElement} container Container element. |
7 * @constructor | 7 * @constructor |
8 */ | 8 */ |
9 function AudioPlayer(container) { | 9 function AudioPlayer(container) { |
10 this.container_ = container; | 10 this.container_ = container; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Load the selected track metadata first, then load the rest. | 191 // Load the selected track metadata first, then load the rest. |
192 this.loadMetadata_(playlist.position); | 192 this.loadMetadata_(playlist.position); |
193 for (i = 0; i != this.urls_.length; i++) { | 193 for (i = 0; i != this.urls_.length; i++) { |
194 if (i != playlist.position) | 194 if (i != playlist.position) |
195 this.loadMetadata_(i); | 195 this.loadMetadata_(i); |
196 } | 196 } |
197 }; | 197 }; |
198 | 198 |
199 /** | 199 /** |
200 * Load metadata for a track. | 200 * Load metadata for a track. |
201 * @param {number} track Track number | 201 * @param {number} track Track number. |
202 * @private | 202 * @private |
203 */ | 203 */ |
204 AudioPlayer.prototype.loadMetadata_ = function(track) { | 204 AudioPlayer.prototype.loadMetadata_ = function(track) { |
205 this.fetchMetadata_( | 205 this.fetchMetadata_( |
206 this.urls_[track], this.displayMetadata_.bind(this, track)); | 206 this.urls_[track], this.displayMetadata_.bind(this, track)); |
207 }; | 207 }; |
208 | 208 |
209 /** | 209 /** |
210 * Display track's metadata. | 210 * Display track's metadata. |
211 * @param {number} track Track number. | 211 * @param {number} track Track number. |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 * Restore the state after page/app reload. | 607 * Restore the state after page/app reload. |
608 */ | 608 */ |
609 FullWindowAudioControls.prototype.restorePlayState = function() { | 609 FullWindowAudioControls.prototype.restorePlayState = function() { |
610 if (this.restoreWhenLoaded_) { | 610 if (this.restoreWhenLoaded_) { |
611 this.restoreWhenLoaded_ = false; // This should only work once. | 611 this.restoreWhenLoaded_ = false; // This should only work once. |
612 if (this.decodeState()) | 612 if (this.decodeState()) |
613 return; | 613 return; |
614 } | 614 } |
615 this.play(); | 615 this.play(); |
616 }; | 616 }; |
OLD | NEW |