1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-27 11:22:06 +02:00

Added subtitles demo file & styles.

This commit is contained in:
Steve Heffernan 2010-07-20 13:39:11 -07:00
parent 01ded669a1
commit 63459dfac9
3 changed files with 32 additions and 2 deletions

13
demo-subtitles.srt Executable file
View File

@ -0,0 +1,13 @@
1
00:00:02,400 --> 00:00:05,200
[Background Music Playing]
2
00:00:15,712 --> 00:00:17,399
Heay!!
3
00:00:25,712 --> 00:00:30,399
[Bird noises]

View File

@ -13,8 +13,10 @@ video.video-js { background-color: #000; position: relative; }
.video-js-box.vjs-fullscreen video.video-js { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1001; }
.video-js-box.vjs-fullscreen .vjs-controls { z-index: 1002; }
/* Poster styles */
/* Poster Style */
.vjs-poster { display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
/* Subtiles Style */
.vjs-subtitles { color:#fff; font-size: 20px; text-align: center; bottom: 20px; left: 0; right: 0; position: absolute; z-index: 1002; }
/* DEFAULT SKIN (override in another file)

View File

@ -156,7 +156,13 @@ var VideoJS = Class.extend({
}.context(this);
// Support older browsers that used autobuffer
this.fixPreloading()
this.fixPreloading();
// Load subtitles. Based on http://matroska.org/technical/specs/subtitles/srt.html
if (this.options.subtitles != null) {
this.loadSubtitles();
this.buildSubtitles();
}
},
// Support older browsers that used "autobuffer"
@ -675,10 +681,15 @@ var VideoJS = Class.extend({
flashVersionSupported: function(){
return VideoJS.getFlashVersion() >= this.options.flashVersion;
}
})
////////////////////////////////////////////////////////////////////////////////
// Convenience Functions (mini library)
// Functions not specific to video or VideoJS and could be replaced with a library like jQuery
////////////////////////////////////////////////////////////////////////////////
var _V_ = {
addClass: function(element, classToAdd){
if (element.className.split(/\s+/).lastIndexOf(classToAdd) == -1) element.className = element.className == "" ? classToAdd : element.className + " " + classToAdd;
@ -739,9 +750,13 @@ var _V_ = {
}
}
////////////////////////////////////////////////////////////////////////////////
// Class Methods
// Functions that don't apply to individual videos.
////////////////////////////////////////////////////////////////////////////////
// Add video-js to any video tag with the class
// Typically used when page is loaded.
VideoJS.setup = function(options){
var elements = document.getElementsByTagName("video");
for (var i=0,j=elements.length; i<j; i++) {