1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-17 01:42:41 +02:00

Added captions button and display styles.

This commit is contained in:
Steve Heffernan
2012-03-02 13:52:06 -08:00
parent 96a3b03fd7
commit 12816b8409
5 changed files with 63 additions and 9 deletions

27
src/controls.js vendored
View File

@ -234,7 +234,8 @@ _V_.ControlBar = _V_.Component.extend({
"remainingTimeDisplay": {},
"progressControl": {},
"volumeControl": {},
"muteToggle": {}
"muteToggle": {},
"captionsButton": {}
}
},
@ -803,7 +804,7 @@ _V_.TextTrackDisplay = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-" + this.trackType
className: "vjs-" + this.trackType + " vjs-text-track"
});
},
@ -835,4 +836,26 @@ _V_.DescriptionsDisplay = _V_.TextTrackDisplay.extend({
trackType: "descriptions"
});
/* Captions Button
================================================================================ */
_V_.CaptionsButton = _V_.Button.extend({
buttonText: "Captions",
buildCSSClass: function(){
return "vjs-captions-control " + this._super();
},
onClick: function(){
this.player.textTrackValue("captions", "Hi<br>hi2")
var captionsDisplay = this.player.captionsDisplay;
if (captionsDisplay.el.style.display == "block") {
captionsDisplay.hide();
} else {
captionsDisplay.show();
}
}
});