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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 var stateIcon = this.stateIcon_; | 1031 var stateIcon = this.stateIcon_; |
1032 stateIcon.removeAttribute('state'); | 1032 stateIcon.removeAttribute('state'); |
1033 | 1033 |
1034 setTimeout(function() { | 1034 setTimeout(function() { |
1035 var newState = this.isPlaying() ? 'play' : 'pause'; | 1035 var newState = this.isPlaying() ? 'play' : 'pause'; |
1036 | 1036 |
1037 var onAnimationEnd = function(state, event) { | 1037 var onAnimationEnd = function(state, event) { |
1038 if (stateIcon.getAttribute('state') === state) | 1038 if (stateIcon.getAttribute('state') === state) |
1039 stateIcon.removeAttribute('state'); | 1039 stateIcon.removeAttribute('state'); |
1040 | 1040 |
1041 stateIcon.removeEventListener('webkitAnimationEnd', onAnimationEnd); | 1041 stateIcon.removeEventListener('animationend', onAnimationEnd); |
1042 }.bind(null, newState); | 1042 }.bind(null, newState); |
1043 stateIcon.addEventListener('webkitAnimationEnd', onAnimationEnd); | 1043 stateIcon.addEventListener('animationend', onAnimationEnd); |
1044 | 1044 |
1045 // Shows the icon with animation. | 1045 // Shows the icon with animation. |
1046 stateIcon.setAttribute('state', newState); | 1046 stateIcon.setAttribute('state', newState); |
1047 }.bind(this), 0); | 1047 }.bind(this), 0); |
1048 }; | 1048 }; |
1049 | 1049 |
1050 /** | 1050 /** |
1051 * Shows a text banner. | 1051 * Shows a text banner. |
1052 * | 1052 * |
1053 * @param {string} identifier String identifier. | 1053 * @param {string} identifier String identifier. |
1054 * @private | 1054 * @private |
1055 */ | 1055 */ |
1056 VideoControls.prototype.showTextBanner_ = function(identifier) { | 1056 VideoControls.prototype.showTextBanner_ = function(identifier) { |
1057 this.textBanner_.removeAttribute('visible'); | 1057 this.textBanner_.removeAttribute('visible'); |
1058 this.textBanner_.textContent = str(identifier); | 1058 this.textBanner_.textContent = str(identifier); |
1059 | 1059 |
1060 setTimeout(function() { | 1060 setTimeout(function() { |
1061 var onAnimationEnd = function(event) { | 1061 var onAnimationEnd = function(event) { |
1062 this.textBanner_.removeEventListener( | 1062 this.textBanner_.removeEventListener( |
1063 'webkitAnimationEnd', onAnimationEnd); | 1063 'animationend', onAnimationEnd); |
1064 this.textBanner_.removeAttribute('visible'); | 1064 this.textBanner_.removeAttribute('visible'); |
1065 }.bind(this); | 1065 }.bind(this); |
1066 this.textBanner_.addEventListener('webkitAnimationEnd', onAnimationEnd); | 1066 this.textBanner_.addEventListener('animationend', onAnimationEnd); |
1067 | 1067 |
1068 this.textBanner_.setAttribute('visible', 'true'); | 1068 this.textBanner_.setAttribute('visible', 'true'); |
1069 }.bind(this), 0); | 1069 }.bind(this), 0); |
1070 }; | 1070 }; |
1071 | 1071 |
1072 /** | 1072 /** |
1073 * @override | 1073 * @override |
1074 */ | 1074 */ |
1075 VideoControls.prototype.onPlayButtonClicked = function(event) { | 1075 VideoControls.prototype.onPlayButtonClicked = function(event) { |
1076 if (event.ctrlKey) { | 1076 if (event.ctrlKey) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 this.fullscreenButton_.setAttribute('aria-label', | 1197 this.fullscreenButton_.setAttribute('aria-label', |
1198 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') | 1198 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') |
1199 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; | 1199 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; |
1200 // If the fullscreen button has focus on entering fullscreen mode, reset the | 1200 // If the fullscreen button has focus on entering fullscreen mode, reset the |
1201 // focus to make the spacebar toggle play/pause state. This is the | 1201 // focus to make the spacebar toggle play/pause state. This is the |
1202 // consistent behavior with Youtube Web UI. | 1202 // consistent behavior with Youtube Web UI. |
1203 if (fullscreen) | 1203 if (fullscreen) |
1204 this.fullscreenButton_.blur(); | 1204 this.fullscreenButton_.blur(); |
1205 } | 1205 } |
1206 }; | 1206 }; |
OLD | NEW |