| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Interval for updating media info (in ms). | 6 * Interval for updating media info (in ms). |
| 7 * @type {number} | 7 * @type {number} |
| 8 * @const | 8 * @const |
| 9 */ | 9 */ |
| 10 var MEDIA_UPDATE_INTERVAL = 250; | 10 var MEDIA_UPDATE_INTERVAL = 250; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 this.dispatchEvent(new Event('pause')); | 479 this.dispatchEvent(new Event('pause')); |
| 480 | 480 |
| 481 this.currentMediaPlayerState_ = newState; | 481 this.currentMediaPlayerState_ = newState; |
| 482 } | 482 } |
| 483 if (this.currentMediaCurrentTime_ !== media.getEstimatedTime()) { | 483 if (this.currentMediaCurrentTime_ !== media.getEstimatedTime()) { |
| 484 this.currentMediaCurrentTime_ = media.getEstimatedTime(); | 484 this.currentMediaCurrentTime_ = media.getEstimatedTime(); |
| 485 this.dispatchEvent(new Event('timeupdate')); | 485 this.dispatchEvent(new Event('timeupdate')); |
| 486 } | 486 } |
| 487 | 487 |
| 488 if (this.currentMediaDuration_ !== media.media.duration) { | 488 if (this.currentMediaDuration_ !== media.media.duration) { |
| 489 metrics.recordCastedVideoLength(this.currentMediaDuration_); |
| 490 |
| 489 this.currentMediaDuration_ = media.media.duration; | 491 this.currentMediaDuration_ = media.media.duration; |
| 490 this.dispatchEvent(new Event('durationchange')); | 492 this.dispatchEvent(new Event('durationchange')); |
| 491 } | 493 } |
| 492 | 494 |
| 493 // Media is being unloaded. | 495 // Media is being unloaded. |
| 494 if (!alive) { | 496 if (!alive) { |
| 495 this.unloadMedia_(); | 497 this.unloadMedia_(); |
| 496 return; | 498 return; |
| 497 } | 499 } |
| 498 }, | 500 }, |
| 499 }; | 501 }; |
| OLD | NEW |