| 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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 var stateIcon = this.stateIcon_; | 927 var stateIcon = this.stateIcon_; |
| 928 stateIcon.removeAttribute('state'); | 928 stateIcon.removeAttribute('state'); |
| 929 | 929 |
| 930 setTimeout(function() { | 930 setTimeout(function() { |
| 931 var newState = this.isPlaying() ? 'play' : 'pause'; | 931 var newState = this.isPlaying() ? 'play' : 'pause'; |
| 932 | 932 |
| 933 var onAnimationEnd = function(state, event) { | 933 var onAnimationEnd = function(state, event) { |
| 934 if (stateIcon.getAttribute('state') === state) | 934 if (stateIcon.getAttribute('state') === state) |
| 935 stateIcon.removeAttribute('state'); | 935 stateIcon.removeAttribute('state'); |
| 936 | 936 |
| 937 stateIcon.removeEventListener('webkitAnimationEnd', onAnimationEnd); | 937 stateIcon.removeEventListener('animationend', onAnimationEnd); |
| 938 }.bind(null, newState); | 938 }.bind(null, newState); |
| 939 stateIcon.addEventListener('webkitAnimationEnd', onAnimationEnd); | 939 stateIcon.addEventListener('animationend', onAnimationEnd); |
| 940 | 940 |
| 941 // Shows the icon with animation. | 941 // Shows the icon with animation. |
| 942 stateIcon.setAttribute('state', newState); | 942 stateIcon.setAttribute('state', newState); |
| 943 }.bind(this), 0); | 943 }.bind(this), 0); |
| 944 }; | 944 }; |
| 945 | 945 |
| 946 /** | 946 /** |
| 947 * Shows a text banner. | 947 * Shows a text banner. |
| 948 * | 948 * |
| 949 * @param {string} identifier String identifier. | 949 * @param {string} identifier String identifier. |
| 950 * @private | 950 * @private |
| 951 */ | 951 */ |
| 952 VideoControls.prototype.showTextBanner_ = function(identifier) { | 952 VideoControls.prototype.showTextBanner_ = function(identifier) { |
| 953 this.textBanner_.removeAttribute('visible'); | 953 this.textBanner_.removeAttribute('visible'); |
| 954 this.textBanner_.textContent = str(identifier); | 954 this.textBanner_.textContent = str(identifier); |
| 955 | 955 |
| 956 setTimeout(function() { | 956 setTimeout(function() { |
| 957 var onAnimationEnd = function(event) { | 957 var onAnimationEnd = function(event) { |
| 958 this.textBanner_.removeEventListener( | 958 this.textBanner_.removeEventListener( |
| 959 'webkitAnimationEnd', onAnimationEnd); | 959 'animationend', onAnimationEnd); |
| 960 this.textBanner_.removeAttribute('visible'); | 960 this.textBanner_.removeAttribute('visible'); |
| 961 }.bind(this); | 961 }.bind(this); |
| 962 this.textBanner_.addEventListener('webkitAnimationEnd', onAnimationEnd); | 962 this.textBanner_.addEventListener('animationend', onAnimationEnd); |
| 963 | 963 |
| 964 this.textBanner_.setAttribute('visible', 'true'); | 964 this.textBanner_.setAttribute('visible', 'true'); |
| 965 }.bind(this), 0); | 965 }.bind(this), 0); |
| 966 }; | 966 }; |
| 967 | 967 |
| 968 /** | 968 /** |
| 969 * @override | 969 * @override |
| 970 */ | 970 */ |
| 971 VideoControls.prototype.onPlayButtonClicked = function(event) { | 971 VideoControls.prototype.onPlayButtonClicked = function(event) { |
| 972 if (event.ctrlKey) { | 972 if (event.ctrlKey) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 this.fullscreenButton_.setAttribute('aria-label', | 1093 this.fullscreenButton_.setAttribute('aria-label', |
| 1094 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') | 1094 fullscreen ? str('VIDEO_PLAYER_EXIT_FULL_SCREEN_BUTTON_LABEL') |
| 1095 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; | 1095 : str('VIDEO_PLAYER_FULL_SCREEN_BUTTON_LABEL'));; |
| 1096 // If the fullscreen button has focus on entering fullscreen mode, reset the | 1096 // If the fullscreen button has focus on entering fullscreen mode, reset the |
| 1097 // focus to make the spacebar toggle play/pause state. This is the | 1097 // focus to make the spacebar toggle play/pause state. This is the |
| 1098 // consistent behavior with Youtube Web UI. | 1098 // consistent behavior with Youtube Web UI. |
| 1099 if (fullscreen) | 1099 if (fullscreen) |
| 1100 this.fullscreenButton_.blur(); | 1100 this.fullscreenButton_.blur(); |
| 1101 } | 1101 } |
| 1102 }; | 1102 }; |
| OLD | NEW |