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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 */ | 354 */ |
355 MediaControls.prototype.attachMedia = function(mediaElement) { | 355 MediaControls.prototype.attachMedia = function(mediaElement) { |
356 this.media_ = mediaElement; | 356 this.media_ = mediaElement; |
357 | 357 |
358 this.media_.addEventListener('play', this.onMediaPlayBound_); | 358 this.media_.addEventListener('play', this.onMediaPlayBound_); |
359 this.media_.addEventListener('pause', this.onMediaPauseBound_); | 359 this.media_.addEventListener('pause', this.onMediaPauseBound_); |
360 this.media_.addEventListener('durationchange', this.onMediaDurationBound_); | 360 this.media_.addEventListener('durationchange', this.onMediaDurationBound_); |
361 this.media_.addEventListener('timeupdate', this.onMediaProgressBound_); | 361 this.media_.addEventListener('timeupdate', this.onMediaProgressBound_); |
362 this.media_.addEventListener('error', this.onMediaError_); | 362 this.media_.addEventListener('error', this.onMediaError_); |
363 | 363 |
| 364 // If the text banner is being displayed, hide it immediately, since it is |
| 365 // related to the previous media. |
| 366 this.textBanner_.removeAttribute('visible'); |
| 367 |
364 // Reflect the media state in the UI. | 368 // Reflect the media state in the UI. |
365 this.onMediaDuration_(); | 369 this.onMediaDuration_(); |
366 this.onMediaPlay_(this.isPlaying()); | 370 this.onMediaPlay_(this.isPlaying()); |
367 this.onMediaProgress_(); | 371 this.onMediaProgress_(); |
368 if (this.volume_) { | 372 if (this.volume_) { |
369 /* Copy the user selected volume to the new media element. */ | 373 /* Copy the user selected volume to the new media element. */ |
370 this.savedVolume_ = this.media_.volume = this.volume_.getValue(); | 374 this.savedVolume_ = this.media_.volume = this.volume_.getValue(); |
371 } | 375 } |
372 }; | 376 }; |
373 | 377 |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 AudioControls.prototype.onAdvanceClick_ = function(forward) { | 1259 AudioControls.prototype.onAdvanceClick_ = function(forward) { |
1256 if (!forward && | 1260 if (!forward && |
1257 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { | 1261 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { |
1258 // We are far enough from the beginning of the current track. | 1262 // We are far enough from the beginning of the current track. |
1259 // Restart it instead of than skipping to the previous one. | 1263 // Restart it instead of than skipping to the previous one. |
1260 this.getMedia().currentTime = 0; | 1264 this.getMedia().currentTime = 0; |
1261 } else { | 1265 } else { |
1262 this.advanceTrack_(forward); | 1266 this.advanceTrack_(forward); |
1263 } | 1267 } |
1264 }; | 1268 }; |
OLD | NEW |