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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @fileoverview MediaControls class implements media playback controls | 8 * @fileoverview MediaControls class implements media playback controls |
9 * that exist outside of the audio/video HTML element. | 9 * that exist outside of the audio/video HTML element. |
10 */ | 10 */ |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 /** | 254 /** |
255 * @param {boolean} on True if dragging. | 255 * @param {boolean} on True if dragging. |
256 * @private | 256 * @private |
257 */ | 257 */ |
258 MediaControls.prototype.onProgressDrag_ = function(on) { | 258 MediaControls.prototype.onProgressDrag_ = function(on) { |
259 if (!this.media_) | 259 if (!this.media_) |
260 return; // Media is detached. | 260 return; // Media is detached. |
261 | 261 |
262 if (on) { | 262 if (on) { |
263 this.resumeAfterDrag_ = this.isPlaying(); | 263 this.resumeAfterDrag_ = this.isPlaying(); |
264 this.media_.pause(); | 264 this.media_.pause(true /* seeking */); |
265 } else { | 265 } else { |
266 if (this.resumeAfterDrag_) { | 266 if (this.resumeAfterDrag_) { |
267 if (this.media_.ended) | 267 if (this.media_.ended) |
268 this.onMediaPlay_(false); | 268 this.onMediaPlay_(false); |
269 else | 269 else |
270 this.media_.play(); | 270 this.media_.play(true /* seeking */); |
271 } | 271 } |
272 this.updatePlayButtonState_(this.isPlaying()); | 272 this.updatePlayButtonState_(this.isPlaying()); |
273 } | 273 } |
274 }; | 274 }; |
275 | 275 |
276 /* | 276 /* |
277 * Volume controls | 277 * Volume controls |
278 */ | 278 */ |
279 | 279 |
280 /** | 280 /** |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 AudioControls.prototype.onAdvanceClick_ = function(forward) { | 1227 AudioControls.prototype.onAdvanceClick_ = function(forward) { |
1228 if (!forward && | 1228 if (!forward && |
1229 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { | 1229 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { |
1230 // We are far enough from the beginning of the current track. | 1230 // We are far enough from the beginning of the current track. |
1231 // Restart it instead of than skipping to the previous one. | 1231 // Restart it instead of than skipping to the previous one. |
1232 this.getMedia().currentTime = 0; | 1232 this.getMedia().currentTime = 0; |
1233 } else { | 1233 } else { |
1234 this.advanceTrack_(forward); | 1234 this.advanceTrack_(forward); |
1235 } | 1235 } |
1236 }; | 1236 }; |
OLD | NEW |