videojs-vtt.js
Advanced tools
Comparing version 0.14.1 to 0.15.0
@@ -1,2 +0,2 @@ | ||
(function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g.vttjs=f()})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g.vttjs=f()})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
/** | ||
@@ -62,3 +62,3 @@ * Copyright 2013 vtt.js Contributors | ||
var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); | ||
var m = input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/); | ||
if (!m) { | ||
@@ -196,3 +196,3 @@ return null; | ||
if (vals.length === 2) { | ||
settings.alt("lineAlign", vals[1], ["start", "middle", "end"]); | ||
settings.alt("lineAlign", vals[1], ["start", "center", "end"]); | ||
} | ||
@@ -204,3 +204,3 @@ break; | ||
if (vals.length === 2) { | ||
settings.alt("positionAlign", vals[1], ["start", "middle", "end"]); | ||
settings.alt("positionAlign", vals[1], ["start", "center", "end"]); | ||
} | ||
@@ -212,3 +212,3 @@ break; | ||
case "align": | ||
settings.alt(k, v, ["start", "middle", "end", "left", "right"]); | ||
settings.alt(k, v, ["start", "center", "end", "left", "right"]); | ||
break; | ||
@@ -221,18 +221,33 @@ } | ||
cue.vertical = settings.get("vertical", ""); | ||
cue.line = settings.get("line", "auto"); | ||
try { | ||
cue.line = settings.get("line", "auto"); | ||
} catch (e) {} | ||
cue.lineAlign = settings.get("lineAlign", "start"); | ||
cue.snapToLines = settings.get("snapToLines", true); | ||
cue.size = settings.get("size", 100); | ||
cue.align = settings.get("align", "middle"); | ||
cue.position = settings.get("position", { | ||
start: 0, | ||
left: 0, | ||
middle: 50, | ||
end: 100, | ||
right: 100 | ||
}, cue.align); | ||
// Safari still uses the old middle value and won't accept center | ||
try { | ||
cue.align = settings.get("align", "center"); | ||
} catch (e) { | ||
cue.align = settings.get("align", "middle"); | ||
} | ||
try { | ||
cue.position = settings.get("position", "auto"); | ||
} catch (e) { | ||
cue.position = settings.get("position", { | ||
start: 0, | ||
left: 0, | ||
center: 50, | ||
middle: 50, | ||
end: 100, | ||
right: 100 | ||
}, cue.align); | ||
} | ||
cue.positionAlign = settings.get("positionAlign", { | ||
start: "start", | ||
left: "start", | ||
middle: "middle", | ||
center: "center", | ||
middle: "center", | ||
end: "end", | ||
@@ -265,10 +280,3 @@ right: "end" | ||
var ESCAPE = { | ||
"&": "&", | ||
"<": "<", | ||
">": ">", | ||
"‎": "\u200e", | ||
"‏": "\u200f", | ||
" ": "\u00a0" | ||
}; | ||
var TEXTAREA_ELEMENT = window.document.createElement("textarea"); | ||
@@ -286,2 +294,15 @@ var TAG_NAME = { | ||
// 5.1 default text color | ||
// 5.2 default text background color is equivalent to text color with bg_ prefix | ||
var DEFAULT_COLOR_CLASS = { | ||
white: 'rgba(255,255,255,1)', | ||
lime: 'rgba(0,255,0,1)', | ||
cyan: 'rgba(0,255,255,1)', | ||
red: 'rgba(255,0,0,1)', | ||
yellow: 'rgba(255,255,0,1)', | ||
magenta: 'rgba(255,0,255,1)', | ||
blue: 'rgba(0,0,255,1)', | ||
black: 'rgba(0,0,0,1)' | ||
}; | ||
var TAG_ANNOTATION = { | ||
@@ -316,10 +337,6 @@ v: "title", | ||
// Unescape a string 's'. | ||
function unescape1(e) { | ||
return ESCAPE[e]; | ||
} | ||
function unescape(s) { | ||
while ((m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))) { | ||
s = s.replace(m[0], unescape1); | ||
} | ||
TEXTAREA_ELEMENT.innerHTML = s; | ||
s = TEXTAREA_ELEMENT.textContent; | ||
TEXTAREA_ELEMENT.textContent = ""; | ||
return s; | ||
@@ -340,3 +357,2 @@ } | ||
var element = window.document.createElement(tagName); | ||
element.localName = tagName; | ||
var name = TAG_ANNOTATION[type]; | ||
@@ -391,3 +407,18 @@ if (name && annotation) { | ||
if (m[2]) { | ||
node.className = m[2].substr(1).replace('.', ' '); | ||
var classes = m[2].split('.'); | ||
classes.forEach(function(cl) { | ||
var bgColor = /^bg_/.test(cl); | ||
// slice out `bg_` if it's a background color | ||
var colorName = bgColor ? cl.slice(3) : cl; | ||
if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) { | ||
var propName = bgColor ? 'background-color' : 'color'; | ||
var propValue = DEFAULT_COLOR_CLASS[colorName]; | ||
node.style[propName] = propValue; | ||
} | ||
}); | ||
node.className = classes.join(' '); | ||
} | ||
@@ -570,3 +601,3 @@ // Append the node to the current node, and enter the scope of the new | ||
// div. Note, all WebVTT cue-setting alignments are equivalent to the CSS | ||
// mirrors of them except "middle" which is "center" in CSS. | ||
// mirrors of them except middle instead of center on Safari. | ||
this.div = window.document.createElement("div"); | ||
@@ -596,3 +627,3 @@ styles = { | ||
break; | ||
case "middle": | ||
case "center": | ||
textPos = cue.position - (cue.size / 2); | ||
@@ -875,3 +906,3 @@ break; | ||
switch (cue.lineAlign) { | ||
case "middle": | ||
case "center": | ||
linePos -= (calculatedPercentage / 2); | ||
@@ -1237,2 +1268,8 @@ break; | ||
self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, ""); | ||
// Safari still uses the old middle value and won't accept center | ||
try { | ||
self.cue.align = "center"; | ||
} catch (e) { | ||
self.cue.align = "middle"; | ||
} | ||
self.state = "CUE"; | ||
@@ -1275,3 +1312,3 @@ // 30-39 - Check if self line contains an optional identifier or timing data. | ||
} | ||
self.cue.text += line; | ||
self.cue.text += line.replace(/\u2028/g, '\n').replace(/u2029/g, '\n'); | ||
continue; | ||
@@ -1351,6 +1388,9 @@ case "BADCUE": // BADCUE | ||
"start": 1, | ||
"middle": 1, | ||
"center": 1, | ||
"end": 1, | ||
"left": 1, | ||
"right": 1 | ||
"right": 1, | ||
"auto": 1, | ||
"line-left": 1, | ||
"line-right": 1 | ||
}; | ||
@@ -1400,6 +1440,6 @@ | ||
var _lineAlign = "start"; | ||
var _position = 50; | ||
var _positionAlign = "middle"; | ||
var _size = 50; | ||
var _align = "middle"; | ||
var _position = "auto"; | ||
var _positionAlign = "auto"; | ||
var _size = 100; | ||
var _align = "center"; | ||
@@ -1486,3 +1526,3 @@ Object.defineProperties(this, { | ||
if (setting === false) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
throw new SyntaxError("Vertical: an invalid or illegal direction string was specified."); | ||
} | ||
@@ -1512,3 +1552,3 @@ _vertical = setting; | ||
if (typeof value !== "number" && value !== autoKeyword) { | ||
throw new SyntaxError("An invalid number or illegal string was specified."); | ||
throw new SyntaxError("Line: an invalid number or illegal string was specified."); | ||
} | ||
@@ -1528,6 +1568,7 @@ _line = value; | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("lineAlign: an invalid or illegal string was specified."); | ||
} else { | ||
_lineAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
_lineAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
@@ -1558,6 +1599,7 @@ }, | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("positionAlign: an invalid or illegal string was specified."); | ||
} else { | ||
_positionAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
_positionAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
@@ -1588,3 +1630,3 @@ }, | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
throw new SyntaxError("align: an invalid or illegal alignment string was specified."); | ||
} | ||
@@ -1742,5 +1784,6 @@ _align = setting; | ||
if (setting === false) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("Scroll: an invalid or illegal string was specified."); | ||
} else { | ||
_scroll = setting; | ||
} | ||
_scroll = setting; | ||
} | ||
@@ -1755,12 +1798,16 @@ } | ||
(function (global){ | ||
var win; | ||
if (typeof window !== "undefined") { | ||
module.exports = window; | ||
win = window; | ||
} else if (typeof global !== "undefined") { | ||
module.exports = global; | ||
win = global; | ||
} else if (typeof self !== "undefined"){ | ||
module.exports = self; | ||
win = self; | ||
} else { | ||
module.exports = {}; | ||
win = {}; | ||
} | ||
module.exports = win; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
@@ -1820,2 +1867,2 @@ },{}],5:[function(require,module,exports){ | ||
},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5) | ||
}); | ||
}); |
@@ -1,2 +0,2 @@ | ||
/* videojs-vtt.js - v0.14.1 (https://github.com/gkatsev/vtt.js) built on 10-04-2018 */ | ||
!function(a){var b;"undefined"!=typeof window?b=window:"undefined"!=typeof self&&(b=self),b.vttjs=a()}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function d(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function e(){this.values=q(null)}function f(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function g(a,b,g){function h(){var b=d(a);if(null===b)throw new c(c.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var c=new e;f(a,function(a,b){switch(a){case"region":for(var d=g.length-1;d>=0;d--)if(g[d].id===b){c.set(a,g[d].region);break}break;case"vertical":c.alt(a,b,["rl","lr"]);break;case"line":var e=b.split(","),f=e[0];c.integer(a,f),c.percent(a,f)?c.set("snapToLines",!1):null,c.alt(a,f,["auto"]),2===e.length&&c.alt("lineAlign",e[1],["start","middle","end"]);break;case"position":e=b.split(","),c.percent(a,e[0]),2===e.length&&c.alt("positionAlign",e[1],["start","middle","end"]);break;case"size":c.percent(a,b);break;case"align":c.alt(a,b,["start","middle","end","left","right"])}},/:/,/\s/),b.region=c.get("region",null),b.vertical=c.get("vertical",""),b.line=c.get("line","auto"),b.lineAlign=c.get("lineAlign","start"),b.snapToLines=c.get("snapToLines",!0),b.size=c.get("size",100),b.align=c.get("align","middle"),b.position=c.get("position",{start:0,left:0,middle:50,end:100,right:100},b.align),b.positionAlign=c.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"-->"!==a.substr(0,3))throw new c(c.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function h(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function e(a){return r[a]}function f(a){for(;o=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(o[0],e);return a}function g(a,b){return!u[b.localName]||u[b.localName]===a.localName}function h(b,c){var d=s[b];if(!d)return null;var e=a.document.createElement(d);e.localName=d;var f=t[b];return f&&c&&(e[f]=c.trim()),e}for(var i,j=a.document.createElement("div"),k=j,l=[];null!==(i=c());)if("<"!==i[0])k.appendChild(a.document.createTextNode(f(i)));else{if("/"===i[1]){l.length&&l[l.length-1]===i.substr(2).replace(">","")&&(l.pop(),k=k.parentNode);continue}var m,n=d(i.substr(1,i.length-2));if(n){m=a.document.createProcessingInstruction("timestamp",n),k.appendChild(m);continue}var o=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!o)continue;if(m=h(o[1],o[3]),!m)continue;if(!g(k,m))continue;o[2]&&(m.className=o[2].substr(1).replace("."," ")),l.push(o[1]),k.appendChild(m),k=m}return j}function i(a){for(var b=0;b<v.length;b++){var c=v[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function j(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),i(d))return"rtl";return"ltr"}function k(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function l(){}function m(a,b,c){l.call(this),this.cue=b,this.cueDiv=h(a,b.text);var d={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(d,this.cueDiv),this.div=a.document.createElement("div"),d={direction:j(this.cueDiv),writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(d),this.div.appendChild(this.cueDiv);var e=0;switch(b.positionAlign){case"start":e=b.position;break;case"middle":e=b.position-b.size/2;break;case"end":e=b.position-b.size}this.applyStyles(""===b.vertical?{left:this.formatStyle(e,"%"),width:this.formatStyle(b.size,"%")}:{top:this.formatStyle(e,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function n(a){var b,c,d,e;if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var f=(f=a.div.childNodes)&&(f=f[0])&&f.getClientRects&&f.getClientRects();a=a.div.getBoundingClientRect(),b=f?Math.max(f[0]&&f[0].height||0,a.height/f.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight}function o(a,b,c,d){function e(a,b){for(var e,f=new n(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new n(a),g=i),a=new n(f)}return e||f}var f=new n(b),g=b.cue,h=k(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var l=f.lineHeight,m=l*Math.round(h),o=c[j]+l,p=i[0];Math.abs(m)>o&&(m=0>m?-1:1,m*=Math.ceil(o/l)*l),0>h&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"middle":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new n(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function p(){}var q=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();c.prototype=q(Error.prototype),c.prototype.constructor=c,c.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},e.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){var c;return(c=b.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(b=parseFloat(b),b>=0&&100>=b)?(this.set(a,b),!0):!1}};var r={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},s={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},t={v:"title",lang:"lang"},u={rt:"ruby"},v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];l.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},l.prototype.formatStyle=function(a,b){return 0===a?0:a+b},m.prototype=q(l.prototype),m.prototype.constructor=m,n.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},n.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},n.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},n.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},n.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},n.prototype.intersectPercentage=function(a){var b=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),c=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),d=b*c;return d/(this.height*this.width)},n.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},n.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c};return e},p.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},p.convertCueToDOMTree=function(a,b){return a&&b?h(a,b):null};var w=.05,x="sans-serif",y="1.5%";p.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin=y,c.appendChild(e),d(b)){var f=[],g=n.getSimpleBoxPosition(e),h=Math.round(g.height*w*100)/100,i={font:h+"px "+x};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new m(a,d,i),e.appendChild(c.div),o(a,c,g,f),d.displayState=c.div,f.push(n.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},p.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},p.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof c))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function h(a){var b=new e;if(f(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var f=new e;if(f.percent("x",d[0]),f.percent("y",d[1]),!f.has("x")||!f.has("y"))break;b.set(a+"X",f.get("x")),b.set(a+"Y",f.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new e;f(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",d(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?f(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):f(a,function(a,b){switch(a){case"Region":h(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new c(c.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;if(k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,""),k.state="CUE",-1===l.indexOf("-->")){k.cue.id=l;continue}case"CUE":try{g(l,k.cue,k.regionList)}catch(o){k.reportOrThrowError(o),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var p=-1!==l.indexOf("-->");if(!l||p&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l;continue;case"BADCUE":l||(k.state="ID");continue}}}catch(o){k.reportOrThrowError(o),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new c(c.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=p},{}],2:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=g[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){if("string"!=typeof a)return!1;var b=h[a.toLowerCase()];return b?a.toLowerCase():!1}function e(a,b,e){this.hasBeenReset=!1;var g="",h=!1,i=a,j=b,k=e,l=null,m="",n=!0,o="auto",p="start",q=50,r="middle",s=50,t="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(a){g=""+a}},pauseOnExit:{enumerable:!0,get:function(){return h},set:function(a){h=!!a}},startTime:{enumerable:!0,get:function(){return i},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");i=a,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return j},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");j=a,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return k},set:function(a){k=""+a,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(a){l=a,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=b,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return n},set:function(a){n=!!a,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return o},set:function(a){if("number"!=typeof a&&a!==f)throw new SyntaxError("An invalid number or illegal string was specified.");o=a,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");p=b,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return q},set:function(a){if(0>a||a>100)throw new Error("Position must be between 0 and 100.");q=a,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return r},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");r=b,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return s},set:function(a){if(0>a||a>100)throw new Error("Size must be between 0 and 100.");s=a,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return t},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var f="auto",g={"":1,lr:1,rl:1},h={start:1,middle:1,end:1,left:1,right:1};e.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=e},{}],3:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=f[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){return"number"==typeof a&&a>=0&&100>=a}function e(){var a=100,b=3,e=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!d(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!d(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(a){if(!d(a))throw new Error("RegionAnchorY must be between 0 and 100.");e=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!d(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!d(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=b}}})}var f={"":!0,up:!0};b.exports=e},{}],4:[function(a,b){(function(a){b.exports="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b){var c=a("global/window"),d=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};c.vttjs=d,c.WebVTT=d.WebVTT;var e=d.VTTCue,f=d.VTTRegion,g=c.VTTCue,h=c.VTTRegion;d.shim=function(){c.VTTCue=e,c.VTTRegion=f},d.restore=function(){c.VTTCue=g,c.VTTRegion=h},c.VTTCue||d.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); | ||
/* videojs-vtt.js - v0.14.1 (https://github.com/videojs/vtt.js) built on 26-11-2019 */ | ||
!function(a){var b;"undefined"!=typeof window?b=window:"undefined"!=typeof self&&(b=self),b.vttjs=a()}(function(){return function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){return e(b[g][1][a]||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}return a}()({1:[function(a,b,c){function d(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function e(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function f(){this.values=r(null)}function g(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function h(a,b,c){function h(){var b=e(a);if(null===b)throw new d(d.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var d=new f;g(a,function(a,b){switch(a){case"region":for(var e=c.length-1;e>=0;e--)if(c[e].id===b){d.set(a,c[e].region);break}break;case"vertical":d.alt(a,b,["rl","lr"]);break;case"line":var f=b.split(","),g=f[0];d.integer(a,g),d.percent(a,g)&&d.set("snapToLines",!1),d.alt(a,g,["auto"]),2===f.length&&d.alt("lineAlign",f[1],["start","center","end"]);break;case"position":f=b.split(","),d.percent(a,f[0]),2===f.length&&d.alt("positionAlign",f[1],["start","center","end"]);break;case"size":d.percent(a,b);break;case"align":d.alt(a,b,["start","center","end","left","right"])}},/:/,/\s/),b.region=d.get("region",null),b.vertical=d.get("vertical","");try{b.line=d.get("line","auto")}catch(a){}b.lineAlign=d.get("lineAlign","start"),b.snapToLines=d.get("snapToLines",!0),b.size=d.get("size",100);try{b.align=d.get("align","center")}catch(a){b.align=d.get("align","middle")}try{b.position=d.get("position","auto")}catch(a){b.position=d.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},b.align)}b.positionAlign=d.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"--\x3e"!==a.substr(0,3))throw new d(d.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function i(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function d(a){return s.innerHTML=a,a=s.textContent,s.textContent="",a}function f(a,b){return!w[b.localName]||w[b.localName]===a.localName}function g(b,c){var d=t[b];if(!d)return null;var e=a.document.createElement(d),f=v[b];return f&&c&&(e[f]=c.trim()),e}for(var h,i=a.document.createElement("div"),j=i,k=[];null!==(h=c());)if("<"!==h[0])j.appendChild(a.document.createTextNode(d(h)));else{if("/"===h[1]){k.length&&k[k.length-1]===h.substr(2).replace(">","")&&(k.pop(),j=j.parentNode);continue}var l,m=e(h.substr(1,h.length-2));if(m){l=a.document.createProcessingInstruction("timestamp",m),j.appendChild(l);continue}var n=h.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!n)continue;if(!(l=g(n[1],n[3])))continue;if(!f(j,l))continue;if(n[2]){var o=n[2].split(".");o.forEach(function(a){var b=/^bg_/.test(a),c=b?a.slice(3):a;if(u.hasOwnProperty(c)){var d=b?"background-color":"color",e=u[c];l.style[d]=e}}),l.className=o.join(" ")}k.push(n[1]),j.appendChild(l),j=l}return i}function j(a){for(var b=0;b<x.length;b++){var c=x[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function k(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),j(d))return"rtl";return"ltr"}function l(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function m(){}function n(a,b,c){m.call(this),this.cue=b,this.cueDiv=i(a,b.text);var d={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(d,this.cueDiv),this.div=a.document.createElement("div"),d={direction:k(this.cueDiv),writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(d),this.div.appendChild(this.cueDiv);var e=0;switch(b.positionAlign){case"start":e=b.position;break;case"center":e=b.position-b.size/2;break;case"end":e=b.position-b.size}""===b.vertical?this.applyStyles({left:this.formatStyle(e,"%"),width:this.formatStyle(b.size,"%")}):this.applyStyles({top:this.formatStyle(e,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function o(a){var b,c,d,e;if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var f=(f=a.div.childNodes)&&(f=f[0])&&f.getClientRects&&f.getClientRects();a=a.div.getBoundingClientRect(),b=f?Math.max(f[0]&&f[0].height||0,a.height/f.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight}function p(a,b,c,d){function e(a,b){for(var e,f=new o(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new o(a),g=i),a=new o(f)}return e||f}var f=new o(b),g=b.cue,h=l(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var k=f.lineHeight,m=k*Math.round(h),n=c[j]+k,p=i[0];Math.abs(m)>n&&(m=m<0?-1:1,m*=Math.ceil(n/k)*k),h<0&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"center":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new o(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function q(){}var r=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();d.prototype=r(Error.prototype),d.prototype.constructor=d,d.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},f.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){return!!(b.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(b=parseFloat(b))>=0&&b<=100)&&(this.set(a,b),!0)}};var s=window.document.createElement("textarea"),t={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},u={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},v={v:"title",lang:"lang"},w={rt:"ruby"},x=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];m.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},m.prototype.formatStyle=function(a,b){return 0===a?0:a+b},n.prototype=r(m.prototype),n.prototype.constructor=n,o.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},o.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},o.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},o.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},o.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},o.prototype.intersectPercentage=function(a){return Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left))*Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top))/(this.height*this.width)},o.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},o.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;return a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a,{left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c}},q.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},q.convertCueToDOMTree=function(a,b){return a&&b?i(a,b):null},q.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin="1.5%",c.appendChild(e),d(b)){var f=[],g=o.getSimpleBoxPosition(e),h=Math.round(.05*g.height*100)/100,i={font:h+"px sans-serif"};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new n(a,d,i),e.appendChild(c.div),p(a,c,g,f),d.displayState=c.div,f.push(o.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},q.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},q.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof d))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function c(a){var b=new f;if(g(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var e=new f;if(e.percent("x",d[0]),e.percent("y",d[1]),!e.has("x")||!e.has("y"))break;b.set(a+"X",e.get("x")),b.set(a+"Y",e.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new f;g(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",e(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?g(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):g(a,function(a,b){switch(a){case"Region":c(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new d(d.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,"");try{k.cue.align="center"}catch(a){k.cue.align="middle"}if(k.state="CUE",-1===l.indexOf("--\x3e")){k.cue.id=l;continue}case"CUE":try{h(l,k.cue,k.regionList)}catch(a){k.reportOrThrowError(a),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var o=-1!==l.indexOf("--\x3e");if(!l||o&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":l||(k.state="ID");continue}}}catch(a){k.reportOrThrowError(a),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new d(d.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=q},{}],2:[function(a,b,c){function d(a){return"string"==typeof a&&(!!h[a.toLowerCase()]&&a.toLowerCase())}function e(a){return"string"==typeof a&&(!!i[a.toLowerCase()]&&a.toLowerCase())}function f(a,b,c){this.hasBeenReset=!1;var f="",h=!1,i=a,j=b,k=c,l=null,m="",n=!0,o="auto",p="start",q="auto",r="auto",s=100,t="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return f},set:function(a){f=""+a}},pauseOnExit:{enumerable:!0,get:function(){return h},set:function(a){h=!!a}},startTime:{enumerable:!0,get:function(){return i},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");i=a,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return j},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");j=a,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return k},set:function(a){k=""+a,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(a){l=a,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(a){var b=d(a);if(!1===b)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");m=b,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return n},set:function(a){n=!!a,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return o},set:function(a){if("number"!=typeof a&&a!==g)throw new SyntaxError("Line: an invalid number or illegal string was specified.");o=a,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(a){var b=e(a);b?(p=b,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return q},set:function(a){if(a<0||a>100)throw new Error("Position must be between 0 and 100.");q=a,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return r},set:function(a){var b=e(a);b?(r=b,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return s},set:function(a){if(a<0||a>100)throw new Error("Size must be between 0 and 100.");s=a,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return t},set:function(a){var b=e(a);if(!b)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var g="auto",h={"":1,lr:1,rl:1},i={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};f.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=f},{}],3:[function(a,b,c){function d(a){return"string"==typeof a&&(!!g[a.toLowerCase()]&&a.toLowerCase())}function e(a){return"number"==typeof a&&a>=0&&a<=100}function f(){var a=100,b=3,c=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!e(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!e(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return c},set:function(a){if(!e(a))throw new Error("RegionAnchorY must be between 0 and 100.");c=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!e(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!e(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=d(a);!1===b?console.warn("Scroll: an invalid or illegal string was specified."):i=b}}})}var g={"":!0,up:!0};b.exports=f},{}],4:[function(a,b,c){(function(a){var c;c="undefined"!=typeof window?window:void 0!==a?a:"undefined"!=typeof self?self:{},b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b,c){var d=a("global/window"),e=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};d.vttjs=e,d.WebVTT=e.WebVTT;var f=e.VTTCue,g=e.VTTRegion,h=d.VTTCue,i=d.VTTRegion;e.shim=function(){d.VTTCue=f,d.VTTRegion=g},e.restore=function(){d.VTTCue=h,d.VTTRegion=i},d.VTTCue||e.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); |
163
dist/vtt.js
@@ -1,2 +0,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.vttjs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.vttjs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
/** | ||
@@ -62,3 +62,3 @@ * Copyright 2013 vtt.js Contributors | ||
var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); | ||
var m = input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/); | ||
if (!m) { | ||
@@ -196,3 +196,3 @@ return null; | ||
if (vals.length === 2) { | ||
settings.alt("lineAlign", vals[1], ["start", "middle", "end"]); | ||
settings.alt("lineAlign", vals[1], ["start", "center", "end"]); | ||
} | ||
@@ -204,3 +204,3 @@ break; | ||
if (vals.length === 2) { | ||
settings.alt("positionAlign", vals[1], ["start", "middle", "end"]); | ||
settings.alt("positionAlign", vals[1], ["start", "center", "end"]); | ||
} | ||
@@ -212,3 +212,3 @@ break; | ||
case "align": | ||
settings.alt(k, v, ["start", "middle", "end", "left", "right"]); | ||
settings.alt(k, v, ["start", "center", "end", "left", "right"]); | ||
break; | ||
@@ -221,18 +221,33 @@ } | ||
cue.vertical = settings.get("vertical", ""); | ||
cue.line = settings.get("line", "auto"); | ||
try { | ||
cue.line = settings.get("line", "auto"); | ||
} catch (e) {} | ||
cue.lineAlign = settings.get("lineAlign", "start"); | ||
cue.snapToLines = settings.get("snapToLines", true); | ||
cue.size = settings.get("size", 100); | ||
cue.align = settings.get("align", "middle"); | ||
cue.position = settings.get("position", { | ||
start: 0, | ||
left: 0, | ||
middle: 50, | ||
end: 100, | ||
right: 100 | ||
}, cue.align); | ||
// Safari still uses the old middle value and won't accept center | ||
try { | ||
cue.align = settings.get("align", "center"); | ||
} catch (e) { | ||
cue.align = settings.get("align", "middle"); | ||
} | ||
try { | ||
cue.position = settings.get("position", "auto"); | ||
} catch (e) { | ||
cue.position = settings.get("position", { | ||
start: 0, | ||
left: 0, | ||
center: 50, | ||
middle: 50, | ||
end: 100, | ||
right: 100 | ||
}, cue.align); | ||
} | ||
cue.positionAlign = settings.get("positionAlign", { | ||
start: "start", | ||
left: "start", | ||
middle: "middle", | ||
center: "center", | ||
middle: "center", | ||
end: "end", | ||
@@ -265,10 +280,3 @@ right: "end" | ||
var ESCAPE = { | ||
"&": "&", | ||
"<": "<", | ||
">": ">", | ||
"‎": "\u200e", | ||
"‏": "\u200f", | ||
" ": "\u00a0" | ||
}; | ||
var TEXTAREA_ELEMENT = window.document.createElement("textarea"); | ||
@@ -286,2 +294,15 @@ var TAG_NAME = { | ||
// 5.1 default text color | ||
// 5.2 default text background color is equivalent to text color with bg_ prefix | ||
var DEFAULT_COLOR_CLASS = { | ||
white: 'rgba(255,255,255,1)', | ||
lime: 'rgba(0,255,0,1)', | ||
cyan: 'rgba(0,255,255,1)', | ||
red: 'rgba(255,0,0,1)', | ||
yellow: 'rgba(255,255,0,1)', | ||
magenta: 'rgba(255,0,255,1)', | ||
blue: 'rgba(0,0,255,1)', | ||
black: 'rgba(0,0,0,1)' | ||
}; | ||
var TAG_ANNOTATION = { | ||
@@ -316,10 +337,6 @@ v: "title", | ||
// Unescape a string 's'. | ||
function unescape1(e) { | ||
return ESCAPE[e]; | ||
} | ||
function unescape(s) { | ||
while ((m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))) { | ||
s = s.replace(m[0], unescape1); | ||
} | ||
TEXTAREA_ELEMENT.innerHTML = s; | ||
s = TEXTAREA_ELEMENT.textContent; | ||
TEXTAREA_ELEMENT.textContent = ""; | ||
return s; | ||
@@ -340,3 +357,2 @@ } | ||
var element = window.document.createElement(tagName); | ||
element.localName = tagName; | ||
var name = TAG_ANNOTATION[type]; | ||
@@ -391,3 +407,18 @@ if (name && annotation) { | ||
if (m[2]) { | ||
node.className = m[2].substr(1).replace('.', ' '); | ||
var classes = m[2].split('.'); | ||
classes.forEach(function(cl) { | ||
var bgColor = /^bg_/.test(cl); | ||
// slice out `bg_` if it's a background color | ||
var colorName = bgColor ? cl.slice(3) : cl; | ||
if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) { | ||
var propName = bgColor ? 'background-color' : 'color'; | ||
var propValue = DEFAULT_COLOR_CLASS[colorName]; | ||
node.style[propName] = propValue; | ||
} | ||
}); | ||
node.className = classes.join(' '); | ||
} | ||
@@ -570,3 +601,3 @@ // Append the node to the current node, and enter the scope of the new | ||
// div. Note, all WebVTT cue-setting alignments are equivalent to the CSS | ||
// mirrors of them except "middle" which is "center" in CSS. | ||
// mirrors of them except middle instead of center on Safari. | ||
this.div = window.document.createElement("div"); | ||
@@ -596,3 +627,3 @@ styles = { | ||
break; | ||
case "middle": | ||
case "center": | ||
textPos = cue.position - (cue.size / 2); | ||
@@ -875,3 +906,3 @@ break; | ||
switch (cue.lineAlign) { | ||
case "middle": | ||
case "center": | ||
linePos -= (calculatedPercentage / 2); | ||
@@ -1237,2 +1268,8 @@ break; | ||
self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, ""); | ||
// Safari still uses the old middle value and won't accept center | ||
try { | ||
self.cue.align = "center"; | ||
} catch (e) { | ||
self.cue.align = "middle"; | ||
} | ||
self.state = "CUE"; | ||
@@ -1275,3 +1312,3 @@ // 30-39 - Check if self line contains an optional identifier or timing data. | ||
} | ||
self.cue.text += line; | ||
self.cue.text += line.replace(/\u2028/g, '\n').replace(/u2029/g, '\n'); | ||
continue; | ||
@@ -1351,6 +1388,9 @@ case "BADCUE": // BADCUE | ||
"start": 1, | ||
"middle": 1, | ||
"center": 1, | ||
"end": 1, | ||
"left": 1, | ||
"right": 1 | ||
"right": 1, | ||
"auto": 1, | ||
"line-left": 1, | ||
"line-right": 1 | ||
}; | ||
@@ -1400,6 +1440,6 @@ | ||
var _lineAlign = "start"; | ||
var _position = 50; | ||
var _positionAlign = "middle"; | ||
var _size = 50; | ||
var _align = "middle"; | ||
var _position = "auto"; | ||
var _positionAlign = "auto"; | ||
var _size = 100; | ||
var _align = "center"; | ||
@@ -1486,3 +1526,3 @@ Object.defineProperties(this, { | ||
if (setting === false) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
throw new SyntaxError("Vertical: an invalid or illegal direction string was specified."); | ||
} | ||
@@ -1512,3 +1552,3 @@ _vertical = setting; | ||
if (typeof value !== "number" && value !== autoKeyword) { | ||
throw new SyntaxError("An invalid number or illegal string was specified."); | ||
throw new SyntaxError("Line: an invalid number or illegal string was specified."); | ||
} | ||
@@ -1528,6 +1568,7 @@ _line = value; | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("lineAlign: an invalid or illegal string was specified."); | ||
} else { | ||
_lineAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
_lineAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
@@ -1558,6 +1599,7 @@ }, | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("positionAlign: an invalid or illegal string was specified."); | ||
} else { | ||
_positionAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
_positionAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
@@ -1588,3 +1630,3 @@ }, | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
throw new SyntaxError("align: an invalid or illegal alignment string was specified."); | ||
} | ||
@@ -1742,5 +1784,6 @@ _align = setting; | ||
if (setting === false) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("Scroll: an invalid or illegal string was specified."); | ||
} else { | ||
_scroll = setting; | ||
} | ||
_scroll = setting; | ||
} | ||
@@ -1755,12 +1798,16 @@ } | ||
(function (global){ | ||
var win; | ||
if (typeof window !== "undefined") { | ||
module.exports = window; | ||
win = window; | ||
} else if (typeof global !== "undefined") { | ||
module.exports = global; | ||
win = global; | ||
} else if (typeof self !== "undefined"){ | ||
module.exports = self; | ||
win = self; | ||
} else { | ||
module.exports = {}; | ||
win = {}; | ||
} | ||
module.exports = win; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
@@ -1820,2 +1867,2 @@ },{}],5:[function(require,module,exports){ | ||
},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5) | ||
}); | ||
}); |
@@ -1,2 +0,2 @@ | ||
/* videojs-vtt.js - v0.14.1 (https://github.com/gkatsev/vtt.js) built on 10-04-2018 */ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.vttjs=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function d(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function e(){this.values=q(null)}function f(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function g(a,b,g){function h(){var b=d(a);if(null===b)throw new c(c.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var c=new e;f(a,function(a,b){switch(a){case"region":for(var d=g.length-1;d>=0;d--)if(g[d].id===b){c.set(a,g[d].region);break}break;case"vertical":c.alt(a,b,["rl","lr"]);break;case"line":var e=b.split(","),f=e[0];c.integer(a,f),c.percent(a,f)?c.set("snapToLines",!1):null,c.alt(a,f,["auto"]),2===e.length&&c.alt("lineAlign",e[1],["start","middle","end"]);break;case"position":e=b.split(","),c.percent(a,e[0]),2===e.length&&c.alt("positionAlign",e[1],["start","middle","end"]);break;case"size":c.percent(a,b);break;case"align":c.alt(a,b,["start","middle","end","left","right"])}},/:/,/\s/),b.region=c.get("region",null),b.vertical=c.get("vertical",""),b.line=c.get("line","auto"),b.lineAlign=c.get("lineAlign","start"),b.snapToLines=c.get("snapToLines",!0),b.size=c.get("size",100),b.align=c.get("align","middle"),b.position=c.get("position",{start:0,left:0,middle:50,end:100,right:100},b.align),b.positionAlign=c.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"-->"!==a.substr(0,3))throw new c(c.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function h(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function e(a){return r[a]}function f(a){for(;o=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(o[0],e);return a}function g(a,b){return!u[b.localName]||u[b.localName]===a.localName}function h(b,c){var d=s[b];if(!d)return null;var e=a.document.createElement(d);e.localName=d;var f=t[b];return f&&c&&(e[f]=c.trim()),e}for(var i,j=a.document.createElement("div"),k=j,l=[];null!==(i=c());)if("<"!==i[0])k.appendChild(a.document.createTextNode(f(i)));else{if("/"===i[1]){l.length&&l[l.length-1]===i.substr(2).replace(">","")&&(l.pop(),k=k.parentNode);continue}var m,n=d(i.substr(1,i.length-2));if(n){m=a.document.createProcessingInstruction("timestamp",n),k.appendChild(m);continue}var o=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!o)continue;if(m=h(o[1],o[3]),!m)continue;if(!g(k,m))continue;o[2]&&(m.className=o[2].substr(1).replace("."," ")),l.push(o[1]),k.appendChild(m),k=m}return j}function i(a){for(var b=0;b<v.length;b++){var c=v[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function j(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),i(d))return"rtl";return"ltr"}function k(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function l(){}function m(a,b,c){l.call(this),this.cue=b,this.cueDiv=h(a,b.text);var d={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(d,this.cueDiv),this.div=a.document.createElement("div"),d={direction:j(this.cueDiv),writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(d),this.div.appendChild(this.cueDiv);var e=0;switch(b.positionAlign){case"start":e=b.position;break;case"middle":e=b.position-b.size/2;break;case"end":e=b.position-b.size}this.applyStyles(""===b.vertical?{left:this.formatStyle(e,"%"),width:this.formatStyle(b.size,"%")}:{top:this.formatStyle(e,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function n(a){var b,c,d,e;if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var f=(f=a.div.childNodes)&&(f=f[0])&&f.getClientRects&&f.getClientRects();a=a.div.getBoundingClientRect(),b=f?Math.max(f[0]&&f[0].height||0,a.height/f.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight}function o(a,b,c,d){function e(a,b){for(var e,f=new n(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new n(a),g=i),a=new n(f)}return e||f}var f=new n(b),g=b.cue,h=k(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var l=f.lineHeight,m=l*Math.round(h),o=c[j]+l,p=i[0];Math.abs(m)>o&&(m=0>m?-1:1,m*=Math.ceil(o/l)*l),0>h&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"middle":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new n(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function p(){}var q=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();c.prototype=q(Error.prototype),c.prototype.constructor=c,c.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},e.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){var c;return(c=b.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(b=parseFloat(b),b>=0&&100>=b)?(this.set(a,b),!0):!1}};var r={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},s={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},t={v:"title",lang:"lang"},u={rt:"ruby"},v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];l.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},l.prototype.formatStyle=function(a,b){return 0===a?0:a+b},m.prototype=q(l.prototype),m.prototype.constructor=m,n.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},n.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},n.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},n.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},n.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},n.prototype.intersectPercentage=function(a){var b=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),c=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),d=b*c;return d/(this.height*this.width)},n.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},n.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c};return e},p.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},p.convertCueToDOMTree=function(a,b){return a&&b?h(a,b):null};var w=.05,x="sans-serif",y="1.5%";p.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin=y,c.appendChild(e),d(b)){var f=[],g=n.getSimpleBoxPosition(e),h=Math.round(g.height*w*100)/100,i={font:h+"px "+x};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new m(a,d,i),e.appendChild(c.div),o(a,c,g,f),d.displayState=c.div,f.push(n.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},p.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},p.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof c))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function h(a){var b=new e;if(f(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var f=new e;if(f.percent("x",d[0]),f.percent("y",d[1]),!f.has("x")||!f.has("y"))break;b.set(a+"X",f.get("x")),b.set(a+"Y",f.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new e;f(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",d(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?f(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):f(a,function(a,b){switch(a){case"Region":h(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new c(c.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;if(k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,""),k.state="CUE",-1===l.indexOf("-->")){k.cue.id=l;continue}case"CUE":try{g(l,k.cue,k.regionList)}catch(o){k.reportOrThrowError(o),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var p=-1!==l.indexOf("-->");if(!l||p&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l;continue;case"BADCUE":l||(k.state="ID");continue}}}catch(o){k.reportOrThrowError(o),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new c(c.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=p},{}],2:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=g[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){if("string"!=typeof a)return!1;var b=h[a.toLowerCase()];return b?a.toLowerCase():!1}function e(a,b,e){this.hasBeenReset=!1;var g="",h=!1,i=a,j=b,k=e,l=null,m="",n=!0,o="auto",p="start",q=50,r="middle",s=50,t="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(a){g=""+a}},pauseOnExit:{enumerable:!0,get:function(){return h},set:function(a){h=!!a}},startTime:{enumerable:!0,get:function(){return i},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");i=a,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return j},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");j=a,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return k},set:function(a){k=""+a,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(a){l=a,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=b,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return n},set:function(a){n=!!a,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return o},set:function(a){if("number"!=typeof a&&a!==f)throw new SyntaxError("An invalid number or illegal string was specified.");o=a,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");p=b,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return q},set:function(a){if(0>a||a>100)throw new Error("Position must be between 0 and 100.");q=a,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return r},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");r=b,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return s},set:function(a){if(0>a||a>100)throw new Error("Size must be between 0 and 100.");s=a,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return t},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var f="auto",g={"":1,lr:1,rl:1},h={start:1,middle:1,end:1,left:1,right:1};e.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=e},{}],3:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=f[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){return"number"==typeof a&&a>=0&&100>=a}function e(){var a=100,b=3,e=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!d(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!d(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(a){if(!d(a))throw new Error("RegionAnchorY must be between 0 and 100.");e=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!d(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!d(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=b}}})}var f={"":!0,up:!0};b.exports=e},{}],4:[function(a,b){(function(a){b.exports="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b){var c=a("global/window"),d=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};c.vttjs=d,c.WebVTT=d.WebVTT;var e=d.VTTCue,f=d.VTTRegion,g=c.VTTCue,h=c.VTTRegion;d.shim=function(){c.VTTCue=e,c.VTTRegion=f},d.restore=function(){c.VTTCue=g,c.VTTRegion=h},c.VTTCue||d.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); | ||
/* videojs-vtt.js - v0.14.1 (https://github.com/videojs/vtt.js) built on 26-11-2019 */ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.vttjs=a()}}(function(){return function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){return e(b[g][1][a]||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}return a}()({1:[function(a,b,c){function d(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function e(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function f(){this.values=r(null)}function g(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function h(a,b,c){function h(){var b=e(a);if(null===b)throw new d(d.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var d=new f;g(a,function(a,b){switch(a){case"region":for(var e=c.length-1;e>=0;e--)if(c[e].id===b){d.set(a,c[e].region);break}break;case"vertical":d.alt(a,b,["rl","lr"]);break;case"line":var f=b.split(","),g=f[0];d.integer(a,g),d.percent(a,g)&&d.set("snapToLines",!1),d.alt(a,g,["auto"]),2===f.length&&d.alt("lineAlign",f[1],["start","center","end"]);break;case"position":f=b.split(","),d.percent(a,f[0]),2===f.length&&d.alt("positionAlign",f[1],["start","center","end"]);break;case"size":d.percent(a,b);break;case"align":d.alt(a,b,["start","center","end","left","right"])}},/:/,/\s/),b.region=d.get("region",null),b.vertical=d.get("vertical","");try{b.line=d.get("line","auto")}catch(a){}b.lineAlign=d.get("lineAlign","start"),b.snapToLines=d.get("snapToLines",!0),b.size=d.get("size",100);try{b.align=d.get("align","center")}catch(a){b.align=d.get("align","middle")}try{b.position=d.get("position","auto")}catch(a){b.position=d.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},b.align)}b.positionAlign=d.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"--\x3e"!==a.substr(0,3))throw new d(d.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function i(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function d(a){return s.innerHTML=a,a=s.textContent,s.textContent="",a}function f(a,b){return!w[b.localName]||w[b.localName]===a.localName}function g(b,c){var d=t[b];if(!d)return null;var e=a.document.createElement(d),f=v[b];return f&&c&&(e[f]=c.trim()),e}for(var h,i=a.document.createElement("div"),j=i,k=[];null!==(h=c());)if("<"!==h[0])j.appendChild(a.document.createTextNode(d(h)));else{if("/"===h[1]){k.length&&k[k.length-1]===h.substr(2).replace(">","")&&(k.pop(),j=j.parentNode);continue}var l,m=e(h.substr(1,h.length-2));if(m){l=a.document.createProcessingInstruction("timestamp",m),j.appendChild(l);continue}var n=h.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!n)continue;if(!(l=g(n[1],n[3])))continue;if(!f(j,l))continue;if(n[2]){var o=n[2].split(".");o.forEach(function(a){var b=/^bg_/.test(a),c=b?a.slice(3):a;if(u.hasOwnProperty(c)){var d=b?"background-color":"color",e=u[c];l.style[d]=e}}),l.className=o.join(" ")}k.push(n[1]),j.appendChild(l),j=l}return i}function j(a){for(var b=0;b<x.length;b++){var c=x[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function k(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),j(d))return"rtl";return"ltr"}function l(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function m(){}function n(a,b,c){m.call(this),this.cue=b,this.cueDiv=i(a,b.text);var d={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(d,this.cueDiv),this.div=a.document.createElement("div"),d={direction:k(this.cueDiv),writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(d),this.div.appendChild(this.cueDiv);var e=0;switch(b.positionAlign){case"start":e=b.position;break;case"center":e=b.position-b.size/2;break;case"end":e=b.position-b.size}""===b.vertical?this.applyStyles({left:this.formatStyle(e,"%"),width:this.formatStyle(b.size,"%")}):this.applyStyles({top:this.formatStyle(e,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function o(a){var b,c,d,e;if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var f=(f=a.div.childNodes)&&(f=f[0])&&f.getClientRects&&f.getClientRects();a=a.div.getBoundingClientRect(),b=f?Math.max(f[0]&&f[0].height||0,a.height/f.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight}function p(a,b,c,d){function e(a,b){for(var e,f=new o(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new o(a),g=i),a=new o(f)}return e||f}var f=new o(b),g=b.cue,h=l(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var k=f.lineHeight,m=k*Math.round(h),n=c[j]+k,p=i[0];Math.abs(m)>n&&(m=m<0?-1:1,m*=Math.ceil(n/k)*k),h<0&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"center":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new o(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function q(){}var r=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();d.prototype=r(Error.prototype),d.prototype.constructor=d,d.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},f.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){return!!(b.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(b=parseFloat(b))>=0&&b<=100)&&(this.set(a,b),!0)}};var s=window.document.createElement("textarea"),t={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},u={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},v={v:"title",lang:"lang"},w={rt:"ruby"},x=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];m.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},m.prototype.formatStyle=function(a,b){return 0===a?0:a+b},n.prototype=r(m.prototype),n.prototype.constructor=n,o.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},o.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},o.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},o.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},o.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},o.prototype.intersectPercentage=function(a){return Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left))*Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top))/(this.height*this.width)},o.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},o.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;return a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a,{left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c}},q.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},q.convertCueToDOMTree=function(a,b){return a&&b?i(a,b):null},q.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin="1.5%",c.appendChild(e),d(b)){var f=[],g=o.getSimpleBoxPosition(e),h=Math.round(.05*g.height*100)/100,i={font:h+"px sans-serif"};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new n(a,d,i),e.appendChild(c.div),p(a,c,g,f),d.displayState=c.div,f.push(o.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},q.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},q.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof d))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function c(a){var b=new f;if(g(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var e=new f;if(e.percent("x",d[0]),e.percent("y",d[1]),!e.has("x")||!e.has("y"))break;b.set(a+"X",e.get("x")),b.set(a+"Y",e.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new f;g(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",e(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?g(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):g(a,function(a,b){switch(a){case"Region":c(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new d(d.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,"");try{k.cue.align="center"}catch(a){k.cue.align="middle"}if(k.state="CUE",-1===l.indexOf("--\x3e")){k.cue.id=l;continue}case"CUE":try{h(l,k.cue,k.regionList)}catch(a){k.reportOrThrowError(a),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var o=-1!==l.indexOf("--\x3e");if(!l||o&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":l||(k.state="ID");continue}}}catch(a){k.reportOrThrowError(a),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new d(d.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=q},{}],2:[function(a,b,c){function d(a){return"string"==typeof a&&(!!h[a.toLowerCase()]&&a.toLowerCase())}function e(a){return"string"==typeof a&&(!!i[a.toLowerCase()]&&a.toLowerCase())}function f(a,b,c){this.hasBeenReset=!1;var f="",h=!1,i=a,j=b,k=c,l=null,m="",n=!0,o="auto",p="start",q="auto",r="auto",s=100,t="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return f},set:function(a){f=""+a}},pauseOnExit:{enumerable:!0,get:function(){return h},set:function(a){h=!!a}},startTime:{enumerable:!0,get:function(){return i},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");i=a,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return j},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");j=a,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return k},set:function(a){k=""+a,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(a){l=a,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(a){var b=d(a);if(!1===b)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");m=b,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return n},set:function(a){n=!!a,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return o},set:function(a){if("number"!=typeof a&&a!==g)throw new SyntaxError("Line: an invalid number or illegal string was specified.");o=a,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(a){var b=e(a);b?(p=b,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return q},set:function(a){if(a<0||a>100)throw new Error("Position must be between 0 and 100.");q=a,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return r},set:function(a){var b=e(a);b?(r=b,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return s},set:function(a){if(a<0||a>100)throw new Error("Size must be between 0 and 100.");s=a,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return t},set:function(a){var b=e(a);if(!b)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var g="auto",h={"":1,lr:1,rl:1},i={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};f.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=f},{}],3:[function(a,b,c){function d(a){return"string"==typeof a&&(!!g[a.toLowerCase()]&&a.toLowerCase())}function e(a){return"number"==typeof a&&a>=0&&a<=100}function f(){var a=100,b=3,c=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!e(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!e(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return c},set:function(a){if(!e(a))throw new Error("RegionAnchorY must be between 0 and 100.");c=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!e(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!e(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=d(a);!1===b?console.warn("Scroll: an invalid or illegal string was specified."):i=b}}})}var g={"":!0,up:!0};b.exports=f},{}],4:[function(a,b,c){(function(a){var c;c="undefined"!=typeof window?window:void 0!==a?a:"undefined"!=typeof self?self:{},b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b,c){var d=a("global/window"),e=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};d.vttjs=e,d.WebVTT=e.WebVTT;var f=e.VTTCue,g=e.VTTRegion,h=d.VTTCue,i=d.VTTRegion;e.shim=function(){d.VTTCue=f,d.VTTRegion=g},e.restore=function(){d.VTTCue=h,d.VTTRegion=i},d.VTTCue||e.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); |
107
lib/vtt.js
@@ -61,3 +61,3 @@ /** | ||
var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); | ||
var m = input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/); | ||
if (!m) { | ||
@@ -195,3 +195,3 @@ return null; | ||
if (vals.length === 2) { | ||
settings.alt("lineAlign", vals[1], ["start", "middle", "end"]); | ||
settings.alt("lineAlign", vals[1], ["start", "center", "end"]); | ||
} | ||
@@ -203,3 +203,3 @@ break; | ||
if (vals.length === 2) { | ||
settings.alt("positionAlign", vals[1], ["start", "middle", "end"]); | ||
settings.alt("positionAlign", vals[1], ["start", "center", "end"]); | ||
} | ||
@@ -211,3 +211,3 @@ break; | ||
case "align": | ||
settings.alt(k, v, ["start", "middle", "end", "left", "right"]); | ||
settings.alt(k, v, ["start", "center", "end", "left", "right"]); | ||
break; | ||
@@ -220,18 +220,33 @@ } | ||
cue.vertical = settings.get("vertical", ""); | ||
cue.line = settings.get("line", "auto"); | ||
try { | ||
cue.line = settings.get("line", "auto"); | ||
} catch (e) {} | ||
cue.lineAlign = settings.get("lineAlign", "start"); | ||
cue.snapToLines = settings.get("snapToLines", true); | ||
cue.size = settings.get("size", 100); | ||
cue.align = settings.get("align", "middle"); | ||
cue.position = settings.get("position", { | ||
start: 0, | ||
left: 0, | ||
middle: 50, | ||
end: 100, | ||
right: 100 | ||
}, cue.align); | ||
// Safari still uses the old middle value and won't accept center | ||
try { | ||
cue.align = settings.get("align", "center"); | ||
} catch (e) { | ||
cue.align = settings.get("align", "middle"); | ||
} | ||
try { | ||
cue.position = settings.get("position", "auto"); | ||
} catch (e) { | ||
cue.position = settings.get("position", { | ||
start: 0, | ||
left: 0, | ||
center: 50, | ||
middle: 50, | ||
end: 100, | ||
right: 100 | ||
}, cue.align); | ||
} | ||
cue.positionAlign = settings.get("positionAlign", { | ||
start: "start", | ||
left: "start", | ||
middle: "middle", | ||
center: "center", | ||
middle: "center", | ||
end: "end", | ||
@@ -264,10 +279,3 @@ right: "end" | ||
var ESCAPE = { | ||
"&": "&", | ||
"<": "<", | ||
">": ">", | ||
"‎": "\u200e", | ||
"‏": "\u200f", | ||
" ": "\u00a0" | ||
}; | ||
var TEXTAREA_ELEMENT = window.document.createElement("textarea"); | ||
@@ -285,2 +293,15 @@ var TAG_NAME = { | ||
// 5.1 default text color | ||
// 5.2 default text background color is equivalent to text color with bg_ prefix | ||
var DEFAULT_COLOR_CLASS = { | ||
white: 'rgba(255,255,255,1)', | ||
lime: 'rgba(0,255,0,1)', | ||
cyan: 'rgba(0,255,255,1)', | ||
red: 'rgba(255,0,0,1)', | ||
yellow: 'rgba(255,255,0,1)', | ||
magenta: 'rgba(255,0,255,1)', | ||
blue: 'rgba(0,0,255,1)', | ||
black: 'rgba(0,0,0,1)' | ||
}; | ||
var TAG_ANNOTATION = { | ||
@@ -315,10 +336,6 @@ v: "title", | ||
// Unescape a string 's'. | ||
function unescape1(e) { | ||
return ESCAPE[e]; | ||
} | ||
function unescape(s) { | ||
while ((m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))) { | ||
s = s.replace(m[0], unescape1); | ||
} | ||
TEXTAREA_ELEMENT.innerHTML = s; | ||
s = TEXTAREA_ELEMENT.textContent; | ||
TEXTAREA_ELEMENT.textContent = ""; | ||
return s; | ||
@@ -339,3 +356,2 @@ } | ||
var element = window.document.createElement(tagName); | ||
element.localName = tagName; | ||
var name = TAG_ANNOTATION[type]; | ||
@@ -390,3 +406,18 @@ if (name && annotation) { | ||
if (m[2]) { | ||
node.className = m[2].substr(1).replace('.', ' '); | ||
var classes = m[2].split('.'); | ||
classes.forEach(function(cl) { | ||
var bgColor = /^bg_/.test(cl); | ||
// slice out `bg_` if it's a background color | ||
var colorName = bgColor ? cl.slice(3) : cl; | ||
if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) { | ||
var propName = bgColor ? 'background-color' : 'color'; | ||
var propValue = DEFAULT_COLOR_CLASS[colorName]; | ||
node.style[propName] = propValue; | ||
} | ||
}); | ||
node.className = classes.join(' '); | ||
} | ||
@@ -569,3 +600,3 @@ // Append the node to the current node, and enter the scope of the new | ||
// div. Note, all WebVTT cue-setting alignments are equivalent to the CSS | ||
// mirrors of them except "middle" which is "center" in CSS. | ||
// mirrors of them except middle instead of center on Safari. | ||
this.div = window.document.createElement("div"); | ||
@@ -595,3 +626,3 @@ styles = { | ||
break; | ||
case "middle": | ||
case "center": | ||
textPos = cue.position - (cue.size / 2); | ||
@@ -874,3 +905,3 @@ break; | ||
switch (cue.lineAlign) { | ||
case "middle": | ||
case "center": | ||
linePos -= (calculatedPercentage / 2); | ||
@@ -1236,2 +1267,8 @@ break; | ||
self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, ""); | ||
// Safari still uses the old middle value and won't accept center | ||
try { | ||
self.cue.align = "center"; | ||
} catch (e) { | ||
self.cue.align = "middle"; | ||
} | ||
self.state = "CUE"; | ||
@@ -1274,3 +1311,3 @@ // 30-39 - Check if self line contains an optional identifier or timing data. | ||
} | ||
self.cue.text += line; | ||
self.cue.text += line.replace(/\u2028/g, '\n').replace(/u2029/g, '\n'); | ||
continue; | ||
@@ -1277,0 +1314,0 @@ case "BADCUE": // BADCUE |
@@ -25,6 +25,9 @@ /** | ||
"start": 1, | ||
"middle": 1, | ||
"center": 1, | ||
"end": 1, | ||
"left": 1, | ||
"right": 1 | ||
"right": 1, | ||
"auto": 1, | ||
"line-left": 1, | ||
"line-right": 1 | ||
}; | ||
@@ -74,6 +77,6 @@ | ||
var _lineAlign = "start"; | ||
var _position = 50; | ||
var _positionAlign = "middle"; | ||
var _size = 50; | ||
var _align = "middle"; | ||
var _position = "auto"; | ||
var _positionAlign = "auto"; | ||
var _size = 100; | ||
var _align = "center"; | ||
@@ -160,3 +163,3 @@ Object.defineProperties(this, { | ||
if (setting === false) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
throw new SyntaxError("Vertical: an invalid or illegal direction string was specified."); | ||
} | ||
@@ -186,3 +189,3 @@ _vertical = setting; | ||
if (typeof value !== "number" && value !== autoKeyword) { | ||
throw new SyntaxError("An invalid number or illegal string was specified."); | ||
throw new SyntaxError("Line: an invalid number or illegal string was specified."); | ||
} | ||
@@ -202,6 +205,7 @@ _line = value; | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("lineAlign: an invalid or illegal string was specified."); | ||
} else { | ||
_lineAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
_lineAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
@@ -232,6 +236,7 @@ }, | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("positionAlign: an invalid or illegal string was specified."); | ||
} else { | ||
_positionAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
_positionAlign = setting; | ||
this.hasBeenReset = true; | ||
} | ||
@@ -262,3 +267,3 @@ }, | ||
if (!setting) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
throw new SyntaxError("align: an invalid or illegal alignment string was specified."); | ||
} | ||
@@ -265,0 +270,0 @@ _align = setting; |
@@ -126,5 +126,6 @@ /** | ||
if (setting === false) { | ||
throw new SyntaxError("An invalid or illegal string was specified."); | ||
console.warn("Scroll: an invalid or illegal string was specified."); | ||
} else { | ||
_scroll = setting; | ||
} | ||
_scroll = setting; | ||
} | ||
@@ -131,0 +132,0 @@ } |
{ | ||
"author": "Andreas Gal <gal@mozilla.com>", | ||
"contributors": [ | ||
"Gary Katsevman <me@gkatsev.com>" | ||
], | ||
"name": "videojs-vtt.js", | ||
"description": "A JavaScript implementation of the WebVTT specification.", | ||
"version": "0.14.1", | ||
"description": "A JavaScript implementation of the WebVTT specification, forked from vtt.js for use with Video.js", | ||
"version": "0.15.0", | ||
"main": "lib/browser-index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gkatsev/vtt.js.git" | ||
"url": "https://github.com/videojs/vtt.js.git" | ||
}, | ||
"homepage": "https://github.com/gkatsev/vtt.js", | ||
"homepage": "https://github.com/videojs/vtt.js", | ||
"devDependencies": { | ||
@@ -59,6 +62,3 @@ "async": "0.9.0", | ||
}, | ||
"license": { | ||
"type": "Apache-2.0", | ||
"url": "https://github.com/gkatsev/vtt.js/blob/master/LICENSE" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
@@ -65,0 +65,0 @@ "global": "^4.3.1" |
120
README.md
@@ -1,13 +0,10 @@ | ||
vtt.js | ||
====== | ||
# videojs-vtt.js | ||
[comment]: # ([![Build Status](https://travis-ci.org/mozilla/vtt.js.svg?branch=master)](https://travis-ci.org/mozilla/vtt.js) [![npm-version](http://img.shields.io/npm/v/vtt.js.svg)](https://www.npmjs.org/package/vtt.js) [![Dependency Status](https://david-dm.org/mozilla/vtt.js.svg?theme=shields.io)](https://david-dm.org/mozilla/vtt.js) [![devDependency Status](https://david-dm.org/mozilla/vtt.js/dev-status.svg?theme=shields.io)](https://david-dm.org/mozilla/vtt.js#info=devDependencies)) | ||
[![npm-version](http://img.shields.io/npm/v/videojs-vtt.js.svg)](https://www.npmjs.org/package/videojs-vtt.js) [![Dependency Status](https://david-dm.org/videojs/vtt.js.svg?theme=shields.io)](https://david-dm.org/videojs/vtt.js) [![devDependency Status](https://david-dm.org/videojs/vtt.js/dev-status.svg?theme=shields.io)](https://david-dm.org/videojs/vtt.js#info=devDependencies) | ||
Implementation of the [WebVTT](https://developer.mozilla.org/en-US/docs/HTML/WebVTT) spec in JavaScript. Can be used | ||
in NodeJS, on the browser, and many other places. Mozilla uses this implementation for parsing and processing WebVTT | ||
files in Firefox/Gecko. | ||
Implementation of the [WebVTT](https://developer.mozilla.org/en-US/docs/HTML/WebVTT) spec in JavaScript. | ||
This is a fork of vttjs with some changes that are used by Video.js. | ||
This is a fork of [Mozilla's vtt.js](http://github.com/mozilla/vtt.js) (which is used for parsing and processing WebVTT files in Firefox/Gecko) with some changes that are used by [Video.js](http://github.com/videojs/video.js). | ||
##Table of Contents## | ||
## Table of Contents | ||
@@ -48,4 +45,3 @@ - [Spec Compliance](#spec-compliance) | ||
Spec Compliance | ||
=============== | ||
# Spec Compliance | ||
@@ -69,3 +65,3 @@ - [Parsing](http://dev.w3.org/html5/webvtt/#webvtt-file-format-parsing) (Completed) | ||
###Notes### | ||
## Notes | ||
@@ -77,6 +73,5 @@ Our processing model portion of the specification makes use of a custom property, `hasBeenReset`. It allows us to detect | ||
API | ||
=== | ||
# API | ||
####WebVTT.Parser#### | ||
## WebVTT.Parser | ||
@@ -103,3 +98,3 @@ The parser has a simple API: | ||
####parse(data)#### | ||
### parse(data) | ||
@@ -118,3 +113,3 @@ Hands data in some format to the parser for parsing. The passed data format | ||
####flush()#### | ||
### flush() | ||
@@ -124,3 +119,3 @@ Indicates that no more data is expected and will force the parser to parse any | ||
####onregion(region)#### | ||
### onregion(region) | ||
@@ -136,3 +131,3 @@ Callback that is invoked for every region that is correctly parsed. Returns a [VTTRegion](#http://dev.w3.org/html5/webvtt/#dfn-vttregion) | ||
####oncue(cue)#### | ||
### oncue(cue) | ||
@@ -148,3 +143,3 @@ Callback that is invoked for every cue that is fully parsed. In case of streaming parsing oncue is | ||
####onflush()#### | ||
### onflush() | ||
@@ -159,3 +154,3 @@ Is invoked in response to `flush()` and after the content was parsed completely. | ||
####onparsingerror(error)#### | ||
### onparsingerror(error) | ||
@@ -172,3 +167,3 @@ Is invoked when a parsing error has occured. This means that some part of the | ||
####ontimestampmap(timestampmap)#### | ||
### ontimestampmap(timestampmap) | ||
@@ -184,3 +179,3 @@ Is invoked when an `X-TIMESTAMP-MAP` metadata header ([defined here](https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5)) is parsed. This header maps WebVTT cue timestamps to MPEG-2 (PES) timestamps in other Renditions of the Variant Stream. | ||
####WebVTT.convertCueToDOMTree(window, cuetext)#### | ||
## WebVTT.convertCueToDOMTree(window, cuetext) | ||
@@ -195,3 +190,3 @@ Parses the cue text handed to it into a tree of DOM nodes that mirrors the internal WebVTT node structure of | ||
####WebVTT.processCues(window, cues, overlay)#### | ||
## WebVTT.processCues(window, cues, overlay) | ||
@@ -208,3 +203,3 @@ Converts the cuetext of the cues passed to it to DOM trees—by calling convertCueToDOMTree—and | ||
####ParsingError#### | ||
## ParsingError | ||
@@ -231,3 +226,3 @@ A custom JS error object that is reported through the | ||
####VTTCue#### | ||
## VTTCue | ||
@@ -245,11 +240,11 @@ A DOM shim for the VTTCue. See the [spec](http://dev.w3.org/html5/webvtt/#vttcue-interface) | ||
####Extended API#### | ||
### Extended API | ||
There is also an extended version of this shim that gives a few convenience methods | ||
for converting back and forth between JSON and VTTCues. If you'd like to use these | ||
methods then us `vttcue-extended.js` instead of `vttcue.js`. This isn't normally | ||
methods then use `vttcue-extended.js` instead of `vttcue.js`. This isn't normally | ||
built into the `vtt.js` distributable so you will have to build a custom distribution | ||
instead of using bower. | ||
####toJSON()#### | ||
#### toJSON() | ||
@@ -262,3 +257,3 @@ Converts a cue to JSON. | ||
####VTTCue.fromJSON(json)#### | ||
#### VTTCue.fromJSON(json) | ||
@@ -271,3 +266,3 @@ Create and initialize a VTTCue from JSON. | ||
####VTTCue.create(options)#### | ||
#### VTTCue.create(options) | ||
@@ -281,3 +276,3 @@ Initializes a VTTCue from an options object where the properties in the option | ||
####VTTRegion#### | ||
## VTTRegion | ||
@@ -292,3 +287,3 @@ A DOM shim for the VTTRegion. See the [spec](http://dev.w3.org/html5/webvtt/#vttregion-interface) | ||
####Extended API#### | ||
### Extended API | ||
@@ -301,3 +296,3 @@ There is also an extended version of this shim that gives a few convenience methods | ||
####VTTRegion.fromJSON(json)#### | ||
#### VTTRegion.fromJSON(json) | ||
@@ -310,3 +305,3 @@ Creates and initializes a VTTRegion from JSON. | ||
####VTTRegion.create(options)#### | ||
#### VTTRegion.create(options) | ||
@@ -320,4 +315,3 @@ Creates a VTTRegion from an options object where the properties on the options | ||
Browser | ||
======= | ||
# Browser | ||
@@ -329,3 +323,3 @@ In order to use the `vtt.js` in a browser, you need to get the built distribution of vtt.js. The distribution | ||
###Building Yourself### | ||
## Building Yourself | ||
@@ -349,3 +343,3 @@ Building a browser-ready version of the library is done using `grunt` (if you haven't installed | ||
###Bower### | ||
## Bower | ||
@@ -363,3 +357,3 @@ You can also get the a prebuilt distribution from [Bower](http://bower.io/). Either run the shell | ||
###Usage### | ||
## Usage | ||
@@ -398,8 +392,7 @@ To use `vtt.js` you can just include the script on an HTML page like so: | ||
Node | ||
==== | ||
# Node | ||
You have a couple of options if you'd like to run the library from Node. | ||
###vtt.js### | ||
## vtt.js | ||
@@ -438,3 +431,3 @@ `vtt.js` is on npm. Just do: | ||
###node-vtt### | ||
## node-vtt | ||
@@ -446,4 +439,3 @@ Use [node-vtt](https://github.com/mozilla/node-vtt). Node-vtt runs `vtt.js` on a PhantomJS page | ||
Developing vtt.js | ||
================= | ||
# Developing vtt.js | ||
@@ -458,5 +450,5 @@ A few things to note: | ||
####Tests#### | ||
## Tests | ||
Tests are written and run using [Mocha](http://visionmedia.github.io/mocha/) on node.js. | ||
Tests are written and run using [Mocha](https://mochajs.org/) on node.js. | ||
@@ -469,3 +461,3 @@ To run all the tests, do the following: | ||
If you want to run individual tests, you can install the [Mocha](http://visionmedia.github.io/mocha/) command-line | ||
If you want to run individual tests, you can install the [Mocha](https://mochajs.org/) command-line | ||
tool globally, and then run tests per-directory: | ||
@@ -479,5 +471,5 @@ | ||
See the [usage docs](http://visionmedia.github.io/mocha/#usage) for further usage info. | ||
See the [usage docs](https://mochajs.org/#usage) for further usage info. | ||
###Writing Tests### | ||
### Writing Tests | ||
@@ -488,15 +480,15 @@ Tests are done by comparing live parsed output to a last-known-good JSON file. The JSON files | ||
####TestRunner#### | ||
#### TestRunner | ||
There's a prebuilt API in place for testing different parts of `vtt.js`. Simply | ||
require the [TestRunner](https://github.com/mozilla/vtt.js/blob/master/tests/test-runner.js) | ||
require the [TestRunner](https://github.com/videojs/vtt.js/blob/master/tests/test-runner.js) | ||
module in the `lib` directory and start writing tests using `mocha`. See an example of a test file | ||
[here](https://github.com/mozilla/vtt.js/blob/master/tests/cue-settings/align/test.js) | ||
with its first test's WebVTT file [here](https://github.com/mozilla/vtt.js/blob/master/tests/cue-settings/align/bad-align.vtt) | ||
and its corresponding [parsing JSON file](https://github.com/mozilla/vtt.js/blob/master/tests/cue-settings/align/bad-align.json) | ||
and [processing JSON file](https://github.com/mozilla/vtt.js/blob/master/tests/cue-settings/align/bad-align-proc.json). | ||
You can also check out the [tests](https://github.com/mozilla/vtt.js/tree/master/tests) | ||
[here](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/test.js) | ||
with its first test's WebVTT file [here](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/bad-align.vtt) | ||
and its corresponding [parsing JSON file](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/bad-align.json) | ||
and [processing JSON file](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/bad-align-proc.json). | ||
You can also check out the [tests](https://github.com/videojs/vtt.js/tree/master/tests) | ||
directory for more examples on how to write tests. | ||
####jsonEqual(vttFile, jsonRefFile, message, onDone)#### | ||
#### jsonEqual(vttFile, jsonRefFile, message, onDone) | ||
@@ -507,3 +499,3 @@ First parses the WebVTT file as UTF8 and compares it to the reference JSON file | ||
####jsonEqualStreaming(vttFile, jsonRefFile, message, onDone)#### | ||
#### jsonEqualStreaming(vttFile, jsonRefFile, message, onDone) | ||
@@ -515,7 +507,7 @@ Simulates parsing the file while streaming by splitting the WebVTT file into | ||
####jsonEqualParsing(vttFile, jsonRefFile, message, onDone)#### | ||
#### jsonEqualParsing(vttFile, jsonRefFile, message, onDone) | ||
Runs `jsonEqual` and `jsonEqualStreaming` in one go. | ||
####jsonEqualProcModel(vttFile, jsonRefFile, message, onDone)#### | ||
#### jsonEqualProcModel(vttFile, jsonRefFile, message, onDone) | ||
@@ -525,3 +517,3 @@ Runs the processing model over the `VTTCues` and `VTTRegions` that are returned | ||
####jsonEqualAll(vttFile, jsonRefFile, message, onDone)#### | ||
#### jsonEqualAll(vttFile, jsonRefFile, message, onDone) | ||
@@ -534,3 +526,3 @@ Runs `jsonEqualParsing` and `jsonEqualProcModel`. Note that `jsonRefFile` should | ||
####jsonEqualAllNoStream(vttFile, jsonRefFile, message, onDone)#### | ||
#### jsonEqualAllNoStream(vttFile, jsonRefFile, message, onDone) | ||
@@ -541,3 +533,3 @@ Runs `jsonEqual` and `jsonEqualProcModel` use this if you want to do parsing | ||
###Grunt Run Task### | ||
## Grunt Run Task | ||
@@ -544,0 +536,0 @@ You can automatically generate a JSON file for a given `.vtt` file using the |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
243439
5134
564