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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 * @private | 674 * @private |
675 */ | 675 */ |
676 MediaControls.Slider.prototype.onInputDrag_ = function(on) { | 676 MediaControls.Slider.prototype.onInputDrag_ = function(on) { |
677 this.isDragging_ = on; | 677 this.isDragging_ = on; |
678 this.onDrag_(on); | 678 this.onDrag_(on); |
679 }; | 679 }; |
680 | 680 |
681 /** | 681 /** |
682 * Create a customized slider with animated thumb movement. | 682 * Create a customized slider with animated thumb movement. |
683 * | 683 * |
684 * @constructor | |
685 * @param {HTMLElement} container The containing div element. | 684 * @param {HTMLElement} container The containing div element. |
686 * @param {number} value Initial value [0..1]. | 685 * @param {number} value Initial value [0..1]. |
687 * @param {number} range Number of distinct slider positions to be supported. | 686 * @param {number} range Number of distinct slider positions to be supported. |
688 * @param {function(number)} onChange Value change handler. | 687 * @param {function(number)} onChange Value change handler. |
689 * @param {function(boolean)} onDrag Drag begin/end handler. | 688 * @param {function(boolean)} onDrag Drag begin/end handler. |
690 * @param {function(number):string} formatFunction Value formatting function. | 689 * @param {function(number):string} formatFunction Value formatting function. |
| 690 * @constructor |
691 */ | 691 */ |
692 MediaControls.AnimatedSlider = function( | 692 MediaControls.AnimatedSlider = function( |
693 container, value, range, onChange, onDrag, formatFunction) { | 693 container, value, range, onChange, onDrag, formatFunction) { |
694 MediaControls.Slider.apply(this, arguments); | 694 MediaControls.Slider.apply(this, arguments); |
695 }; | 695 }; |
696 | 696 |
697 MediaControls.AnimatedSlider.prototype = { | 697 MediaControls.AnimatedSlider.prototype = { |
698 __proto__: MediaControls.Slider.prototype | 698 __proto__: MediaControls.Slider.prototype |
699 }; | 699 }; |
700 | 700 |
(...skipping 27 matching lines...) Expand all Loading... |
728 } | 728 } |
729 }.bind(this), | 729 }.bind(this), |
730 MediaControls.AnimatedSlider.DURATION / MediaControls.AnimatedSlider.STEPS); | 730 MediaControls.AnimatedSlider.DURATION / MediaControls.AnimatedSlider.STEPS); |
731 }; | 731 }; |
732 | 732 |
733 /** | 733 /** |
734 * Create a customized slider with a precise time feedback. | 734 * Create a customized slider with a precise time feedback. |
735 * | 735 * |
736 * The time value is shown above the slider bar at the mouse position. | 736 * The time value is shown above the slider bar at the mouse position. |
737 * | 737 * |
738 * @constructor | |
739 * @param {HTMLElement} container The containing div element. | 738 * @param {HTMLElement} container The containing div element. |
740 * @param {number} value Initial value [0..1]. | 739 * @param {number} value Initial value [0..1]. |
741 * @param {number} range Number of distinct slider positions to be supported. | 740 * @param {number} range Number of distinct slider positions to be supported. |
742 * @param {function(number)} onChange Value change handler. | 741 * @param {function(number)} onChange Value change handler. |
743 * @param {function(boolean)} onDrag Drag begin/end handler. | 742 * @param {function(boolean)} onDrag Drag begin/end handler. |
744 * @param {function(number):string} formatFunction Value formatting function. | 743 * @param {function(number):string} formatFunction Value formatting function. |
| 744 * @constructor |
745 */ | 745 */ |
746 MediaControls.PreciseSlider = function( | 746 MediaControls.PreciseSlider = function( |
747 container, value, range, onChange, onDrag, formatFunction) { | 747 container, value, range, onChange, onDrag, formatFunction) { |
748 MediaControls.Slider.apply(this, arguments); | 748 MediaControls.Slider.apply(this, arguments); |
749 | 749 |
750 var doc = this.container_.ownerDocument; | 750 var doc = this.container_.ownerDocument; |
751 | 751 |
752 /** | 752 /** |
753 * @type {function(number):string} | 753 * @type {function(number):string} |
| 754 * @private |
754 */ | 755 */ |
755 this.valueToString_ = null; | 756 this.valueToString_ = null; |
756 | 757 |
757 this.seekMark_ = doc.createElement('div'); | 758 this.seekMark_ = doc.createElement('div'); |
758 this.seekMark_.className = 'seek-mark'; | 759 this.seekMark_.className = 'seek-mark'; |
759 this.getBar().appendChild(this.seekMark_); | 760 this.getBar().appendChild(this.seekMark_); |
760 | 761 |
761 this.seekLabel_ = doc.createElement('div'); | 762 this.seekLabel_ = doc.createElement('div'); |
762 this.seekLabel_.className = 'seek-label'; | 763 this.seekLabel_.className = 'seek-label'; |
763 this.seekMark_.appendChild(this.seekLabel_); | 764 this.seekMark_.appendChild(this.seekLabel_); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 AudioControls.prototype.onAdvanceClick_ = function(forward) { | 1132 AudioControls.prototype.onAdvanceClick_ = function(forward) { |
1132 if (!forward && | 1133 if (!forward && |
1133 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { | 1134 (this.getMedia().currentTime > AudioControls.TRACK_RESTART_THRESHOLD)) { |
1134 // We are far enough from the beginning of the current track. | 1135 // We are far enough from the beginning of the current track. |
1135 // Restart it instead of than skipping to the previous one. | 1136 // Restart it instead of than skipping to the previous one. |
1136 this.getMedia().currentTime = 0; | 1137 this.getMedia().currentTime = 0; |
1137 } else { | 1138 } else { |
1138 this.advanceTrack_(forward); | 1139 this.advanceTrack_(forward); |
1139 } | 1140 } |
1140 }; | 1141 }; |
OLD | NEW |