1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

Fixed support for webvtt chapters. Fixes #676.. closes #1221

This commit is contained in:
Chris Fung 2014-06-13 11:30:44 -07:00 committed by Steve Heffernan
parent 6d78c95bb4
commit 95173ebf7c
3 changed files with 27 additions and 12 deletions

View File

@ -3,6 +3,7 @@ CHANGELOG
## HEAD (Unreleased)
* Added cross-browser isArray for cross-frame support. fixes #1195 ([view](https://github.com/videojs/video.js/pull/1218))
* Fixed support for webvtt chapters. Fixes #676. ([view](https://github.com/videojs/video.js/pull/1221))
--------------------

View File

@ -100,6 +100,7 @@ The control icons are from a custom font. Each icon corresponds to a character
@spinner4-icon: "\e01f";
@subtitles-icon: "\e00c";
@captions-icon: "\e008";
@chapters-icon: "\e00c";
@share-icon: "\e00e";
@cog-icon: "\e600";
@ -765,13 +766,24 @@ easily in the skin designer. http://designer.videojs.com/
}
/* Subtitles Button */
.vjs-default-skin .vjs-subtitles-button:before { content: @subtitles-icon; }
.vjs-default-skin .vjs-subtitles-button:before {
content: @subtitles-icon;
}
/* Captions Button */
.vjs-default-skin .vjs-captions-button:before {
content: @captions-icon;
}
/* Chapters Button */
.vjs-default-skin .vjs-chapters-button:before {
content: @chapters-icon;
}
.vjs-default-skin .vjs-chapters-button.vjs-menu-button .vjs-menu .vjs-menu-content {
width: 20em;
}
/* Replacement for focus outline */
.vjs-default-skin .vjs-captions-button:focus .vjs-control-content:before,
.vjs-default-skin .vjs-captions-button:hover .vjs-control-content:before {

View File

@ -941,11 +941,10 @@ vjs.ChaptersButton.prototype.createMenu = function(){
for (;i<j;i++) {
track = tracks[i];
if (track.kind() == this.kind_ && track.dflt()) {
if (track.readyState() < 2) {
this.chaptersTrack = track;
if (track.kind() == this.kind_) {
if (track.readyState() === 0) {
track.load();
track.on('loaded', vjs.bind(this, this.createMenu));
return;
} else {
chaptersTrack = track;
break;
@ -953,13 +952,15 @@ vjs.ChaptersButton.prototype.createMenu = function(){
}
}
var menu = this.menu = new vjs.Menu(this.player_);
menu.contentEl().appendChild(vjs.createEl('li', {
className: 'vjs-menu-title',
innerHTML: vjs.capitalize(this.kind_),
tabindex: -1
}));
var menu = this.menu;
if (menu === undefined) {
menu = new vjs.Menu(this.player_);
menu.contentEl().appendChild(vjs.createEl('li', {
className: 'vjs-menu-title',
innerHTML: vjs.capitalize(this.kind_),
tabindex: -1
}));
}
if (chaptersTrack) {
var cues = chaptersTrack.cues_, cue, mi;
@ -978,6 +979,7 @@ vjs.ChaptersButton.prototype.createMenu = function(){
menu.addChild(mi);
}
this.addChild(menu);
}
if (this.items.length > 0) {