Chromium Code Reviews| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 /** | 342 /** |
| 343 * Unloads the video. | 343 * Unloads the video. |
| 344 * @private | 344 * @private |
| 345 */ | 345 */ |
| 346 unloadMedia_: function() { | 346 unloadMedia_: function() { |
| 347 if (this.castMedia_) { | 347 if (this.castMedia_) { |
| 348 this.castMedia_.stop(null, | 348 this.castMedia_.stop(null, |
| 349 function() {}, | 349 function() {}, |
| 350 function(error) { | 350 function(error) { |
| 351 // Ignores session error, since session may already be closed. | 351 // Ignores session error, since session may already be closed. |
| 352 if (error.code !== chrome.cast.ErrorCode.SESSION_ERROR) | 352 if (error.code !== chrome.cast.ErrorCode.SESSION_ERROR && |
| 353 error.code !== chrome.cast.ErrorCode.INVALID_PARAMETER) { | |
|
fukino
2016/05/18 05:02:21
bug fix: error code can be INVALID_PARAMETER as we
| |
| 353 this.onCastCommandError_(error); | 354 this.onCastCommandError_(error); |
| 355 } | |
| 354 }.wrap(this)); | 356 }.wrap(this)); |
| 355 | 357 |
| 356 this.castMedia_.removeUpdateListener(this.onCastMediaUpdatedBound_); | 358 this.castMedia_.removeUpdateListener(this.onCastMediaUpdatedBound_); |
| 357 this.castMedia_ = null; | 359 this.castMedia_ = null; |
| 358 } | 360 } |
| 359 | 361 |
| 360 clearInterval(this.updateTimerId_); | 362 clearInterval(this.updateTimerId_); |
| 361 }, | 363 }, |
| 362 | 364 |
| 363 /** | 365 /** |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 this.dispatchEvent(new Event('durationchange')); | 514 this.dispatchEvent(new Event('durationchange')); |
| 513 } | 515 } |
| 514 | 516 |
| 515 // Media is being unloaded. | 517 // Media is being unloaded. |
| 516 if (!alive) { | 518 if (!alive) { |
| 517 this.unloadMedia_(); | 519 this.unloadMedia_(); |
| 518 return; | 520 return; |
| 519 } | 521 } |
| 520 }, | 522 }, |
| 521 }; | 523 }; |
| OLD | NEW |