| 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 /** | 5 /** |
| 6 * @fileoverview MediaControls class implements media playback controls | 6 * @fileoverview MediaControls class implements media playback controls |
| 7 * that exist outside of the audio/video HTML element. | 7 * that exist outside of the audio/video HTML element. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 529 } |
| 530 }; | 530 }; |
| 531 | 531 |
| 532 /** | 532 /** |
| 533 * Initializes subtitles button. | 533 * Initializes subtitles button. |
| 534 */ | 534 */ |
| 535 MediaControls.prototype.initSubtitlesButton = function() { | 535 MediaControls.prototype.initSubtitlesButton = function() { |
| 536 this.subtitlesTrack_ = null; | 536 this.subtitlesTrack_ = null; |
| 537 this.subtitlesButton_ = | 537 this.subtitlesButton_ = |
| 538 this.createButton('subtitles', this.onSubtitlesButtonClicked_.bind(this)); | 538 this.createButton('subtitles', this.onSubtitlesButtonClicked_.bind(this)); |
| 539 this.subtitlesButton_.setAttribute('aria-label', | |
| 540 str('VIDEO_PLAYER_SUBTITLES_BUTTON_LABEL')); | |
| 541 }; | 539 }; |
| 542 | 540 |
| 543 /** | 541 /** |
| 544 * @param {Event} event Mouse click event. | 542 * @param {Event} event Mouse click event. |
| 545 * @private | 543 * @private |
| 546 */ | 544 */ |
| 547 MediaControls.prototype.onSubtitlesButtonClicked_ = function(event) { | 545 MediaControls.prototype.onSubtitlesButtonClicked_ = function(event) { |
| 548 if (!this.subtitlesTrack_) { | 546 if (!this.subtitlesTrack_) { |
| 549 return; | 547 return; |
| 550 } | 548 } |
| 551 this.toggleSubtitlesMode_(this.subtitlesTrack_.mode === 'hidden'); | 549 this.toggleSubtitlesMode_(this.subtitlesTrack_.mode === 'hidden'); |
| 552 }; | 550 }; |
| 553 | 551 |
| 554 /** | 552 /** |
| 555 * @param {boolean} on Whether enabled or not. | 553 * @param {boolean} on Whether enabled or not. |
| 556 * @private | 554 * @private |
| 557 */ | 555 */ |
| 558 MediaControls.prototype.toggleSubtitlesMode_ = function(on) { | 556 MediaControls.prototype.toggleSubtitlesMode_ = function(on) { |
| 559 if (!this.subtitlesTrack_) { | 557 if (!this.subtitlesTrack_) { |
| 560 return; | 558 return; |
| 561 } | 559 } |
| 562 if (on) { | 560 if (on) { |
| 563 this.subtitlesTrack_.mode = 'showing'; | 561 this.subtitlesTrack_.mode = 'showing'; |
| 564 this.subtitlesButton_.setAttribute('showing', ''); | 562 this.subtitlesButton_.setAttribute('showing', ''); |
| 563 this.subtitlesButton_.setAttribute('aria-label', |
| 564 str('VIDEO_PLAYER_DISABLE_SUBTITLES_BUTTON_LABEL')); |
| 565 } else { | 565 } else { |
| 566 this.subtitlesTrack_.mode = 'hidden'; | 566 this.subtitlesTrack_.mode = 'hidden'; |
| 567 this.subtitlesButton_.removeAttribute('showing'); | 567 this.subtitlesButton_.removeAttribute('showing'); |
| 568 this.subtitlesButton_.setAttribute('aria-label', |
| 569 str('VIDEO_PLAYER_ENABLE_SUBTITLES_BUTTON_LABEL')); |
| 568 } | 570 } |
| 569 }; | 571 }; |
| 570 | 572 |
| 571 /** | 573 /** |
| 572 * @param {TextTrack} track Subtitles track | 574 * @param {TextTrack} track Subtitles track |
| 573 * @private | 575 * @private |
| 574 */ | 576 */ |
| 575 MediaControls.prototype.attachTextTrack_ = function(track) { | 577 MediaControls.prototype.attachTextTrack_ = function(track) { |
| 576 this.subtitlesTrack_ = track; | 578 this.subtitlesTrack_ = track; |
| 577 if (this.subtitlesTrack_) { | 579 if (this.subtitlesTrack_) { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 } else { | 1043 } else { |
| 1042 this.container_.removeAttribute('fullscreen'); | 1044 this.container_.removeAttribute('fullscreen'); |
| 1043 } | 1045 } |
| 1044 | 1046 |
| 1045 if (this.fullscreenButton_) { | 1047 if (this.fullscreenButton_) { |
| 1046 this.fullscreenButton_.setAttribute('aria-label', | 1048 this.fullscreenButton_.setAttribute('aria-label', |
| 1047 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') | 1049 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') |
| 1048 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; | 1050 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; |
| 1049 } | 1051 } |
| 1050 }; | 1052 }; |
| OLD | NEW |