| 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 function VideoControls( | 854 function VideoControls( |
| 855 containerElement, onMediaError, opt_fullScreenToggle, opt_stateIconParent) { | 855 containerElement, onMediaError, opt_fullScreenToggle, opt_stateIconParent) { |
| 856 MediaControls.call(this, containerElement, onMediaError); | 856 MediaControls.call(this, containerElement, onMediaError); |
| 857 | 857 |
| 858 this.container_.classList.add('video-controls'); | 858 this.container_.classList.add('video-controls'); |
| 859 this.initPlayButton(); | 859 this.initPlayButton(); |
| 860 this.initTimeControls(); | 860 this.initTimeControls(); |
| 861 this.initVolumeControls(); | 861 this.initVolumeControls(); |
| 862 this.initSubtitlesButton(); | 862 this.initSubtitlesButton(); |
| 863 | 863 |
| 864 // Create the cast button. | 864 // Create the cast menu button. |
| 865 // We need to use <button> since cr.ui.MenuButton.decorate modifies prototype | 865 // We need to use <button> since cr.ui.MenuButton.decorate modifies prototype |
| 866 // chain, by which <files-icon-button> will not work correctly. | 866 // chain, by which <files-icon-button> will not work correctly. |
| 867 // TODO(fukino): Find a way to use files-icon-button consistently. | 867 // TODO(fukino): Find a way to use files-icon-button consistently. |
| 868 this.castButton_ = this.createControl( | 868 this.castButton_ = this.createControl( |
| 869 'cast media-button', undefined, 'button'); | 869 'cast media-button', undefined, 'button'); |
| 870 this.castButton_.setAttribute('menu', '#cast-menu'); | 870 this.castButton_.setAttribute('menu', '#cast-menu'); |
| 871 this.castButton_.setAttribute('aria-label', str('VIDEO_PLAYER_PLAY_ON')); | 871 this.castButton_.setAttribute('aria-label', str('VIDEO_PLAYER_PLAY_ON')); |
| 872 this.castButton_.setAttribute('state', MediaControls.ButtonStateType.DEFAULT); | 872 this.castButton_.setAttribute('state', MediaControls.ButtonStateType.DEFAULT); |
| 873 this.castButton_.appendChild(document.createElement('files-ripple')); | 873 this.castButton_.appendChild(document.createElement('files-ripple')); |
| 874 cr.ui.decorate(this.castButton_, cr.ui.MenuButton); | 874 cr.ui.decorate(this.castButton_, cr.ui.MenuButton); |
| 875 | 875 |
| 876 // Create the cast button, which is a normal button and is used when we cast |
| 877 // videos usign Media Router. |
| 878 this.createButton('cast-button'); |
| 879 |
| 876 if (opt_fullScreenToggle) { | 880 if (opt_fullScreenToggle) { |
| 877 this.fullscreenButton_ = | 881 this.fullscreenButton_ = |
| 878 this.createButton('fullscreen', opt_fullScreenToggle); | 882 this.createButton('fullscreen', opt_fullScreenToggle); |
| 879 this.fullscreenButton_.setAttribute('aria-label', | 883 this.fullscreenButton_.setAttribute('aria-label', |
| 880 str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL')); | 884 str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL')); |
| 881 } | 885 } |
| 882 | 886 |
| 883 if (opt_stateIconParent) { | 887 if (opt_stateIconParent) { |
| 884 this.stateIcon_ = this.createControl( | 888 this.stateIcon_ = this.createControl( |
| 885 'playback-state-icon', opt_stateIconParent); | 889 'playback-state-icon', opt_stateIconParent); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 } else { | 1084 } else { |
| 1081 this.container_.removeAttribute('fullscreen'); | 1085 this.container_.removeAttribute('fullscreen'); |
| 1082 } | 1086 } |
| 1083 | 1087 |
| 1084 if (this.fullscreenButton_) { | 1088 if (this.fullscreenButton_) { |
| 1085 this.fullscreenButton_.setAttribute('aria-label', | 1089 this.fullscreenButton_.setAttribute('aria-label', |
| 1086 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') | 1090 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') |
| 1087 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; | 1091 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; |
| 1088 } | 1092 } |
| 1089 }; | 1093 }; |
| OLD | NEW |