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 Polymer('audio-player', { | 5 /** |
6 /** | 6 * @constructor |
7 * Child Elements | 7 * @extends {PolymerElement} |
8 */ | 8 */ |
| 9 var AudioPlayerElement = function() {}; |
| 10 |
| 11 AudioPlayerElement.prototype = { |
| 12 // Child Elements |
9 audioController: null, | 13 audioController: null, |
10 audioElement: null, | 14 audioElement: null, |
11 trackList: null, | 15 trackList: null, |
12 | 16 |
| 17 // Published values |
| 18 playing: true, |
| 19 currenttrackurl: '', |
| 20 playcount: 0, |
| 21 |
13 // Attributes of the element (lower characters only). | 22 // Attributes of the element (lower characters only). |
14 // These values must be used only to data binding and shouldn't be assigned | 23 // These values must be used only to data binding and shouldn't be assigned |
15 // any value nowhere except in the handler. | 24 // any value nowhere except in the handler. |
16 publish: { | 25 publish: { |
17 playing: { | 26 playing: { |
18 value: true, | 27 value: true, |
19 reflect: true | 28 reflect: true |
20 }, | 29 }, |
21 currenttrackurl: { | 30 currenttrackurl: { |
22 value: '', | 31 value: '', |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 this.trackList.currentTrackIndex == nextTrackIndex) { | 246 this.trackList.currentTrackIndex == nextTrackIndex) { |
238 this.audioElement.play(); | 247 this.audioElement.play(); |
239 } | 248 } |
240 | 249 |
241 this.trackList.currentTrackIndex = nextTrackIndex; | 250 this.trackList.currentTrackIndex = nextTrackIndex; |
242 }, | 251 }, |
243 | 252 |
244 /** | 253 /** |
245 * Timeout ID of auto advance. Used internally in scheduleAutoAdvance_() and | 254 * Timeout ID of auto advance. Used internally in scheduleAutoAdvance_() and |
246 * cancelAutoAdvance_(). | 255 * cancelAutoAdvance_(). |
247 * @type {number} | 256 * @type {number?} |
248 * @private | 257 * @private |
249 */ | 258 */ |
250 autoAdvanceTimer_: null, | 259 autoAdvanceTimer_: null, |
251 | 260 |
252 /** | 261 /** |
253 * Schedules automatic advance to the next track after a timeout. | 262 * Schedules automatic advance to the next track after a timeout. |
254 * @param {boolean} forward True if next, false if previous. | 263 * @param {boolean} forward True if next, false if previous. |
255 * @param {boolean} repeat True if repeat-mode is enabled. False otherwise. | 264 * @param {boolean} repeat True if repeat-mode is enabled. False otherwise. |
256 * @private | 265 * @private |
257 */ | 266 */ |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 this.onControllerPlayingChanged(playing, !playing); | 377 this.onControllerPlayingChanged(playing, !playing); |
369 break; | 378 break; |
370 case 'MediaPreviousTrack': | 379 case 'MediaPreviousTrack': |
371 this.onControllerPreviousClicked(); | 380 this.onControllerPreviousClicked(); |
372 break; | 381 break; |
373 case 'MediaStop': | 382 case 'MediaStop': |
374 // TODO: Define "Stop" behavior. | 383 // TODO: Define "Stop" behavior. |
375 break; | 384 break; |
376 } | 385 } |
377 }, | 386 }, |
378 }); | 387 }; |
| 388 |
| 389 Polymer('audio-player', AudioPlayerElement.prototype); |
OLD | NEW |