| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Interval for updating media info (in ms). | 8 * Interval for updating media info (in ms). |
| 9 * @type {number} | 9 * @type {number} |
| 10 * @const | 10 * @const |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // Resets the error code. | 254 // Resets the error code. |
| 255 this.errorCode_ = 0; | 255 this.errorCode_ = 0; |
| 256 | 256 |
| 257 Promise.all([ | 257 Promise.all([ |
| 258 sendTokenPromise, | 258 sendTokenPromise, |
| 259 this.mediaManager_.getUrl(), | 259 this.mediaManager_.getUrl(), |
| 260 this.mediaManager_.getMime(), | 260 this.mediaManager_.getMime(), |
| 261 this.mediaManager_.getThumbnail()]). | 261 this.mediaManager_.getThumbnail()]). |
| 262 then(function(results) { | 262 then(function(results) { |
| 263 var url = results[1]; | 263 var url = results[1]; |
| 264 var mime = results[2]; | 264 var mime = results[2]; // maybe empty |
| 265 var thumbnailUrl = results[3]; | 265 var thumbnailUrl = results[3]; // maybe empty |
| 266 | 266 |
| 267 this.mediaInfo_ = new chrome.cast.media.MediaInfo(url); | 267 this.mediaInfo_ = new chrome.cast.media.MediaInfo(url); |
| 268 this.mediaInfo_.contentType = mime; | 268 this.mediaInfo_.contentType = mime; |
| 269 this.mediaInfo_.customData = { | 269 this.mediaInfo_.customData = { |
| 270 tokenRequired: true, | 270 tokenRequired: true, |
| 271 thumbnailUrl: thumbnailUrl, | 271 thumbnailUrl: thumbnailUrl, |
| 272 }; | 272 }; |
| 273 | 273 |
| 274 var request = new chrome.cast.media.LoadRequest(this.mediaInfo_); | 274 var request = new chrome.cast.media.LoadRequest(this.mediaInfo_); |
| 275 return new Promise( | 275 return new Promise( |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 this.dispatchEvent(new Event('durationchange')); | 435 this.dispatchEvent(new Event('durationchange')); |
| 436 } | 436 } |
| 437 | 437 |
| 438 // Media is being unloaded. | 438 // Media is being unloaded. |
| 439 if (!alive) { | 439 if (!alive) { |
| 440 this.unloadMedia_(); | 440 this.unloadMedia_(); |
| 441 return; | 441 return; |
| 442 } | 442 } |
| 443 }, | 443 }, |
| 444 }; | 444 }; |
| OLD | NEW |