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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 function VideoControls(containerElement, onMediaError, stringFunction, | 965 function VideoControls(containerElement, onMediaError, stringFunction, |
966 opt_fullScreenToggle, opt_stateIconParent) { | 966 opt_fullScreenToggle, opt_stateIconParent) { |
967 MediaControls.call(this, containerElement, onMediaError); | 967 MediaControls.call(this, containerElement, onMediaError); |
968 this.stringFunction_ = stringFunction; | 968 this.stringFunction_ = stringFunction; |
969 | 969 |
970 this.container_.classList.add('video-controls'); | 970 this.container_.classList.add('video-controls'); |
971 this.initPlayButton(); | 971 this.initPlayButton(); |
972 this.initTimeControls(true /* show seek mark */); | 972 this.initTimeControls(true /* show seek mark */); |
973 this.initVolumeControls(); | 973 this.initVolumeControls(); |
974 | 974 |
| 975 // Create the cast button. |
| 976 this.castButton_ = this.createButton('cast menubutton'); |
| 977 this.castButton_.setAttribute('menu', '#cast-menu'); |
| 978 this.castButton_.setAttribute( |
| 979 'label', this.stringFunction_('VIDEO_PLAYER_PLAY_ON')); |
| 980 cr.ui.decorate(this.castButton_, cr.ui.MenuButton); |
| 981 |
975 if (opt_fullScreenToggle) { | 982 if (opt_fullScreenToggle) { |
976 this.fullscreenButton_ = | 983 this.fullscreenButton_ = |
977 this.createButton('fullscreen', opt_fullScreenToggle); | 984 this.createButton('fullscreen', opt_fullScreenToggle); |
978 } | 985 } |
979 | 986 |
980 if (opt_stateIconParent) { | 987 if (opt_stateIconParent) { |
981 this.stateIcon_ = this.createControl( | 988 this.stateIcon_ = this.createControl( |
982 'playback-state-icon', opt_stateIconParent); | 989 'playback-state-icon', opt_stateIconParent); |
983 this.textBanner_ = this.createControl('text-banner', opt_stateIconParent); | 990 this.textBanner_ = this.createControl('text-banner', opt_stateIconParent); |
984 } | 991 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 AudioControls.prototype.onAdvanceClick_ = function(forward) { | 1247 AudioControls.prototype.onAdvanceClick_ = function(forward) { |
1241 if (!forward && | 1248 if (!forward && |
1242 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { | 1249 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { |
1243 // We are far enough from the beginning of the current track. | 1250 // We are far enough from the beginning of the current track. |
1244 // Restart it instead of than skipping to the previous one. | 1251 // Restart it instead of than skipping to the previous one. |
1245 this.getMedia().currentTime = 0; | 1252 this.getMedia().currentTime = 0; |
1246 } else { | 1253 } else { |
1247 this.advanceTrack_(forward); | 1254 this.advanceTrack_(forward); |
1248 } | 1255 } |
1249 }; | 1256 }; |
OLD | NEW |