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

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

Issue 556493002: Video Player: Resume the playback position on launch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a JSdoc Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (this.player_) 191 if (this.player_)
192 this.player_.onPageUnload(); 192 this.player_.onPageUnload();
193 193
194 if (this.volumeManager_) 194 if (this.volumeManager_)
195 this.volumeManager_.dispose(); 195 this.volumeManager_.dispose();
196 }; 196 };
197 197
198 /** 198 /**
199 * Selects a new track to play. 199 * Selects a new track to play.
200 * @param {number} newTrack New track number. 200 * @param {number} newTrack New track number.
201 * @param {number} time New playback position (in second).
201 * @private 202 * @private
202 */ 203 */
203 AudioPlayer.prototype.select_ = function(newTrack) { 204 AudioPlayer.prototype.select_ = function(newTrack, time) {
204 if (this.currentTrackIndex_ == newTrack) return; 205 if (this.currentTrackIndex_ == newTrack) return;
205 206
206 this.currentTrackIndex_ = newTrack; 207 this.currentTrackIndex_ = newTrack;
207 this.player_.currentTrackIndex = this.currentTrackIndex_; 208 this.player_.currentTrackIndex = this.currentTrackIndex_;
209 this.player_.audioController.time = time;
208 Platform.performMicrotaskCheckpoint(); 210 Platform.performMicrotaskCheckpoint();
209 211
210 if (!window.appReopen) 212 if (!window.appReopen)
211 this.player_.audioElement.play(); 213 this.player_.audioElement.play();
212 214
213 window.appState.position = this.currentTrackIndex_; 215 window.appState.position = this.currentTrackIndex_;
214 window.appState.time = 0; 216 window.appState.time = 0;
215 util.saveAppState(); 217 util.saveAppState();
216 218
217 var entry = this.entries_[this.currentTrackIndex_]; 219 var entry = this.entries_[this.currentTrackIndex_];
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 this.title = (metadata.media && metadata.media.title) || 420 this.title = (metadata.media && metadata.media.title) ||
419 this.getDefaultTitle(); 421 this.getDefaultTitle();
420 this.artist = error || 422 this.artist = error ||
421 (metadata.media && metadata.media.artist) || this.getDefaultArtist(); 423 (metadata.media && metadata.media.artist) || this.getDefaultArtist();
422 }; 424 };
423 425
424 // Starts loading the audio player. 426 // Starts loading the audio player.
425 window.addEventListener('polymer-ready', function(e) { 427 window.addEventListener('polymer-ready', function(e) {
426 AudioPlayer.load(); 428 AudioPlayer.load();
427 }); 429 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698