// M24 Mod HTML5 0.8.9+ (http://M24.do.am)
var uppod_players;
var uppod_active_player_uid;
var uppodstyle = '';
function Uppod(loadvars) {
var _this = this;
var canvasObjs = [];
var vars;
var brw;
var ierr = '';
var ipad = false;
var iphone = false;
var android = false;
var opera = false;
var mobile = false;
var nativecontrols = false;
var ihtml5 = false;
var init = false;
var initevent = false;
var iplay = false;
var istart = false;
var ifull = false;
var irealfull = false;
var ihide = false;
var lastXY = 0;
var lastdXY = 0;
var ibuff = false;
var iover = false;
var istartevnt = false;
var iline = false;
var iloaded = false;
var igo = false;
var iwebkit = false;
var firefox = false;
var safari = false;
var chrome = false;
var itouch = false;
var nametip;
var name_txt;
var controls;
var youtubeElemId;
var youtubeIframe;
var mouseMoveCatcher;
var playlist;
var pl_mc;
var pl;
var plwidth;
var plheight;
var ipl;
var plbg;
var pltext;
var plplayed;
var plrandom;
var plpage = 0;
var v;
var vvv;
var muted;
var hideInterval;
var rmenu;
var timelength = 4;
var timeitems = 0;
var line_s;
var volbarline_s;
var lastTime = 0;
var ltc = 0;
var layer;
var player;
var uibg;
var uibg_gl;
var oo;
var play_b;
var pause_b;
var back_b;
var stop_b;
var start_b;
var time_play_b;
var time_back_b;
var time_all_b;
var volume_b;
var volume_mute_b;
var volbarline_b;
var volbarline_all_b;
var volbarline_play_b;
var volbar_b;
var volbars;
var sep_b;
var run_b;
var run_pos;
var runvolume_b;
var runvolume_pos;
var sep;
var download_b;
var next_b;
var prev_b;
var plnext_b;
var plprev_b;
var full_b;
var full_back_b;
var line_b;
var line_all_b;
var line_load_b;
var line_play_b;
var line_but_b;
var space_b;
var buffer_b;
var menu_b;
var playlist_b;
var hd_b;
var hdselect;
var hd1_b;
var sub_b;
var sub_text;
var sub_bg;
var sub;
var sub_lang = 0;
var sub_showed = false;
var sub_menu;
var sub_menu2;
var sub_menu_bg;
var isub_menu_color;
var isub_menu_bgcolor;
var sub_last;
var sub_lang_all = false;
var mybuts = [];
var cntrlength;
var cntrl;
var cntrls;
var cntrli;
var controls;
var browser = new Uppod.Browser();
var logo;
var uppod = {
_controls: null,
_mediaW: null,
_parentDom: null,
_ads: null,
iframe: {},
window: {},
document: {},
toolTipOn: function(domElment) {
domElment.onmouseover = function() {
ToolTip(domElment, domElment.title)
};
domElment.onmouseout = function() {
ToolTipHide(domElment)
}
},
createMediaW: function() {
this._mediaW = new Uppod.MediaW({
mode: vars.m,
vars: vars,
mobile: mobile,
ads: this.ads()
});
this._mediaW.onError.bind(function() {
onReady();
NotFound()
});
if (vars.hlsautoquality == 1) {
this._mediaW.onQuality.bind(function() {
onHlsQuality()
})
}
return this._mediaW
},
mediaW: function() {
return this._mediaW
},
controls: function() {
if (!this._controls) {
this._controls = new Uppod.Controls()
}
return this._controls
},
playerBodyElement: function() {
return body
},
parentDom: function() {
return this._parentDom
},
ads: function() {
if (!this._ads && Uppod.Ads) {
this._ads = new Uppod.Ads({
containerDom: uppod.document,
containerDiv: uppod.iframe,
uid: vars.uid,
playerDom: this.playerBodyElement().c,
prerollVast: CreateLink(vars.vast_preroll),
postrollVast: CreateLink(vars.vast_postroll),
pauserollVast: CreateLink(vars.vast_pauseroll),
midrollVast: CreateLink(vars.vast_midroll),
midrollTimes: CreateLink(vars.midroll_times),
adEachPlaylistItem: parseInt(vars.vast_pl) === 1,
pauseOnClick: parseInt(vars.vast_pauseonclick) === 1,
prerollPauseOnClick: parseInt(vars.vast_preroll_pauseonclick) === 1,
})
}
return this._ads
},
vars: function() {
return vars
},
toogleFullscreen: function() {
return Full.apply(this, arguments)
},
isFullscreen: function() {
return ifull
},
};
if (loadvars.uid) {
if (!uppod_players) {
uppod_players = []
}
this.uid = loadvars.id = loadvars.uid;
uppod_players.push(this)
};
if (document.getElementById(loadvars.id)) {
Init()
} else {
document.addEventListener('DOMContentLoaded', Init)
};
function createBody() {
body = new Shaper2({
w: vars.sw,
h: vars.sh,
bgc: vars.bodycolor,
brd: vars.brd,
brdc: vars.brdcolor,
h0: (vars.cntrlout == 1 ? vars.sh - vars.cntrloutheight : 0) - (vars.pl && vars.plplace == "bottom" ? vars.plth + 20 : 0),
a: (vars.transparent == 1 ? -1 : 1)
});
uppod.document.appendChild(body.c);
CSS(uppod.iframe, {
'-webkit-user-select': 'none',
'-khtml-user-select': 'none',
'-moz-user-select': 'none',
'-o-user-select': 'none',
'user-select': 'none',
'overflow': 'hidden',
'margin': '0px',
'padding': '0px',
'width': '100%',
'height': '100%',
});
CSS(body.c, {
'position': 'absolute',
'top': 0,
'left': 0
})
};
function createScreen() {
scrn = createElement('div');
body.c.appendChild(scrn);
CSS(scrn, {
'position': 'absolute',
'top': vars.padding,
'left': vars.padding,
'zIndex': 1
})
}
function createPlaylists() {
var iyt;
var stop = false;
if (vars.pl) {
if (typeof(vars.pl) == 'object') {
CreatePl()
};
if (typeof(vars.pl) == 'string') {
vars.pl_original = vars.pl;
var str;
if (vars.pl.indexOf("{") == 0) {
str = vars.pl;
str = str.replace(/'/g, '"')
} else {
if (vars.pl.indexOf("youtube:") == 0) {
if (vars.pl.indexOf('user_') == 8) {
vars.pl = 'https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=' + vars.pl.substr(13) + '&key=' + vars.ytapi
}
if (vars.pl.indexOf('search_') == 8) {
vars.pl = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=' + Ytpl(vars.pl.substr(15)) + '&maxResults=' + vars.ytpllimit + '&order=' + vars.ytplorder + '&relevanceLanguage=' + vars.lang + '&key=' + vars.ytapi
}
if (vars.pl.indexOf('pl_') == 8) {
vars.pl = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=' + vars.pl.substr(11) + '&maxResults=' + vars.ytpllimit + '&key=' + vars.ytapi
}
iyt = true
}
str = LoadFile(vars.pl)
};
if (str) {
if (str.indexOf('#') == 0) {
str = un(str)
};
try {
if (str.indexOf("\'") > -1) {
str = str.replace(/\\'/g, "'")
};
vars.pl = JSON.parse(str);
if (iyt) {
var obj = vars.pl;
var newobj = {};
newobj["playlist"] = [];
var i;
if (obj.error) {
if (obj.error.errors[0].reason == "keyInvalid") {}
} else {
if (obj.items[0].contentDetails) {
vars.pl = 'youtube:pl_' + obj.items[0].contentDetails.relatedPlaylists.uploads;
createPlaylists();
stop = true
} else {
if (obj.items.length > 0) {
for (i = 0; i < obj.items.length; i++) {
if (obj.items[i].snippet) {
newobj["playlist"][i] = new Object();
if (vars.pl_original.indexOf(":pl_") > 0) {
newobj["playlist"][i].file = 'http' + (vars.https == 1 ? 's' : '') + '://youtube.com/watch?v=' + obj.items[i].snippet.resourceId.videoId
}
if (vars.pl_original.indexOf(":search_") > 0) {
newobj["playlist"][i].file = 'http' + (vars.https == 1 ? 's' : '') + '://youtube.com/watch?v=' + obj.items[i].id.videoId
}
newobj["playlist"][i].poster = obj.items[i].snippet.thumbnails.default.url;
vars.ytposter == 1 ? newobj["playlist"][i].bigposter = obj.items[i].snippet.thumbnails.high.url : '';
newobj["playlist"][i].link = newobj["playlist"][i].file;
newobj["playlist"][i].comment = obj.items[i].snippet.title
}
}
vars.pl = newobj
}
}
}
}
vars.pl.playlist ? vars.pl = vars.pl.playlist : ''
} catch (err) {
console.log(err);
Alert(vars.lang2.errjson_decode + ' ' + Filename(vars.pl_original), true)
}
};
!stop ? CreatePl() : ''
};
if (vars.file == '') {
ipl = 0;
if (vars.random == 1) {
ipl = getRandomInt(0, pl.length - 1);
Opacity(plbg[0], vars.plalpha);
Opacity(plbg[ipl], vars.plalpha_play)
}
if (vars.pl[ipl].playlist) {
if (vars.pl[ipl].playlist[0].playlist) {
UpdatedVarsFromPlaylist(vars.pl[ipl].playlist[0].playlist[0])
} else {
UpdatedVarsFromPlaylist(vars.pl[ipl].playlist[0])
}
} else {
UpdatedVarsFromPlaylist(vars.pl[ipl])
}
}
}
};
function Ytpl(str) {
var myAmpPattern = / /g;
var itmp = str.split(' ').length;
for (var i = 0; i < itmp; i++) {
str = str.replace(myAmpPattern, "%20")
}
return str
}
function createAlert() {
alrt = createElement('div');
alrt.className = 'uppod-alert';
CSS(alrt, {
'width': '100%',
'position': 'absolute',
'top': vars.padding,
'left': vars.padding,
'color': '#' + ReColor(vars.commentcolor),
'zIndex': 3
});
body.c.appendChild(alrt);
vars.commentbgcolor.indexOf('|') == -1 ? vars.commentbgcolor = vars.commentbgcolor + '|' + vars.commentbgcolor : '';
alrt_bg = new Shaper2({
w: vars.sw - vars.padding * 2,
h: '20',
o: 0,
bgc: vars.commentbgcolor,
bga1: vars.commentbgalpha1,
bga2: vars.commentbgalpha2
});
alrt.appendChild(alrt_bg.c);
alrt_txt = createElement('div');
alrt.appendChild(alrt_txt);
CSS(alrt_txt, {
'position': 'absolute',
'top': 0,
'left': 0,
"paddingTop": (vars.commentmargin + vars.commenttopmargin),
"paddingLeft": (vars.commentmargin + 5),
"paddingBottom": (vars.commentmargin * 1.3),
"fontFamily": vars.namefont,
"fontSize": vars.namefontsize + 'px',
"fontStyle": FontStyle(vars.namefontstyle),
"fontWeight": FontWeight(vars.namefontstyle)
});
alrt_x = createElement('div');
alrt.appendChild(alrt_x);
CSS(alrt_x, {
'position': 'absolute',
'top': 0,
'right': 0,
"paddingTop": 5,
"paddingRight": 10,
"cursor": "pointer",
"color": "#" + vars.commentcolor
});
alrt_x.innerHTML = 'x';
alrt_x.onclick = CloseAlrt;
alrt.style.display = 'none';
disableSelection(alrt)
}
function createTip() {
if (vars.tip == 1) {
tip = createElement('div');
tip.className = 'uppod-tip';
uppod.iframe.appendChild(tip);
CSS(tip, {
'position': 'absolute',
'top': 0,
'left': 0,
"visibility": "hidden",
"color": "#" + ReColor(vars.tipfontcolor),
"borderRadius": vars.tipbgo / 2,
"fontFamily": vars.tipfont,
"fontSize": vars.tipfontsize,
"fontWeight": FontWeight(vars.namefontstyle),
"padding": "4px",
"lineHeight": "normal"
});
tip.style.zIndex = 9;
CheckGradiendDiv(tip, vars.tipbgcolor)
}
}
function CreateLink(x) {
if (x) {
x = x.replace(/\(referer\)/g, encodeURIComponent(vars.referer));
x = x.replace(/\(random\)/g, Math.random())
}
return x
}
function createComment() {
if (vars.comment != undefined && vars.comment != '' && vars.showname == 1) {
if (vars.shownameliketip == 1) {
CreateNameTip(vars.comment);
vars.shownameonover == 1 && vars.shownameonstop == 0 ? Hide(nametip) : ''
} else {
Alert(vars.comment, false)
}
}
};
function createIframe(afterCreateCallback) {
var _this = this;
uppod.iframe = createElement('div');
CSS(uppod.iframe, {
'position': 'relative',
'width': '100%',
'height': '100%',
'border': 'none'
});
if (vars.transparent == 0) {
CSS(uppod.iframe, {
'backgroundColor': '#' + ReColor(vars.bgcolor)
})
}
uppod.window = window;
uppod.document = uppod.iframe;
vars.stg.appendChild(uppod.iframe)
};
function createMouseMoveCatcher() {
mouseMoveCatcher = createElement('div');
mouseMoveCatcher.className = 'uppod-mouse-move-catcher';
CSS(mouseMoveCatcher, {
display: 'none',
'z-index': '103',
position: 'absolute',
top: '0px',
left: '0px',
width: '100%',
height: '100%'
});
body.c.appendChild(mouseMoveCatcher)
};
function createPlayer() {
createIframe();
createBody();
ScreenSize();
createScreen();
createPlaylists();
if (vars.file) {
if (vars.file && vars.hd) {
QualityLinks()
}
}
createAlert();
createComment();
createMouseMoveCatcher();
Logo();
Media();
Controls();
oRadius();
Events();
createTip();
if (ierr != '') {
Alert(ierr, true)
}
sizeInterval = setInterval(Sizing, 100)
}
var _onReadyOnce = false;
function onReady() {
if (!_onReadyOnce && loadvars.onReady) {
_onReadyOnce = true;
setTimeout(function() {
loadvars.onReady.call(_this, _this)
}, 50)
}
}
function initHtml5() {
vars.stg.innerHTML = '';
CSS(vars.stg, {
'lineHeight': '1',
'textAlign': 'left',
'text-align': 'left',
'-moz-user-select': '-moz-none',
'-o-user-select': 'none',
'-khtml-user-select': 'none',
'-webkit-user-select': 'none',
'user-select': 'none',
'overflow': 'hidden'
});
if (vars.transparent == 0) {
CSS(vars.stg, {
'backgroundColor': '#' + ReColor(vars.bgcolor)
})
}
createPlayer()
}
function initFlash() {
var params = {
allowFullScreen: "true",
allowScriptAccess: "always"
};
loadvars.file.replace("|", "or");
delete loadvars.st;
if (loadvars.stflash) {
loadvars.st = loadvars.stflash
}
new swfobject.embedSWF(vars.swf, vars.id, vars.sw, vars.sh, "10.0.0", false, loadvars, params);
onReady()
}
function Init() {
if (!loadvars.id) {
return
}
Detect();
vars = new Vars();
vars.uid = loadvars.uid;
vars.config.loader("RPRvDpvwTE5HTjLQDGvYXjAyBCMIXjJyRpL7RW1wTE5HTjLQDGvHcPoCRPe1mw4FBqMvdCmNxwJFmjgCm2tODNfFBC9vcUazcCsFBq1HOEAzdHi1d1S0mwLlRC5wmw9of2vvmaSQRjJFBCyCxUa6BC50D1S0mwLlRCsqSGazkWozRGsvOCmlmwtYDjgHRUsQPG8yJ3eCKE5NcUL7T2vzDjJFBC0ocPoaE2JFBCLTdEoDB118kjJFBCL9Kq1DRNtlB3ezD24FRUL7mwt0TPOlnjeDRt19PWoLdER1DwS0KE9lcpL7mwt0TPOlO1MmTCyNkWoHdWg9x3TFKEMLcjioXUL7KEBFK1oHPUL7mu1YXNOLmjMvB2JFDwt3ngOLR0t4mpsNPgMGOCoLcjizcCTmPjnNXpTNOCayK1oHPUL9kPOLTrtCDGbYkUsNiCvqcPo0cpL9RGhqcunlBUA9TUL7iCsCXwAlSCvmOC5vPpmzdHhzZ3nFcP19RNyCXNAlDW0CXw59xqiFiG5NnW1mO1YNcPy0nuJ9iG5NXwJFPpmyPpmzxqiFiG5YdW0McPyqcuJzZqfsxW1Hx2FFSpbzdWh7KWY1Xwf7KUyIcPyCXwylSCs1E2LTcW4oiW85dPs6PpTmO30qcuazZqsFcP19kP0qcunlKpA9PpTmOCL7Sph2dWnlKp5LcgYNXgYNcWoVcufsKW0Yx2a8SG5ax2aIcCL7iCsCXwylSCs2E2LTcW4oiUL7xpszkP19fUh4cpL7iG5GdW1mO3zmOq8CXNa9iWzmO1YNxqnlBH09PpTpPpm/iG5udWA6PpTmOqyCXwn9dtYNeLYNdqnleW0MxLYNPpm7iG5ynW1mO1YNdqnleu0CXwY6PpTmOqyCXw89iG53xqnlTH1HkUmySunySunyO3M8TwgCm3MzRNM2BPO8TPOymrOQTjtHTg9vkjOvDw5LRg9vkjLlRjt4W2R8tPOyJwtaKPOLB3e8T3OQDwT8m3TwkrtCDrOLRjLCRES0kreCTEt8DjtlR3eFkrSYDjL0kjtym2t8TPOymrOQTjtHTrMGBE5lREe8kjRQmNMCRERLmwtCkrtCDrbCD3eLB3ekDjLlK3MzDw5LmavJWJM8Dw9FTj1ySPMCREezmwtHTrevmwTLTrM1mwMYmw90RES0P3OLRNMqTjT8KE5zTARyBPSFkjLFTj1ySPMzDwL0UreoDut8TE5aRERzDwtakrtCDrbCD3eLB3ekR298TPOymwtaKPOLB3ekTjgCR2t0kjRvDrSLkrOLRjLCRES0P3byBPL8mjMvZPMwTE5HTjLQDNMHDjLHK3MCREezmwtHTg9HDjLHK3MCREezmwtHTrMCREezmwtHTg9LDwe8RE5aOC5qmjMzTpsNkpmzXuhyZ30zcfF=")
}
var body;
var scrn;
var alrt;
var tip;
function Comment() {
if (vars.comment != undefined && vars.comment != '' && vars.showname == 1) {
if (vars.shownameliketip == 1) {
NameTip((vars.marquee == 1 ? '' : ''))
} else {
Alert((vars.marquee == 1 ? '' : ''), false)
}
} else {
Hide(alrt)
}
}
function Detect() {
brw = navigator.userAgent.toLowerCase();
if ("ontouchstart" in document.documentElement) {
itouch = true
}
if (brw.indexOf("ipad") > 0 || brw.indexOf("iphone") > 0) {
brw.indexOf("iphone") > 0 ? iphone = true : '';
ipad = true;
mobile = true
} else {
if (brw.indexOf("webkit") > -1) {
iwebkit = true
}
if (brw.indexOf("firefox") > -1) {
firefox = true
}
if (brw.indexOf("android") > -1) {
android = true;
mobile = true
}
if (brw.indexOf("chrome") > -1) {
chrome = true
}
if (brw.indexOf("opera") > -1) {
opera = true
}
}
if (navigator.vendor) {
if (navigator.vendor.indexOf("Apple") > -1) {
safari = true
}
}
ihtml5 = !!document.createElement('canvas').getContext;
ihtml5 ? ihtml5 = !!document.createElement('video').canPlayType : '';
if (loadvars) {
if (loadvars.file) {
var tmp = loadvars.file;
if (tmp.indexOf('#') == 0) {
tmp = un(tmp)
}
if (tmp.indexOf(".flv") > 0) {
ihtml5 = false
}
}
}
}
function Alert(str, x) {
if (alrt) {
Show(alrt);
alrt_txt.innerHTML = str;
CSS(alrt_bg.canvas, {
'height': alrt_txt.offsetHeight,
'width': (vars.sw - vars.padding * 2)
});
if (x) {
Show(alrt_x)
} else {
Hide(alrt_x)
}
} else {
alert('Uppod HTML5: ' + str)
}
}
function CloseAlrt() {
Hide(alrt)
}
function CreateNameTip(str) {
nametip = createElement('div');
CSS(nametip, {
'width': '100%',
'position': 'absolute',
'top': 5 + vars.namemargin_v + vars.padding,
'left': 5 + vars.namemargin_h + vars.padding,
'color': '#' + ReColor(vars.namecolor)
});
body.c.appendChild(nametip);
name_txt = createElement('div');
nametip.appendChild(name_txt);
CSS(name_txt, {
'position': 'absolute',
'top': 0,
'left': 0,
'padding': vars.namepadding / 2 + 'px ' + vars.namepadding + 'px',
"fontFamily": vars.namefont,
"fontSize": vars.namefontsize + 'px',
"fontStyle": FontStyle(vars.namefontstyle),
"fontWeight": FontWeight(vars.namefontstyle),
'zIndex': 2
});
name_txt.innerHTML = (vars.marquee == 1 ? '' : '');
var name_bg = new Shaper2({
w: name_txt.offsetWidth,
h: name_txt.offsetHeight,
o: vars.namebgo / 2,
bgc: vars.namebgcolor + '|' + vars.namebgcolor,
bga1: vars.namebgalpha,
bga2: vars.namebgalpha
});
nametip.appendChild(name_bg.c);
CSS(name_bg.canvas, {
'zIndex': 1
})
};
function NameTip(str) {
name_txt.innerHTML = str
};
function Logo(str) {
if (vars.logo != '') {
logo = document.createElement('img');
logo.src = vars.logo;
logo.onload = PositionLogo;
uppod.document.appendChild(logo);
Opacity(logo, vars.logoalpha);
if (vars.logopause == 0 && !iplay) {
Hide(logo)
}
if (vars.logolink != '') {
logo.onmouseover = function(e) {
Opacity(logo, 1)
};
logo.onmouseout = function(e) {
Opacity(logo, vars.logoalpha)
};
logo.onclick = function(e) {
window.open(vars.logolink, vars.logotarget)
}
};
PositionLogo();
if (vars.logohide) {
setTimeout(function() {
CSS(logo, {
'visibility': 'hidden'
})
}, vars.logohide * 1000)
}
}
};
function PositionLogo() {
if (vars.logoplace == 1) {
CSS(logo, {
'cursor': 'pointer',
'position': 'absolute',
'top': vars.logomargin_v,
'left': vars.logomargin_h
})
}
if (vars.logoplace == 2) {
CSS(logo, {
'cursor': 'pointer',
'position': 'absolute',
'top': vars.logomargin_v,
'right': vars.logomargin_h
})
}
if (vars.logoplace == 3) {
CSS(logo, {
'cursor': 'pointer',
'position': 'absolute',
'bottom': (vars.logomargin_v + (vars.cntrlout == 0 ? vars.cntrloutheight : 0)),
'left': vars.logomargin_h
})
}
if (vars.logoplace == 4) {
CSS(logo, {
'cursor': 'pointer',
'position': 'absolute',
'bottom': (vars.logomargin_v + (vars.cntrlout == 0 ? vars.cntrloutheight : 0)),
'right': vars.logomargin_h
})
}
}
function Events() {
if (!mobile && vars.hotkey == 1 && vars.m == "video") {
body.c.addEventListener("dblclick", function() {
!ifull ? Full() : FullOff()
})
}
body.c.onmousemove = MouseMove;
body.c.onmouseup = function MouseUp(e) {
volbarline_b ? volbarline_s['active'] = false : '';
line_b ? line_s['active'] = false : ''
};
body.c.onmouseover = function MouseOver(event) {
iover = true;
vars.shownameonover == 1 ? Show(nametip) : ''
};
body.c.onmouseout = function MouseOut(event) {
iover = false;
if (vars.cntrlhide == 1 || (ifull && vars.fullcntrlhide == 1)) {
clearInterval(hideInterval);
hideInterval = setInterval(CntrlHide, 3000)
}
vars.shownameonover == 1 && ((vars.shownameonstop == 1 && iplay) || vars.shownameonstop == 0) ? Hide(nametip) : ''
};
var rightMenu = 'Music 24 mod HTML5
0.8.9+';
if (rightMenu != 'native') {
body.c.oncontextmenu = function ContextMenu(e) {
if (!e) var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
var x = e.pageX - findLeft(vars.stg);
var y = e.pageY - findTop(vars.stg);
if (rmenu) {
CSS(rmenu, {
"display": "block",
"position": "absolute",
"top": y,
"left": x
})
} else {
rmenu = createElement('div');
rmenu.id = "rmenu";
uppod.document.appendChild(rmenu);
var rmenu1 = createElement('div');
rmenu.appendChild(rmenu1);
rmenu1.innerHTML = rightMenu;
CSS(rmenu, {
"borderRadius": "0px",
"cursor": "pointer",
"position": "absolute",
"top": y,
"left": x,
"backgroundColor": "#000",
"color": "#fff",
"borderStyle": "solid",
"borderColor": "#000000",
"borderWidth": "1px",
"padding": "2px 5px 3px 5px",
"font": "9px Tahoma",
"opacity": "1"
});
rmenu.style.zIndex = 999
}
setTimeout(function() {
document.getElementById("rmenu").style.display = "none"
}, 1000);
return false
}
}
document.addEventListener("click", DocClick)
}
function MouseMove(event) {
if (ihide) {
lastdXY = lastXY - (event.clientX + event.clientY);
if (lastdXY != 0) {
CntrlShow();
if (vars.cntrlhide == 1 || (ifull && vars.fullcntrlhide == 1)) {
clearInterval(hideInterval);
hideInterval = setInterval(CntrlHide, 3000)
}
}
}
lastXY = event.clientX + event.clientY
}
function DocClick(e) {
if (rmenu) {
Hide(rmenu)
}
}
function KeyHandler(event) {
if (uppod_active_player_uid == vars.uid) {
if (event.target.tagName.toLowerCase() == 'input' || event.target.tagName.toLowerCase() == 'textarea') {
return
}
var keyCode = event.which;
if (keyCode == undefined) {
keyCode = event.keyCode
}
if (ifull && keyCode == 27) {
FullOff()
}
if (keyCode == 38) {
if (media) {
event.preventDefault();
(media.volume + 0.1) < 1 ? media.volume += 0.1 : media.volume = 1
}
}
if (keyCode == 40) {
if (media) {
event.preventDefault();
(media.volume - 0.1) > 0 ? media.volume -= 0.1 : media.volume = 0
}
}
if (keyCode == 39) {
if (media && Duration() > 0) {
var t = line_all_b.w / Duration();
if (line_play_b.offsetWidth + t * vars.keyseek < line_all_b.w) {
Seek(line_play_b.offsetWidth + t * vars.keyseek)
} else {
Seek(line_all_b.w)
}
}
}
if (keyCode == 37) {
if (media && Duration() > 0) {
var t = line_all_b.w / Duration();
if (line_play_b.offsetWidth - t * vars.keyseek > 0) {
Seek(line_play_b.offsetWidth - t * vars.keyseek)
} else {
Seek(0)
}
}
}
if (keyCode == 68) {
Mute()
}
if (keyCode == 70) {
!ifull ? Full() : FullOff()
}
if (vars.hotkey == 1 && keyCode == 32) {
event.preventDefault();
Toggle()
}
}
}
var o11;
var o12;
var o21;
var o22;
var media_mc;
var poster_mc;
var media;
var media_yt;
var playInterval;
function DestroyMedia() {
if (media) {
if (uppod.mediaW()) {
uppod.mediaW().destroy()
}
if (playInterval) {
clearInterval(playInterval);
media.removeEventListener('play', OnPlay, false);
media.removeEventListener('pause', OnPause, false);
media.removeEventListener('canplay', onCanPlay, false);
media.removeEventListener('volumechange', OnVolume, false)
}
or = [];
ori = 0;
vars.hls_quality = false;
if (isYoutube()) {
media_yt.stopVideo();
delete media_yt;
var element = document.getElementById('yt_media_' + vars.uid);
element.parentNode.removeChild(element);
vars.youtube = false;
vars.youtube_quality_received = false;
!ifull && layer ? Show(layer) : ''
} else {
media.pause();
media.src = '';
media_mc.removeChild(media)
}
delete media;
media = undefined;
vars.events = new Array();
if (line_b) {
CSS(line_play_b, {
'width': '0'
});
CSS(line_load_b, {
'width': '0'
})
}
igo = false;
init = false;
iplay = false;
startX = 0
}
}
function Media() {
DestroyMedia();
vars.config.loader("RPRvDpvwTE5HTjLQDGvYXjAyBCMIXjJyRpL7RW1wTE5HTjLQDGvHcPoCRPe1mw4sBC50D1S0mwLlRCsqSGL9x2LwcpANOC5CRPbyBESLcp9ZXCMWTrOzDwmzcPo3KjLyRUvHXU0zZ2eDBC50D1S0mwLlRCvvct09K1oHPPM8BC50D1S0mwLlRCvvcP1IdtowTE5HTjLQDGvLcPoCRPe1mw4sRgoLPP1Tx2J9RNtlB3ezD24FcPoCRPe1mw4NPgM3cCT9x2i9iP07T2vzDjJFBC0ocPozRGvIE2STcPoYdPhlmwtYDjgHRUvlRPmsJwtNePvYcpTmPjnNc2JFBCaIO1MmBGmyO2mNcUMIE2STcP19mwt0TPOlnrb9cpm3cpAMcPyMdWslSGvmOqemOCa7iGsMXromOqSmOqzmOqtmOCMmOqLmOqzmO2gmOCMmO2RmOqFYXgYNRtYNxHb9cWoGXwiFiUa7iU5NdEe9OCYMSCYMSCYNkj1LRjLvP21HkASWJ3MGBESIR3OQTE5af29yD3O8RjL2kreCBE5qmjgCRE50kjSCREg0RJtyRE1LDNe8KER8Rj9HTE1LDNe8mj9qKPezD258BEOqD2M1Tjt8m2SCDNMvmrbLDweuKjLyRrMJD2TNDjt8Tj9YkjMLRNe8D25HDjLHKCmlm3byKPfFO3YNcUYYXro9cUac");
if (vars.file.indexOf('youtube.com/') > -1 || vars.file.indexOf('youtu.be/') > -1) {
if (vars.file.indexOf('youtu.be/') > -1) {
vars.youtube_id = vars.file.substr(vars.file.indexOf(".be/") + 4);
vars.youtube_id.replace("/", "")
} else {
vars.youtube_id = vars.file.split(/(youtu.be\/|v\/|embed\/|watch\?|youtube.com\/user\/[^#]*#([^\/]*?\/)*)\??v?=?([^#\&\?]*)/)[3]
}
if (vars.youtube_id.length == 11) {
vars.youtube = true
}
}
if (vars.hls_quality && vars.hlsautoquality == 1) {
vars.hd = '';
vars.hda = vars.hd.split(',');
vars.quality = null;
HdSelect()
}
if (vars.youtube) {
if (isYoutubeApiLoaded()) {
YoutubeInit()
} else {
uppod.window.onYouTubeIframeAPIReady = function() {
for (var i = 0; i < uppod_players.length; i++) {
if (uppod_players[i].isYoutube()) {
uppod_players[i].YoutubeInit()
}
}
};
var youTubeScript = document.createElement('script');
youTubeScript.src = "https://www.youtube.com/iframe_api";
body.c.appendChild(youTubeScript)
}
vars.youtube_created = true
} else {
if (vars.youtube_created && hd_b) {
vars.hd = '';
vars.hda = vars.hd.split(',');
vars.quality = null;
HdSelect()
}
media = uppod.createMediaW().dom;
media.addEventListener('canplay', onCanPlay);
media.addEventListener('play', OnPlay);
media.addEventListener('pause', OnPause);
media.setAttribute("onplay", OnPlay);
uppod.mediaW().onEnded.bind(OnEnded);
media_mc.appendChild(media);
CSS(media_mc, {
'width': vars.sw - (!ifull ? vars.padding * 2 : 0) + 'px'
});
media.setAttribute('width', '100%');
media.setAttribute('height', (!ifull ? vars.ph : vars.sh) - (!ifull ? vars.padding * 2 : 0) - (vars.cntrlout == 1 ? vars.cntrloutheight : 0) + 'px');
media.setAttribute('x-webkit-airplay', 'allow');
media.setAttribute('webkit-playsinline', '1');
media.controls = false;
CSS(media, {
'position': 'absolute',
'top': 0,
'left': 0
});
if (vars.scale == "width") {
CSS(media, {
'object-fit': 'cover'
})
}
if (vars.scale == "stretch") {
CSS(media, {
'object-fit': 'fill'
})
}
if (vars.m == 'audio') {
CSS(media, {
'width': '0px',
'height': '0px'
})
}
if (browser.isOpera && vars.auto == "firstframe") {
vars.auto = "none"
}
if (vars.auto == "none" || vars.radio == 1) {
if (vars.radio == 1 && vars.radiodropcache == 1 && vars.file) {
if (vars.file.indexOf('?') > 0) {
vars.file = vars.file + '&' + getRandomInt(1, 100)
} else {
vars.file = vars.file + '?' + getRandomInt(1, 100)
}
}
} else {
if (vars.auto == 'load') {
media.preload = 'auto'
} else {
media.preload = 'metadata'
}
}
if (vars.auto != 'none') {
Source()
}
if (vars.auto == 'play') {
uppod.mediaW().play()
}
setTimeout(checkStart, 100)
}
if (vars.screenposter != '') {
vars.screenposter = CheckBase64(vars.screenposter);
CSS(scrn, {
'width': vars.sw,
'height': vars.sh,
'background': 'url("' + vars.screenposter + '") no-repeat center center',
'background-size': 'cover'
})
}
if (vars.poster != '') {
function createPosterHtml() {
if (vars.m == 'audio') {
return true
}
if (vars.fillposter == 1) {
return true
}
if (vars.youtube) {
if (browser.restrictMediaPlay == false) {
return true
}
} else {
if (browser.hasMediaPosterShown == false) {
return true
}
}
return false
}
if (createPosterHtml()) {
if (!poster_mc) {
poster_mc = createElement('div');
poster_mc.className = 'uppod-poster';
scrn.appendChild(poster_mc)
}
vars.poster = CheckBase64(vars.poster);
CSS(poster_mc, {
'position': 'absolute',
'left': 0,
'top': 0,
'width': vars.sw,
'height': vars.ph - vars.padding * 2 - (vars.cntrlout == 1 ? vars.cntrloutheight : 0),
'background': 'url("' + vars.poster + '") no-repeat center center',
'background-size': 'cover',
'pointerEvents': 'none'
})
} else {
if (media) {
media.setAttribute('poster', vars.poster)
}
ifull && playlist ? Resize() : ''
}
}
if (vars.m == 'video' && (mobile || itouch) && media) {
media.ontouchstart = ClickScreenMobile
}
if (!layer) {
Layer();
isYoutube() ? Hide(layer) : ''
}
}
function ClickScreenMobile() {
if (!nativecontrols) {
var hide = vars.cntrlhide == 1 && !vars.controls_active && vars.cntrlout == 0;
var fullHide = ifull && !vars.controls_active && vars.fullcntrlhide == 1;
if (hide || fullHide) {
CntrlShow();
clearInterval(hideInterval);
hideInterval = setInterval(CntrlHide, 3000)
}
}
}
function Layer() {
if (layer) {
Remove('layer')
}
layer = createElement('div');
layer.setAttribute('id', 'layer');
body.c.appendChild(layer);
CSS(layer, {
'width': '100%',
'height': scrn.offsetHeight,
'position': 'absolute',
'top': 0,
'left': 0,
'zIndex': 2
});
layer.onclick = LayerClick;
layer.style.zIndex = 2;
alrt.style.zIndex = 3;
nametip ? nametip.style.zIndex = 4 : '';
controls ? controls.style.zIndex = 5 : '';
logo ? logo.style.zIndex = 6 : ''
}
function LayerClick() {
if (vars.redirect != '' && vars.redirect_click == 1) {
window.open(vars.redirect, vars.redirecttarget)
} else {
if (vars.m == 'video') {
Toggle();
if (nativecontrols) {
Remove('layer')
}
}
}
}
function oRadius() {
if (vars.o > 0) {
oo = createElement('div');
o11 = document.createElement('canvas');
var ratio = 1;
var ctx = o11.getContext("2d");
if (ctx.webkitBackingStorePixelRatio < 2) {
var ratio = window.devicePixelRatio || 1
}
o11.height = vars.o * ratio;
o11.width = vars.o * ratio;
ctx.fillStyle = '#' + ReColor(vars.bgcolor);
ctx.beginPath();
ctx.scale(ratio, ratio);
ctx.moveTo(0, 0);
ctx.lineTo(vars.o / 2, 0);
ctx.quadraticCurveTo(0, 0, 0, vars.o / 2);
ctx.closePath();
ctx.fill();
oo.appendChild(o11);
o12 = document.createElement('canvas');
var ctx = o12.getContext("2d");
o12.height = vars.o * ratio;
o12.width = vars.o * ratio;
ctx.fillStyle = '#' + ReColor(vars.bgcolor);
ctx.beginPath();
ctx.scale(ratio, ratio);
ctx.moveTo(0, 0);
ctx.quadraticCurveTo(vars.o / 2, 0, vars.o / 2, vars.o / 2);
ctx.lineTo(vars.o / 2, 0);
ctx.closePath();
ctx.fill();
oo.appendChild(o12);
o22 = document.createElement('canvas');
var ctx = o22.getContext("2d");
o22.height = vars.o * ratio;
o22.width = vars.o * ratio;
ctx.fillStyle = '#' + ReColor(vars.bgcolor);
ctx.beginPath();
ctx.scale(ratio, ratio);
ctx.moveTo(vars.o / 2, 0);
ctx.quadraticCurveTo(vars.o / 2, vars.o / 2, 0, vars.o / 2);
ctx.lineTo(vars.o / 2, vars.o / 2);
ctx.closePath();
ctx.fill();
oo.appendChild(o22);
o21 = document.createElement('canvas');
var ctx = o21.getContext("2d");
o21.height = vars.o * ratio;
o21.width = vars.o * ratio;
ctx.fillStyle = '#' + ReColor(vars.bgcolor);
ctx.beginPath();
ctx.scale(ratio, ratio);
ctx.moveTo(0, 0);
ctx.quadraticCurveTo(0, vars.o / 2, vars.o / 2, vars.o / 2);
ctx.lineTo(0, vars.o / 2);
ctx.closePath();
ctx.fill();
oo.appendChild(o21);
body.c.appendChild(oo);
CSS(oo, {
'z-index': 7,
'position': 'absolute',
'top': 0,
'left': 0,
'pointer-events': 'none',
'height': 'auto',
'overflow': 'hidden',
'width': '100%',
'height': '100%'
});
oo.style.zIndex = 7;
oPos()
}
}
function oPos() {
CSS(o11, {
'position': 'absolute',
'top': 0,
'left': 0,
'width': vars.o + 'px',
'height': vars.o + 'px'
});
CSS(o12, {
'position': 'absolute',
'top': 0,
'left': Math.round(vars.sw - vars.o / 2),
'width': vars.o + 'px',
'height': vars.o + 'px'
});
CSS(o22, {
'position': 'absolute',
'top': Math.round(vars.sh - vars.o / 2),
'left': Math.round(vars.sw - vars.o / 2),
'width': vars.o + 'px',
'height': vars.o + 'px'
});
CSS(o21, {
'position': 'absolute',
'top': Math.round(vars.sh - vars.o / 2),
'left': 0,
'width': vars.o + 'px',
'height': vars.o + 'px'
})
}
function Source() {
if (vars.file != '') {
if (vars.file.indexOf(' or ') > -1) {
vars.or = vars.file.split(' or ');
for (var i = 0; i < vars.or.length; i++) {
if (vars.or[i].indexOf(" and ") > -1) {
var _urls_and = vars.or[i].split(" and ");
vars.or[i] = _urls_and[getRandomInt(0, _urls_and.length - 1)]
}
}
vars.ori = 0;
vars.file = vars.or[0]
} else {
if (vars.file.indexOf(" and ") > -1) {
var _urls_and = vars.file.split(" and ");
vars.file = _urls_and[getRandomInt(0, _urls_and.length - 1)]
}
}
}
uppod.mediaW().setSources(vars.file)
}
function CreatePl() {
playlist = createElement('div');
playlist.className = 'uppod-playlist';
pl_mc = createElement('div');
playlist.appendChild(pl_mc);
if (!mobile && vars.hotkey == 1 && vars.m == "video") {
playlist.addEventListener("dblclick", function(event) {
event.stopPropagation()
})
}
pl = new Array();
plbg = new Array();
pltext = new Array();
plplayed = new Array();
plrandom = new Array();
var droprow = 0;
for (i = 0; i < vars.pl.length; i++) {
pl[i] = createElement('div');
pl_mc.appendChild(pl[i]);
CSS(pl[i], {
'cursor': 'pointer',
'color': '#' + ReColor(vars.plcolor),
'width': vars.pltw,
'height': vars.plth
});
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
CSS(pl[i], {
'position': 'absolute',
'top': (vars.plth * vars.pl_rows),
'left': (vars.pltw * i + vars.plmargin * i - vars.pltw * droprow)
});
if (vars.plrows > 0) {
if (i % vars.plrows == 0) {
vars.pl[i]['endrow'] = 1
}
}
if (vars.pl[i]['endrow'] == 1) {
vars.pl_rows++;
droprow = i + 1
}
}
if (vars.plplace == 'bottomrow') {
CSS(pl[i], {
'position': 'absolute',
'top': (vars.plth * i + vars.plmargin * i),
'left': 0,
'width': vars.sw - vars.plmargin * 2
})
}
pl_mc.appendChild(pl[i]);
plbg[i] = createElement('div');
pl[i].appendChild(plbg[i]);
CSS(plbg[i], {
'height': vars.plth,
'borderRadius': (vars.o > 0 ? 4 : 0)
});
Opacity(plbg[i], vars.plalpha);
CheckGradiendDiv(plbg[i], vars.plbgcolor);
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
CSS(plbg[i], {
'width': vars.pltw
})
}
if (vars.plplace == 'botomrow') {
CSS(plbg[i], {
'width': (vars.sw - vars.plmargin_h * 2)
})
}
if (vars.pl[i]['poster'] && vars.pltumbs >= 1) {
plbg[i].innerHTML = "
";
Opacity(plbg[i], 1)
}
pltext[i] = createElement('div');
pl[i].appendChild(pltext[i]);
CSS(pltext[i], {
'padding': 5,
'position': 'absolute',
'top': 0,
'left': 0,
'fontFamily': vars.plfont,
'fontSize': vars.plfontsize,
"pointerEvents": "none"
});
if (vars.plplace == 'botomrow') {
CSS(pltext[i], {
'height': vars.plth
})
}
if (vars.pl[i]['comment']) {
pltext[i].innerHTML = vars.pl[i].comment
} else {
Hide(pltext[i])
}
if (vars.pl[i]['poster'] && vars.pltumbs >= 1) {
CheckGradiendDiv(pltext[i], vars.plbgcolor);
CSS(plbg[i], {
'background': 'none'
});
vars.pltumbs == 1 && i > 0 ? Hide(pltext[i]) : ''
}
pl[i].className = 'uppod-playlist-' + i;
plbg[i].className = 'uppod-playlist-' + i + '_background';
pltext[i].className = 'uppod-playlist-' + i + '_text';
if (mobile) {
pl[i].onclick = PlClick
} else {
pl[i].onmouseover = PlOver;
pl[i].onmouseout = PlOut;
pl[i].onclick = PlClick
}
plplayed[i] = false;
plrandom[i] = i
}
if (mobile || itouch) {
pl_mc.ontouchstart = PlTouchStart;
pl_mc.ontouchmove = PlTouchMove;
pl_mc.ontouchend = PlTouchEnd
}
body.c.appendChild(playlist);
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
CSS(playlist, {
'position': 'absolute',
'width': (vars.sw - vars.plmargin_h * 2),
'height': vars.plth * (vars.pl_rows + 1) + 10,
'overflow': 'hidden'
});
vars.plplace == 'bottom' ? CSS(pl_mc, {
'position': 'absolute',
'top': 0,
'left': 0
}) : CSS(pl_mc, {
'position': 'absolute',
'top': 10,
'left': 0
});
plwidth = (vars.pl.length - droprow) * vars.pltw + (vars.pl.length - droprow - 1) * vars.plmargin;
plheight = vars.plth * (vars.pl_rows + 1) + 10
}
if (vars.plplace == 'bottomrow') {
CSS(playlist, {
'position': 'absolute',
'width': (vars.sw - vars.plmargin_h * 2),
'height': vars.bottomrowheight - vars.plmargin - vars.padding * 2 - vars.plmargin_v * 2,
'overflow': 'hidden'
});
CSS(pl_mc, {
'position': 'absolute',
'top': 0,
'left': 0
});
plwidth = vars.sw - vars.plmargin_h * 2;
plheight = vars.pl.length * vars.plth + (vars.pl.length - 1) * vars.plmargin
}
if (vars.plarrows == 1) {
plnext_b = new Element((vars.plplace == "bottomrow" ? 'download' : 'next'), 20, 20);
body.c.appendChild(plnext_b.c);
CSS(plnext_b.c, {
'cursor': 'pointer'
});
plnext_b.c.onclick = PlArrowNext;
plprev_b = new Element((vars.plplace == "bottomrow" ? 'download' : 'next'), 20, 20);
CSS(plprev_b.c, {
"transform": "rotate(-180deg)",
"-webkit-transform": "rotate(-180deg)",
"-moz-transform": "rotate(-180deg)",
"-o-transform": "rotate(-180deg)",
"-ms-transform": "rotate(-180deg)"
});
body.c.appendChild(plprev_b.c);
CSS(plprev_b.c, {
'cursor': 'pointer',
'display': 'none'
});
plprev_b.c.onclick = PlArrowPrev;
plnext_b.c.style.zIndex = 6;
plprev_b.c.style.zIndex = 6;
PlArrows();
if (!mobile && vars.hotkey == 1 && vars.m == "video") {
plnext_b.c.addEventListener("dblclick", function(event) {
event.stopPropagation()
});
plprev_b.c.addEventListener("dblclick", function(event) {
event.stopPropagation()
})
}
}
ipl = 0;
if (vars.plbgcolor_play != undefined) {
CSS(plbg[ipl], {
"background-color": '#' + vars.plbgcolor_play
})
}
if (vars.plcolor_play != undefined) {
CSS(pl[ipl], {
"color": '#' + vars.plcolor_play
})
}
Opacity(plbg[ipl], vars.plalpha_play);
playlist.style.zIndex = 6;
PlPlace();
if (vars.plplace == "inside" && vars.pliview == 0) {
ShowHide(playlist);
if (plnext_b) {
if (playlist.style.display == "none") {
Hide(plnext_b.c);
Hide(plprev_b.c)
} else {
Show(plnext_b.c);
Show(plprev_b.c)
}
}
}
}
function Pl() {
if (playlist) {
if (vars.plplace == 'inside') {
ShowHide(playlist);
if (plnext_b) {
if (playlist.style.display == "none") {
Hide(plnext_b.c);
Hide(plprev_b.c)
} else {
PlPlace();
Show(plnext_b.c);
Show(plprev_b.c);
PlArrows()
}
}
}
} else {
CreatePl()
}
}
function RemovePl() {
if (playlist) {
playlist.removeChild(pl_mc);
body.c.removeChild(playlist);
plnext_b ? body.c.removeChild(plnext_b.c) : '';
plprev_b ? body.c.removeChild(plprev_b.c) : ''
}
}
function PlPlace() {
if (vars.plplace == 'inside') {
CSS(playlist, {
'width': (vars.sw - vars.plmargin_h * 2)
});
CSS(playlist, {
'top': ((ifull ? vars.sh : vars.stageheight) - vars.plth - vars.cntrloutheight - 10) - vars.plth * vars.pl_rows,
'left': vars.plmargin_h
});
if (plnext_b) {
CSS(plprev_b.c, {
'position': 'absolute',
'top': playlist.offsetTop + vars.plth / 2 + (20 * vars.cntrlsize) / 2 + 10,
'left': playlist.offsetLeft - 10
});
CSS(plnext_b.c, {
'position': 'absolute',
'top': playlist.offsetTop + vars.plth / 2 - (20 * (vars.cntrlsize - 1)) / 2,
'left': playlist.offsetLeft + playlist.offsetWidth + 10
})
}
if (pl_mc.offsetLeft < -plwidth + playlist.offsetWidth) {
CSS(pl_mc, {
'position': 'absolute',
'top': 10,
'left': (-plwidth + playlist.offsetWidth)
})
}
if (plwidth <= (vars.sw - vars.plmargin_h * 2)) {
CSS(pl_mc, {
'position': 'absolute',
'top': 10,
'left': 0
})
}
}
if (!ifull) {
if (vars.plplace == 'bottomrow') {
CSS(playlist, {
'width': (vars.sw - vars.plmargin_h * 2)
});
CSS(playlist, {
'position': 'absolute',
'top': (vars.ph + (vars.cntrlout == 1 ? vars.cntrloutheight : 0) + 10 + vars.plmargin_v),
'left': vars.plmargin_h
});
if (plnext_b) {
CSS(plprev_b.c, {
'position': 'absolute',
'top': playlist.offsetTop - 5,
'left': playlist.offsetLeft + playlist.offsetWidth / 2 + 10
});
CSS(plnext_b.c, {
'position': 'absolute',
'top': playlist.offsetTop + playlist.offsetHeight + 5,
'left': playlist.offsetLeft + playlist.offsetWidth / 2 - 10
})
}
if (ipl !== null) {
SlidePLs(ipl)
}
}
if (vars.plplace == 'bottom') {
CSS(playlist, {
'width': (vars.sw - vars.plmargin_h * 2)
});
CSS(playlist, {
'position': 'absolute',
'top': (vars.ph + 10),
'left': vars.plmargin_h
});
if (plnext_b) {
CSS(plprev_b.c, {
'position': 'absolute',
'top': playlist.offsetTop + vars.plth / 2 + (20 * vars.cntrlsize) / 2,
'left': playlist.offsetLeft - 10
});
CSS(plnext_b.c, {
'position': 'absolute',
'top': playlist.offsetTop + vars.plth / 2 - (20 * vars.cntrlsize) / 2,
'left': playlist.offsetLeft + playlist.offsetWidth + 10
})
}
if (ipl !== null) {
SlidePLs(ipl)
}
}
}
}
var touchStartX;
var touchStartY;
var touchLastX;
var touchLastY;
var ipltouch;
function PlTouchStart(e) {
touchLastX = touchStartX = e.targetTouches[0].pageX;
touchLastY = touchStartY = e.targetTouches[0].pageY
}
function PlTouchMove(e) {
var dx = e.targetTouches[0].pageX - touchLastX;
var dy = e.targetTouches[0].pageY - touchLastY;
touchLastX = e.targetTouches[0].pageX;
touchLastY = e.targetTouches[0].pageY;
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
var aim = pl_mc.offsetLeft + dx;
if (aim < 0 && aim > (-plwidth + playlist.offsetWidth)) {
CSS(pl_mc, {
'position': 'absolute',
'top': (vars.plplace == 'bottom' ? 0 : 10),
'left': aim
})
}
}
if (vars.plplace == 'bottomrow') {
var aim = pl_mc.offsetTop + dy;
if (aim < 0 && aim > -plheight + playlist.offsetHeight - 10) {
CSS(pl_mc, {
'position': 'absolute',
'top': aim,
'left': 0
})
}
}
e.preventDefault()
}
function PlTouchStart1(e) {
ipltouch = getPlaylistId(e.target)
}
function PlTouchEnd(e) {
var dx = touchLastX - touchStartX;
var dy = touchLastY - touchStartY;
if (dx == 0 && dy == 0) {
if (ipltouch !== null && ipltouch !== undefined) {
PlClick0();
ipl = ipltouch;
PlClickCont();
ipltouch = null
}
} else {
PlTouchGo(dx, dy)
}
}
function getPlaylistId(dom) {
return dom.className.replace('uppod-playlist-', '').split('_')[0]
}
function PlTouchGo(dx, dy) {
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
var aim = pl_mc.offsetLeft + dx;
aim > 0 ? aim = 0 : '';
aim < -plwidth + playlist.offsetWidth ? aim = -plwidth + playlist.offsetWidth : '';
clearInterval(plInterval);
plaim = aim;
plInterval = setInterval(SlidePLProcess, 20)
}
if (vars.plplace == 'bottomrow') {
var aim = pl_mc.offsetTop + dy;
aim > 0 ? aim = 0 : '';
aim < -plheight + playlist.offsetHeight - 10 ? aim = -plheight + playlist.offsetHeight - 10 : '';
clearInterval(plInterval);
plaim = aim;
plInterval = setInterval(SlidePLProcess, 20)
}
}
function PlOver(e) {
var plid = getPlaylistId(e.target);
Opacity(plbg[plid], 1);
SlidePLs(plid);
if (plid) {
if (vars.pl[plid]['poster'] && vars.pl[plid]['comment']) {
Show(pltext[plid])
}
}
}
function PlOut(e) {
var plid = getPlaylistId(e.target);
if (plid) {
if (vars.pl[plid]['poster'] && vars.pltumbs >= 1) {
if (ipl != plid) {
vars.pltumbs == 1 ? Hide(pltext[plid]) : '';
Opacity(plbg[plid], (plplayed[plid] ? 0.5 : 1))
}
} else {
if (ipl != plid) {
Opacity(plbg[plid], (plplayed[plid] ? vars.plalpha2 : vars.plalpha))
} else {
Opacity(plbg[plid], vars.plalpha_play)
}
}
}
}
function PlClick(e) {
if (ipl !== null && ipl !== undefined) {
PlClick0()
}
ipl = getPlaylistId(e.target);
PlClickCont();
if (vars.redirect != '' && vars.redirect_clickpl == 1) {
window.open(vars.redirect, vars.redirecttarget)
}
}
function PlClickCont() {
if (vars.pl[ipl].playlist) {
PlClick1()
} else {
PlClick1();
if (vars.plplace == "inside") {
Hide(playlist);
plnext_b ? Hide(plnext_b.c) : '';
plprev_b ? Hide(plprev_b.c) : ''
}
if (!iplay) {
istart = true;
Toggle()
}
}
CheckPrevNext()
}
function Next() {
if (ipl < (pl.length - 1)) {
PlNext()
}
}
function PlArrowNext() {
var onpage = PlOnPage();
var i = (plpage + 1) * onpage;
if (i < pl.length) {
plpage++;
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
CSS(pl_mc, {
'position': 'absolute',
'left': -pl[i].offsetLeft
})
}
if (vars.plplace == 'bottomrow') {
CSS(pl_mc, {
'position': 'absolute',
'top': -pl[i].offsetTop
})
}
PlArrows()
}
}
function PlOnPage() {
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
return Math.floor((vars.sw - vars.plmargin_h * 2) / vars.pltw)
} else {
return Math.floor((vars.bottomrowheight - vars.plmargin_v * 2) / vars.plth)
}
}
function PlArrows() {
var onpage = PlOnPage();
var i = plpage * onpage;
if (i + onpage >= pl.length) {
Hide(plnext_b.c)
} else {
Show(plnext_b.c)
}
i == 0 ? Hide(plprev_b.c) : Show(plprev_b.c);
if (vars.plplace != "inside" && ifull) {
Hide(plnext_b.c);
Hide(plprev_b.c)
}
}
function PlArrowPrev() {
var onpage = Math.floor((vars.sw - 80) / vars.pltw);
var i = (plpage - 1) * onpage;
if (i >= 0) {
plpage--;
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
CSS(pl_mc, {
'position': 'absolute',
'left': -pl[i].offsetLeft
})
}
if (vars.plplace == 'bottomrow') {
CSS(pl_mc, {
'position': 'absolute',
'top': -pl[i].offsetTop
})
}
PlArrows()
}
}
function PlNext() {
if (vars.random == 1) {
if (plrandom.length > 1) {
if (ipl !== null) {
PlClick0()
}
ipl = plrandom[getRandomInt(0, plrandom.length - 1)];
PlClick1();
Event('next')
} else {
EndPl();
prev_b ? CSS(prev_b.c, {
'opacity': 1,
'filter': 'alpha(opacity=100)',
'cursor': 'pointer'
}) : ''
}
} else {
if (ipl < (pl.length - 1)) {
if (ipl !== null) {
PlClick0()
}
var start_in_folder = 0;
if (vars.pl[ipl].playlist && !vars.pl[ipl].file && ipl == 0) {
start_in_folder = 2
} else {
ipl++
}
PlClick1();
if (vars.pl[ipl].playlist && !vars.pl[ipl].file) {
if (start_in_folder != 2) {
start_in_folder = 1
}
}
if (start_in_folder > 0) {
PlClick0();
ClearOldVars();
ipl = start_in_folder;
UpdatedVarsFromPlaylist(vars.pl[ipl]);
QualityLinks();
if (uppod.ads()) {
uppod.ads().newPlaylistItem()
}
NewFile(vars.file, true);
if (vars.plbgcolor_play != undefined) {
CSS(plbg[ipl], {
"background-color": '#' + vars.plbgcolor_play
})
}
if (vars.plcolor_play != undefined) {
CSS(pl[ipl], {
"color": '#' + vars.plcolor_play
})
}
Opacity(plbg[ipl], vars.plalpha_play)
}
Event('next')
} else {
EndPl()
}
}
CheckPrevNext();
!iplay ? OnPlay() : ''
}
function CheckPrevNext() {
if (vars.random == 0) {
if (ipl == 0) {
prev_b ? CSS(prev_b.c, {
'opacity': 0.3,
'filter': 'alpha(opacity=30)',
'cursor': 'default'
}) : ''
} else {
prev_b ? CSS(prev_b.c, {
'opacity': 1,
'filter': 'alpha(opacity=100)',
'cursor': 'pointer'
}) : ''
}
if (ipl == pl.length - 1) {
next_b ? CSS(next_b.c, {
'opacity': 0.3,
'filter': 'alpha(opacity=30)',
'cursor': 'default'
}) : ''
} else {
next_b ? CSS(next_b.c, {
'opacity': 1,
'filter': 'alpha(opacity=100)',
'cursor': 'pointer'
}) : ''
}
}
}
function Prev() {
PlPrev()
}
function PlPrev() {
if (vars.random == 1) {
if (plrandom.length > 1) {
if (ipl !== null) {
PlClick0()
}
ipl = plrandom[getRandomInt(0, plrandom.length - 1)];
PlClick1();
Event('prev')
} else {
EndPl()
}
} else {
if (ipl > 0) {
if (ipl !== null) {
PlClick0()
}
ipl--;
PlClick1();
Event('prev');
ipl == 0 && prev_b ? CSS(prev_b.c, {
'opacity': 0.3,
'filter': 'alpha(opacity=30)',
'cursor': 'default'
}) : ''
} else {}
}
CheckPrevNext()
}
function EndPl() {
if (vars.plplay1 == 1) {
TheEnd()
} else {
if (vars.random == 1) {
for (p = 0; p < pl.length; p++) {
plrandom[p] = p
}
PlNext()
} else {
PlClick0();
ipl = 0;
PlClick1();
Event('next')
}
}
}
function PlClick0() {
if (vars.pl[ipl]['poster'] && vars.pltumbs >= 1) {
vars.pltumbs == 1 ? Hide(pltext[ipl]) : '';
Opacity(plbg[ipl], 0.5)
} else {
if (vars.plbgcolor_play != undefined) {
CSS(plbg[ipl], {
"background-color": '#' + vars.plbgcolor
})
}
if (vars.plcolor_play != undefined) {
CSS(pl[ipl], {
"color": '#' + vars.plcolor
})
}
Opacity(plbg[ipl], vars.plalpha2)
}
plplayed[ipl] = true;
var idx = plrandom.indexOf(ipl);
if (idx != -1) plrandom.splice(idx, 1)
}
function PlClick1() {
if (vars.pl[ipl].playlist) {
if (vars.pl[ipl].playlist != "back") {
vars.pl_history.push(vars.pl);
var newpl = vars.pl[ipl].playlist;
vars.pl = [{
"comment": "←",
"playlist": "back"
}];
vars.pl = vars.pl.concat(newpl)
} else {
vars.pl = vars.pl_history[vars.pl_history.length - 1];
vars.pl_history.splice(vars.pl_history.length - 1, 1)
}
RemovePl();
CreatePl();
if (vars.plplace == "inside") {
Show(playlist);
plnext_b ? Show(plnext_b.c) : '';
plprev_b ? Show(plprev_b.c) : ''
}
} else {
ClearOldVars();
UpdatedVarsFromPlaylist(vars.pl[ipl]);
QualityLinks();
if (uppod.ads()) {
uppod.ads().newPlaylistItem()
}
NewFile(vars.file, true);
if (vars.plbgcolor_play != undefined) {
CSS(plbg[ipl], {
"background-color": '#' + vars.plbgcolor_play
})
}
if (vars.plcolor_play != undefined) {
CSS(pl[ipl], {
"color": '#' + vars.plcolor_play
})
}
Opacity(plbg[ipl], vars.plalpha_play)
}
if (plnext_b) {
PlArrows()
}
}
function UpdatedVarsFromPlaylist(obj) {
for (var key in obj) {
if (obj[key].indexOf('#') == 0) {
obj[key] = un(obj[key])
}
if (key == 'poster' && vars['poster'] == undefined) {
vars['poster'] = obj['poster']
} else {
vars[key] = obj[key]
}
if (key == 'bigposter') {
vars['poster'] = obj['bigposter']
}
}
}
function SlidePLs(plid) {
if (vars.plplace == "inside" || vars.plplace == "bottom") {
if (plwidth > (vars.sw - vars.plmargin_h * 2)) {
SlidePL(plid)
}
}
if (vars.plplace == "bottomrow") {
if (plheight > vars.bottomrowheight) {
SlidePL(plid)
}
}
}
var plInterval;
var plaim;
function SlidePL(i) {
if (vars.plarrows == 0) {
clearInterval(plInterval);
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
var aim = -pl[i].offsetLeft + playlist.offsetWidth / 2 - vars.pltw / 2;
if (aim > 0 || plwidth < vars.sw) {
aim = 10
}
if (aim < 0 && aim < -plwidth + playlist.offsetWidth - 10) {
aim = -plwidth + playlist.offsetWidth - 10
}
plaim = aim;
plInterval = setInterval(SlidePLProcess, 20)
}
if (vars.plplace == 'bottomrow') {
var aim = -pl[i].offsetTop + playlist.offsetHeight / 2 - vars.plth / 2;
if (aim > 0) {
aim = 10
}
if (aim < -plheight + playlist.offsetHeight - 10) {
aim = -plheight + playlist.offsetHeight - 10
}
plaim = aim;
plInterval = setInterval(SlidePLProcess, 20)
}
}
}
function SlidePLProcess() {
var aim = plaim;
if (vars.plplace == 'inside' || vars.plplace == 'bottom') {
if (Math.abs((pl_mc.offsetLeft - aim) / 10) <= 1) {
clearInterval(plInterval)
} else {
CSS(pl_mc, {
'position': 'absolute',
'top': (vars.plplace == 'bottom' ? 0 : 10),
'left': pl_mc.offsetLeft - (pl_mc.offsetLeft - aim) / 10
})
}
}
if (vars.plplace == 'bottomrow') {
if (Math.abs((pl_mc.offsetTop - aim) / 10) <= 1) {
clearInterval(plInterval)
} else {
CSS(pl_mc, {
'position': 'absolute',
'top': pl_mc.offsetTop - (pl_mc.offsetTop - aim) / 10,
'left': 0
})
}
}
}
function ClearOldVars() {
if (sub) {
KillSub();
sub = null
}
vars.ors = 0
}
function NewFile(s, autoplay) {
Uppod.trace('NewFile s=' + s + ' autoplay=' + autoplay);
iplay = false;
istartevnt = false;
vars.file = s;
if (autoplay) {
vars.auto = 'play'
}
Media();
Comment();
if (autoplay) {
OnPlay()
}
}
function checkStart() {
if (media != undefined) {
if (Uppod.browser.doSendCanPlay == false || !vars.file || vars.file == '' || vars.auto != 'play') {
onReady()
}
if (media.networkState >= 0 || vars.youtube) {
init = true;
CSS(media, {
'opacity': 1,
'filter': 'alpha(opacity=100)'
});
Opacity(media, 1);
playInterval = setInterval(Playing, 100);
media.addEventListener('pause', OnPause, false);
media.addEventListener('seeking', OnSeeking, false);
media.addEventListener('seeked', OnSeeked, false);
media.addEventListener('volumechange', OnVolume, false);
function isFullscreen() {
if (document.fullscreen) {
document.fullscreen
} else if (document.webkitIsFullScreen) {
document.webkitIsFullScreen
} else if (document.mozFullScreen) {
document.mozFullScreen
}
}
function FullscreenChange() {}
document.addEventListener("fullscreenchange", function() {
!document.fullscreen && ifull && !opera ? FullOff() : '';
FullscreenChange()
}, false);
document.addEventListener("mozfullscreenchange", function() {
!document.mozFullScreen && ifull ? FullOff() : '';
FullscreenChange()
}, false);
document.addEventListener("webkitfullscreenchange", function() {
!document.webkitIsFullScreen && ifull ? FullOff() : '';
FullscreenChange()
}, false);
document.addEventListener("MSFullscreenChange", function() {
(document.fullscreenElement != undefined) && ifull ? FullOff() : '';
FullscreenChange()
}, false);
muted || v == 0 ? Volume(0) : (v > 0 ? Volume(-v) : '');
if (!initevent) {
Event("init");
initevent = true
}
} else {
setTimeout(checkStart, 100)
}
}
}
function Play() {
iplay = false;
Toggle()
}
function Pause() {
iplay = true;
Toggle()
}
function Toggle(e) {
var stop = false;
if (vars.redirect != '' && vars.redirect_play == 1) {
window.open(vars.redirect, vars.redirecttarget);
vars.redirect_play = 0
}
Protection();
if (!stop) {
Uppod.trace("Toggle e=" + e);
if (vars.auto == 'none' && !vars.youtube) {
media.autoplay = true;
Source();
istart = true
}
vars.auto = 'play';
if (!vars.file || vars.file == '') {
Event('player_error', 'nofile')
}
istart = true;
if (!iplay) {
if (isYoutube()) {
media_yt.playVideo();
OnPlay()
} else {
uppod.mediaW().play();
OnPlay()
}
} else {
if (isYoutube()) {
media_yt.pauseVideo();
OnPause()
} else {
uppod.mediaW().pause();
OnPause()
}
}
}
}
function Mybut(m) {
if (mybuts[m.substr(11)]) {
var act = mybuts[m.substr(11)].s.link;
if (act.indexOf('http') == 0) {
Link(act, (mybuts[m.substr(11)].s.target ? mybuts[m.substr(11)].s.target : "_blank"))
} else {
if (act == 'toggle') {
Toggle()
}
if (act.indexOf('js:') == 0) {
var js_vars = '';
if (act.indexOf(',') > 0) {
js_vars = act.substr(act.indexOf(',') + 1);
act = act.substr(0, act.indexOf(','))
}
eval(act.substr(3) + '(' + js_vars + ')')
}
}
Event('mybut', act)
}
}
function Link(l, t) {
if (l) {
l = l.replace('(referer)', encodeURIComponent(vars.referer));
l = l.replace('(link)', encodeURIComponent(vars.link));
l = l.replace('(file)', encodeURIComponent(vars.file));
l = l.replace('(redirect)', encodeURIComponent(vars.redirect));
l = l.replace('(comment)', encodeURIComponent(vars.comment));
l = l.replace('(time)', CurrentTime());
if (l.substr(0, 3) == 'js:') {
var myjsa = l.substr(3).split(',');
eval(myjsa[0] + '(' + (myjsa.length > 1 ? myjsa[1] : '') + (myjsa.length > 2 ? ',' + myjsa[2] : '') + (myjsa.length > 3 ? ',' + myjsa[3] : '') + ');')
}
if (l.indexOf('http') == 0) {
window.open(l, t)
}
}
}
function Stop() {
Uppod.trace('Stop');
if (iplay) {
Toggle();
OnPause()
}
vars.radio == 0 ? Seek(0) : '';
time_play_b ? time_play_b.c.innerHTML = formatTime(0) : '';
time_back_b ? time_back_b.c.innerHTML = formatTime(Duration()) : '';
vars.auto = 'none';
if (isYoutube()) {
media_yt.stopVideo()
}
Media();
Event('stop');
line_b && run_b ? RunPos(run_b, line_b, line_play_b, line_all_b, run_pos) : '';
sub ? StopSub() : ''
}
function Download() {
iplay ? Toggle() : '';
var downloadUrl = vars.download != 1 && vars.download != '' ? vars.download : (uppod.mediaW().length > 0 ? uppod.mediaW().sources[0] : (vars.file.indexOf("|") > 0 ? vars.file.substr(0, vars.file.indexOf("|")) : vars.file));
window.open(downloadUrl, "_blank");
Event('download')
}
function Protection() {
if (vars.urlprotect_go) {
if (vars.urlprotect_stop == 1) {
media.src = ''
}
if (vars.urlprotect_warning == 1) {
Alert((vars.redirect != '' ? '' : '') + (vars.urlprotect_msg != '' ? vars.urlprotect_msg : vars.redirect) + (vars.redirect != '' ? '' : ''), false)
}
}
}
function Quality() {
if (hd_b) {
if (vars.filehd) {
vars.start = media.currentTime;
var fileold = vars.file;
NewFile(vars.filehd, true);
vars.filehd = fileold;
if (hd1_b.c.style.display == 'none') {
Hide(hd_b.c);
Show(hd1_b.c);
Event('quality', '1')
} else {
Hide(hd1_b.c);
Show(hd_b.c);
Event('quality', '0')
}
}
}
}
function QualityLinks() {
if (vars.youtube) {} else {
if (vars.hd && vars.file) {
if (vars.hd.indexOf('::') > 0) {
vars.filehd = vars.file.replace(vars.hd.split('::')[0], vars.hd.split('::')[1]);
var change = false;
if (hd1_b) {
if (hd1_b.c.style.display == 'block') {
change = true
}
} else {
if (vars.hd1 == 1) {
change = true
}
}
if (change) {
var fileold = vars.file;
vars.file = vars.filehd;
vars.filehd = fileold
}
}
if (vars.file.indexOf(",") > -1 && vars.file.indexOf('[') == -1) {
vars.file = '[' + vars.file + ']'
}
if (vars.file.indexOf('[') > -1 && vars.file.indexOf(']') > -1) {
var hdf = vars.file.substr(vars.file.indexOf('[') + 1, vars.file.indexOf(']') - vars.file.indexOf('[') - 1).split(vars.hdseparator);
var files = '';
for (h = 0; h < hdf.length; h++) {
files += hdf[h] != '' ? vars.file.substr(0, vars.file.indexOf('[')) + hdf[h] + vars.file.substr(vars.file.indexOf(']') + 1) : '';
h < hdf.length - 1 ? files += vars.hdseparator : ''
}
vars.hdlinks = files.split(vars.hdseparator);
HdSelect();
if (hdselect) {
vars.file = hdselect.value
} else {
for (h = 0; h < vars.hdlinks.length; h++) {
if (vars.hdlinks[h] != '') {
vars.file = vars.hdlinks[h];
break
}
}
}
}
}
}
}
function onHlsQuality() {
var q = uppod.mediaW().hls.levels;
var q1 = [];
var q2 = [];
q1[0] = 'hls0';
q2[0] = vars.lang2['auto'];
if (q.length > 1) {
for (var i = 0; i < q.length; i++) {
q1[i + 1] = 'hls' + i;
q2[i + 1] = q[i].height ? q[i].height + 'p' : i
}
}
vars.hdlinks = q1;
vars.hda = q2;
HdSelect();
vars.hls_quality = true
}
function HdSelect() {
if (hd_b) {
if (hdselect && vars.hdlinks) {
var start = 0;
var hdselects = [];
var hh = 0;
hdselect.innerHTML = '';
vars.hd1 == 1 && vars.quality == '' ? vars.quality = vars.hda[vars.hda.length - 1] : '';
for (h = 0; h < vars.hda.length; h++) {
if (vars.hdlinks[h]) {
if (vars.hdlinks[h] != '') {
hdselects[h] = document.createElement('option');
hdselects[h].value = vars.hdlinks[h];
hdselects[h].innerHTML = vars.hda[h];
hdselect.appendChild(hdselects[h]);
if (vars.hda[h] == vars.quality) {
start = hh;
hdselects[h].setAttribute("selected", "true");
QualitySelect(false)
}
hh++
}
}
}
SelectRework(hdselect.options[start].text, hd_b)
}
}
}
function QualitySelecter() {
QualitySelect(true)
}
function QualitySelect(autostart) {
if (hd_b && vars.hdlinks) {
var hdvalue = hdselect.value;
if (hdvalue.indexOf("hls") == 0) {
autostart ? vars.start = media.currentTime : '';
if (hdvalue == 'hlsauto') {
uppod.mediaW().hls.nextLevel = -1
} else {
uppod.mediaW().hls.nextLevel = hdvalue.substr(3) * 1
}
} else {
if (vars.youtube) {
autostart ? vars.start = media_yt.getCurrentTime() : '';
if (isYoutube()) {
var t = CurrentTime();
media_yt.stopVideo();
media_yt.setPlaybackQuality(hdselect.value);
media_yt.playVideo();
media_yt.seekTo(t)
}
} else {
autostart ? vars.start = media.currentTime : '';
vars.file = hdselect.value;
NewFile(hdselect.value, (mobile ? false : autostart))
}
}
SelectRework(hdselect.options[hdselect.selectedIndex].text, hd_b);
vars.quality = hdselect.options[hdselect.selectedIndex].text;
Event('quality', vars.quality)
}
}
function Full(re) {
if (!ifull || re == 're') {
if (nativecontrols) {
if (!media.controls) {
CSS(controls, {
'visibility': 'hidden'
});
media.controls = true;
Remove('layer');
media_mc.onclick = null;
if (poster_mc && vars.m == 'video') {
poster_mc.style.display = 'none'
}
}
} else {
if (vars.realfullscreen == 1 && Uppod.Fullscreen.request(vars.stg)) {
irealfull = true
}
Uppod.Fullscreen.hack(vars.stg);
if ((vars.iframe != '' || vars.iframeobject) && !irealfull) {
CSS((vars.iframeobject ? vars.iframeobject : window.parent.document.getElementById(vars.iframe)), {
'width': window.parent.innerWidth,
'height': window.parent.innerHeight,
'position': 'fixed',
'left': 0,
'top': 0
})
}
if (re != 're') {
ifull = true;
vars.stagewidth = vars.sw;
vars.stageheight = vars.sh;
CSS(body.canvas, {
'visibility': 'hidden',
'height': (vars.iframe != '' ? window.parent.innerHeight : window.innerHeight)
});
setTimeout(function() {
CSS(body.canvas, {
'visibility': 'hidden',
'height': (vars.iframe != '' ? window.parent.innerHeight : window.innerHeight)
})
}, 500);
setTimeout(function() {
CSS(body.canvas, {
'visibility': 'hidden',
'height': (vars.iframe != '' ? window.parent.innerHeight : window.innerHeight)
})
}, 700);
CSS(media_mc, {
'backgroundColor': '#000',
'position': 'fixed',
'left': 0,
'top': 0
})
}
if (full_b) {
full_b.c.style.display = 'none';
full_back_b.c.style.display = 'block'
}
vars.stageposition = getCss(vars.stg, 'position');
vars.stageleft = getCss(vars.stg, 'left');
vars.stagetop = getCss(vars.stg, 'top');
vars.stageMargins = getCss(vars.stg, 'margin');
CSS(vars.stg, {
'width': '100%',
'height': '100%',
'margin': '0',
'position': 'fixed',
'left': '0px',
'top': '0px',
'z-index': '999999999',
'overflow': 'hidden'
});
layer != undefined ? layer.style.display = 'none' : '';
oo ? oo.style.display = 'none' : '';
clearInterval(hideInterval);
hideInterval = setInterval(CntrlHide, 3000);
if (re != 're') {
Event('fullscreen')
}
if (tip) {
if (tip.parentNode) {
tip.parentNode.removeChild(tip)
}
}
}
if (playlist) {
vars.plplace != 'inside' ? CSS(playlist, {
'top': -1000
}) : '';
if (plnext_b && vars.plplace != 'inside') {
Hide(plnext_b.c);
Hide(plprev_b.c)
}
}
} else {
FullOff()
}
setTimeout(MenuPosition, 100);
logo ? PositionLogo() : '';
sub || sub_menu ? setTimeout(PositionSub, 500) : ''
}
function FullOff() {
if (document.cancelFullScreen) {
document.cancelFullScreen()
} else if (document.exitFullscreen) {
document.exitFullscreen()
} else if (document.cancelFullscreen) {
document.cancelFullscreen()
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen()
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen()
} else if (document.msExitFullscreen) {
document.msExitFullscreen()
}
ifull = false;
if ((vars.iframe != '' || vars.iframeobject) && !irealfull) {
CSS((vars.iframeobject ? vars.iframeobject : window.parent.document.getElementById(vars.iframe)), {
'width': vars.stagewidth,
'height': vars.stageheight,
'margin': vars.stageMargins,
'position': 'static',
'left': 0,
'top': 0
})
}
CSS(media_mc, {
'backgroundColor': 'transparent',
'position': 'absolute',
'left': 0,
'top': 0
});
CSS(vars.stg, {
'width': (vars.stagewidthproc != '' ? vars.stagewidthproc : vars.stagewidth),
'height': vars.stageheight,
'margin': vars.stageMargins,
'position': vars.stageposition,
'left': vars.stageleft,
'top': vars.stagetop
});
CSS(body.canvas, {
'visibility': 'visible',
'height': vars.stageheight
});
CSS(scrn, {
'visibility': 'visible'
});
if (!isYoutube() && layer != undefined) {
layer.style.display = 'block'
}
if (oo) {
oo.style.display = 'block'
}
if (full_b) {
full_b.c.style.display = 'block';
full_back_b.c.style.display = 'none'
}
if (playlist) {
PlPlace()
}
logo ? PositionLogo() : '';
sub || sub_menu ? setTimeout(PositionSub, 500) : '';
if (tip) {
if (tip.parentNode) {
tip.parentNode.removeChild(tip)
}
}
Event('exitfullscreen')
}
var menu_big;
function Menu() {
if (menu_big) {
ShowHide(menu_big)
} else {
menu_big = createElement('div');
var mb_w = vars.scrn_w < 320 ? vars.scrn_w - 30 : 350;
var mb_h = (vars.download != '' && vars.download != 0 ? 45 : 0) + (vars.menu_nocode == 1 ? 0 : 45) + (vars.link != '' ? 45 : 0) + 11;
vars.menu_w = mb_w;
vars.menu_h = mb_h;
var menu_big_bg = new Shaper2({
w: mb_w,
h: mb_h,
o: 10,
bgc: '000000|000000',
bga1: 0.5,
bga2: 0.5
});
menu_big.appendChild(menu_big_bg.c);
CSS(menu_big_bg.c, {
'position': 'relative',
'top': '0',
'left': '0'
});
if (vars.download != '' && vars.download != 0) {
MenuBigItem("menu_download", (vars.download == 1 ? vars.file : vars.download), mb_w, mb_h)
}
if (vars.link != '') {
MenuBigItem("menu_link", vars.link, mb_w, mb_h)
}
CSS(menu_big, {
'color': '#ffffff',
'font': '10px Verdana'
});
menu_big.style.zIndex = 100;
MenuBigItem("menu_code", (vars.iframeurl != '' ? '' : vars.embedcode != '' ? vars.embedcode : ''), mb_w, mb_h);
var mbx = createElement('div');
mbx.innerHTML = ' x ';
menu_big.appendChild(mbx);
CSS(mbx, {
'position': 'absolute',
'top': 3,
'left': mb_w - 25,
'cursor': 'pointer'
});
mbx.onclick = MenuClose;
body.c.appendChild(menu_big);
MenuPosition()
}
}
var menuitems = 0;
function MenuBigItem(what, content, mb_w, mb_h) {
var mbkodt = createElement('div');
mbkodt.innerHTML = vars.lang2[what];
menu_big.appendChild(mbkodt);
CSS(mbkodt, {
'position': 'absolute',
'top': (5 + menuitems * 45),
'left': 15
});
var mbkodbg = new Shaper2({
w: mb_w - 20,
h: 23,
o: 5,
bgc: 'ffffff'
});
CSS(mbkodbg.c, {
'position': 'absolute',
'top': (22 + menuitems * 45),
'left': 10
});
menu_big.appendChild(mbkodbg.c);
var mbkode = document.createElement('input');
menu_big.appendChild(mbkode);
CSS(mbkode, {
'position': 'absolute',
'outline': 'none',
'font': '10px Verdana',
'top': (25 + menuitems * 45),
'left': 13,
'width': mb_w - 28,
'height': 15,
'color': '#000000',
'border': 0,
'background': 'none'
});
mbkode.value = content;
mbkode.onclick = function() {
this.select()
};
menuitems++
}
function MenuClose() {
if (menu_big) {
CSS(menu_big, {
'display': 'none'
})
}
}
function MenuPosition() {
if (menu_big) {
CSS(menu_big, {
'position': 'absolute',
'top': ((ifull ? vars.sh : vars.stageheight) - vars.menu_h) / 2,
'left': ((ifull ? vars.sw : vars.stagewidth) - vars.menu_w) / 2
})
}
}
function CntrlHide() {
var hide_force = false;
if (uppod.ads()) {
uppod.ads().isActive() ? hide_force = true : ''
}
if ((iplay && CurrentTime() > 0) || hide_force) {
var hide = !iover && !vars.controls_active && vars.cntrlhide == 1;
var fullHide = ifull && !vars.controls_active && vars.fullcntrlhide == 1;
if (hide || fullHide || hide_force) {
clearInterval(hideInterval);
CSS(controls, {
'visibility': 'hidden'
});
if (playlist && vars.plplace == 'inside') {
if (playlist.style.display != "none") {
Pl()
}
}
CSS(uppod.iframe, {
'cursor': 'none'
});
if (isYoutube()) {
mouseMoveCatcher.style.display = 'block'
}
ihide = true
}
}
}
function CntrlShow() {
clearInterval(hideInterval);
mouseMoveCatcher.style.display = 'none';
if (!nativecontrols) {
CSS(controls, {
'visibility': 'visible'
});
CSS(uppod.iframe, {
'cursor': 'auto'
});
ihide = false
}
}
function ScreenSize() {
vars.scrn_w = vars.sw - vars.padding * 2;
vars.scrn_h = vars.ph - vars.padding * 2 - (vars.cntrlout == 1 ? vars.cntrloutheight : 0)
}
function Resize() {
if (vars.sw != 0 && vars.sh != 0 && vars.stg.offsetHeight != 0 && vars.stg.offsetWidth != 0) {
if (vars.sw != vars.stg.offsetWidth && vars.sh == vars.stg.offsetHeight) {
vars.stg.style.height = vars.stg.offsetWidth / (vars.sw / vars.sh) + 'px'
}
if (vars.ph != vars.sh) {
vars.ph = vars.stg.offsetHeight - (vars.sh - vars.ph)
} else {
vars.ph = vars.stg.offsetHeight
}
vars.sh = vars.stg.offsetHeight;
vars.sw = vars.stg.offsetWidth;
if (!ifull) {
vars.stagewidth = vars.sw;
vars.stageheight = vars.sh
}
ScreenSize();
var nh = (!ifull ? vars.ph : vars.sh) - vars.padding * 2 - (vars.cntrlout == 1 ? vars.cntrloutheight : 0);
if (!ifull) {
CSS(body.canvas, {
'width': vars.sw,
'height': vars.sh
});
CSS(scrn, {
'width': vars.sw - vars.padding * 2,
'height': nh
});
CSS(layer, {
'height': nh
})
}
if (alrt) {
CSS(alrt_bg.canvas, {
'width': '' + vars.sw - (ifull ? 0 : vars.padding * 2) + 'px'
});
if (vars.padding > 0) {
CSS(alrt, {
'top': (ifull ? 0 : vars.padding),
'left': (ifull ? 0 : vars.padding)
})
}
}
if (poster_mc) {
CSS(poster_mc, {
'width': vars.sw,
'height': vars.ph - vars.padding * 2 - (vars.cntrlout == 1 ? vars.cntrloutheight : 0)
})
}
CSS(media_mc, {
'width': '' + vars.sw - (!ifull ? vars.padding * 2 : 0) + 'px',
'height': '' + nh + 'px'
});
CSS(media, {
'width': '' + vars.sw - (!ifull ? vars.padding * 2 : 0) + 'px',
'height': '' + nh + 'px'
});
if (isYoutube()) {
CSS(document.getElementById('yt_media_' + vars.uid), {
'width': '' + vars.sw - (!ifull ? vars.padding * 2 : 0) + 'px',
'height': '' + nh + 'px'
})
}
vars.o > 0 ? oPos() : '';
uppod.controls().ControlBar.resize();
if (uibg) {
CSS(uibg.canvas, {
'width': '' + (vars.sw - (ifull ? 0 : vars.padding * 2) - vars.cntrlbgmargin * 2 - vars.cntrlbgmarginleft - vars.cntrlbgmarginright) + 'px',
'height': '' + vars.cntrloutheight + 'px'
});
uibg_gl ? CSS(uibg_gl.canvas, {
'width': '' + (vars.sw - (ifull ? 0 : vars.padding * 2) - vars.cntrlbgmargin * 2) + 'px'
}) : ''
}
start_b ? CSS(start_b.c, {
'left': vars.sw / 2 - start_b.w / 2,
'top': (!ifull ? vars.ph : vars.sh) / 2 - start_b.h / 2
}) : '';
PlaceControls();
if (playlist) {
PlPlace();
if (plnext_b) {
if ((vars.plplace == "inside" && playlist.style.display != "none") || !ifull) {
Show(plnext_b.c);
Show(plprev_b.c);
PlArrows();
if (plpage > 0) {
plpage = plpage - 1;
PlArrowNext()
}
}
}
}
if (sub) {
PositionSub()
}
}
}
function Back() {
Seek(0)
}
function Mute() {
if (isYoutube()) {
if (!media_yt.isMuted()) {
media_yt.mute();
muted = true
} else {
media_yt.unMute();
muted = false
}
} else {
if (media.muted) {
media.muted = false;
muted = false
} else {
media.muted = true;
muted = true
}
}
MuteControl()
}
function MuteControl() {
if (volume_b) {
if (muted) {
volume_b.c.style.display = 'none'
} else {
volume_b.c.style.display = 'block'
}
}
if (volume_mute_b) {
if (muted) {
volume_mute_b.c.style.display = 'block'
} else {
volume_mute_b.c.style.display = 'none'
}
}
}
function OnPlay() {
Uppod.trace('OnPlay');
if (!iplay) {
if (nativecontrols && !media.controls) {
CSS(controls, {
'visibility': 'hidden'
});
media.controls = true;
Remove('layer');
media_mc.onclick = null
}
if (poster_mc && vars.m == 'video') {
poster_mc.style.display = 'none'
}
if (play_b != undefined) {
play_b.c.style.display = 'none';
pause_b.c.style.display = 'block'
}
iplay = true;
var hide = vars.cntrlhide == 1 && !vars.controls_active && vars.cntrlout == 0;
var fullHide = ifull && !vars.controls_active && vars.fullcntrlhide == 1;
if (hide || fullHide) {
clearInterval(hideInterval);
hideInterval = setInterval(CntrlHide, 3000)
}
if (vars.comment != undefined && vars.comment != '' && vars.showname == 1) {
vars.shownameliketip == 1 ? (vars.shownameonstop == 1 ? Hide(nametip) : '') : Hide(alrt)
}
if (vars.plplace == "inside" && playlist) {
Hide(playlist);
plnext_b ? Hide(plnext_b.c) : '';
plprev_b ? Hide(plprev_b.c) : ''
}
if (start_b) {
start_b.c.style.display = 'none'
}
if (logo) {
if (vars.logoplay == 1) {
Show(logo)
} else {
Hide(logo)
}
}
Event('play');
if (uppod_active_player_uid != vars.uid) {
uppod_active_player_uid = vars.uid;
document.addEventListener("keydown", KeyHandler)
}
if (vars.autofull == 1) {
Full()
}
if (!istartevnt) {
Event('start');
istart = true;
istartevnt = true
}
if (vars.sub && (vars.substart == 1 || (mobile && nativecontrols))) {
CreateSubs()
}
}
}
function OnSeeking() {
Event('seeking')
}
function OnSeeked() {
Event('seeked')
}
function OnPause() {
Uppod.trace('OnPause');
if (iplay) {
if (play_b != undefined) {
play_b.c.style.display = 'block';
pause_b.c.style.display = 'none'
}
iplay = false;
if (vars.comment != undefined && vars.comment != '' && vars.showname == 1) {
vars.shownameliketip == 1 ? Show(nametip) : Show(alrt)
}
start_b ? start_b.c.style.display = 'block' : '';
if (logo) {
if (vars.logopause == 1) {
Show(logo)
} else {
Hide(logo)
}
}
Event('pause')
}
}
function Event(s, msg) {
vars.events[s] = msg;
var evObj = document.createEvent('Events');
evObj.initEvent(s, true, true);
vars.stg.dispatchEvent(evObj)
}
function onCanPlay() {
Uppod.trace('onCanPlay');
if (vars.start > 0) {
Uppod.trace('onCanPlay set currentTime to ' + vars.start);
media.currentTime = vars.start;
vars.start = 0
}
onReady()
}
function OnVolume() {
if (volbarline_all_b) {
vars.ivolbar_v ? VolumeDraw(media.volume * volbarline_s['h']) : VolumeDraw(media.volume * volbarline_s['w'])
}
if (volbar_b) {
VolumeDraw(media.volume * vars.cntrlvolbar.w)
}
}
function OnEnded() {
Uppod.trace('OnEnded');
if (media.ended || isYoutube()) {
Event('end');
if (vars.radio == 1) {
Reload()
} else {
if (vars.repeat == 1) {
Play()
} else {
if (!isYoutube()) {
Back()
}
if (vars.plplay == 1 && pl) {
PlNext()
} else {
TheEnd()
}
}
}
}
}
function Reload() {
Uppod.trace('Reload');
Stop();
Toggle()
}
function Sizing() {
if (vars.stg.offsetWidth != vars.sw || vars.stg.offsetHeight < vars.sh - 5 || vars.stg.offsetHeight > vars.sh + 5) {
Resize()
}
}
function Playing() {
if (media != undefined) {
updateTimeDisplay();
if (iline) {
var time = 0;
var duration = 0;
time = CurrentTime();
duration = Duration();
var loaded = 0;
if (isYoutube()) {
loaded = media_yt.getVideoLoadedFraction()
} else {
if (media.buffered) {
if (media.buffered.length > 0) {
loaded = (media.buffered.end(media.buffered.length - 1) / media.duration)
}
}
}
if (loaded > 0) {
CSS(line_load_b, {
'width': '' + (loaded * line_all_b.w) + 'px'
});
if (loaded == 1) {
if (!iloaded) {
iloaded = true;
Event("loaded")
}
} else {
iloaded = false
}
}
CSS(line_play_b, {
'width': '' + (time / duration) * line_all_b.w + 'px'
});
if (ibuff && !igo) {
if (time > 0) {
HideBuffer();
igo = true
}
}
if (iplay && time == lastTime) {
if (ltc > 5) {
!ibuff ? ShowBuffer() : '';
ibuff = true
} else {
ltc++
}
} else {
if (ibuff) {
ibuff = false;
HideBuffer()
}
ltc = 0
}
lastTime = time
}
if (iplay && vars.reloader == 1) {
if (CurrentTime() == vars.reloadertime) {
vars.reloadercounter++;
if (vars.reloadercounter > 200 && media.currentTime != undefined) {
vars.reloadercounter = 0;
Reload()
}
} else {
vars.reloadercounter = 0
}
vars.reloadertime = CurrentTime()
}
if (vars.eventtime != 0) {
if (iplay) {
if (is_array(vars.eventtime)) {
for (i = 0; i < vars.eventtime.length; i++) {
if (!vars.events['time' + vars.eventtime[i]]) {
if (CurrentTime() > vars.eventtime[i]) {
Event('time' + vars.eventtime[i], CurrentTime())
}
}
}
} else {
if (!vars.events['time']) {
if (CurrentTime() > vars.eventtime) {
Event('time', CurrentTime())
}
}
}
}
}
if (vars.eventplayed != 0) {
if (iplay) {
if (is_array(vars.eventplayed)) {
for (i = 0; i < vars.eventplayed.length; i++) {
if (!vars.events['played' + vars.eventplayed[i]]) {
if ((CurrentTime() / Duration()) * 100 > vars.eventplayed[i]) {
Event('played' + vars.eventplayed[i], (CurrentTime() / Duration()) * 100)
}
}
}
} else {
if (!vars.events['played']) {
if ((CurrentTime() / Duration()) * 100 > vars.eventplayed) {
Event('played', (CurrentTime() / Duration()) * 100)
}
}
}
}
}
line_b && run_b ? RunPos(run_b, line_b, line_play_b, line_all_b, run_pos) : '';
if (sub != undefined && vars.substart == 1) {
if (sub[sub_lang]) {
if (sub[sub_lang][1]) {
var t = parseInt(CurrentTime() * 10);
if (sub[sub_lang][1][t] != null) {
var str = '';
if (vars.sublangsall == 1 && sub_lang_all) {
for (var i = 0; i < sub.length; i++) {
str += sub[i][0][sub[i][1][t]] ? sub[i][0][sub[i][1][t]] + (i < sub.length - 1 ? '
' : '') : ''
}
} else {
str = sub[sub_lang][0][sub[sub_lang][1][t]]
}
if (sub) {
var stop = false;
if (sub_last) {
sub_last == str ? stop = true : ''
}!sub_showed ? stop = false : '';
!stop ? ShowSub(str) : ''
}
}
if (sub[sub_lang][1][t] == undefined && sub_showed) {
StopSub()
}
}
}
}
}
if (ifull && !irealfull) {
if (vars.iframe != '') {
window.parent.innerWidth != vars.stg.offsetWidth || window.parent.innerHeight != vars.stg.offsetHeight ? Full('re') : ''
} else {
window.innerWidth != vars.stg.offsetWidth || window.innerHeight != vars.stg.offsetHeight ? Full('re') : ''
}
}
}
function CurrentTime() {
t = 0;
if (isYoutube()) {
t = media_yt.getCurrentTime()
} else {
media ? t = media.currentTime : ''
}
return t
}
function Duration() {
t = 0;
if (isYoutube()) {
t = media_yt.getDuration()
} else {
if (media) {
if (media.duration && media.duration != 'Infinity') {
t = media.duration
}
}
}
return t
}
function NotFound() {
if (vars.or.length > 1 && vars.ors < vars.or_limit) {
if (vars.ori == vars.or.length - 1) {
}
vars.ori++;
Next()
} else {
Next();
if (vars.alerts == 1) {
var message = vars.lang2['file'] + ' ' + vars.lang2['notfound'];
}
}
}
function TheEnd() {
if (!nativecontrols) {
CntrlShow()
}
if (vars.redirect != '' && vars.redirect_end == 1) {
window.open(vars.redirect, vars.redirecttarget);
vars.redirect_end = 0
}
if (media) {
if (!isYoutube()) {
media.currentTime = 0;
media.pause()
} else {
media_yt.pauseVideo()
}
}
if (poster_mc && vars.m == 'video') {
Show(poster_mc)
}
if (vars.menuauto == 1 && menu_b) {
isVisible(menu_big) ? '' : Menu()
}
}
function isVisible(mc) {
var out = false;
if (mc) {
mc.style.visible != 'none' ? out = true : ''
}
return out
}
function FontStyle(f) {
var out = 'normal';
if (f == 'i' || f == 'b> 0) {
time_back_b ? time_back_b.c.innerHTML = formatTime(Duration() - CurrentTime()) : '';
time_all_b ? time_all_b.c.innerHTML = formatTime(Duration()) : ''
}
}
function formatTime(seconds, tip) {
var seconds = Math.round(seconds);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
minutes = Math.floor(minutes % 60);
seconds = Math.floor(seconds % 60);
(hours > 0 || timelength > 5) && minutes < 10 ? minutes = "0" + minutes : "";
seconds = (seconds >= 10) ? seconds : "0" + seconds;
var out = (hours > 0 || timelength > 5 ? hours + ":" : "") + minutes + ":" + seconds;
if (out.length != timelength && !tip) {
timelength = out.length;
PlaceControls()
}
return out
}
function CreateSubs() {
if (vars.sub.indexOf('#') == 0) {
vars.sub = un(vars.sub)
}
var subs = vars.sub.split(',');
var clangs = vars.sublangs ? vars.sublangs.split(',') : Array();
sub = Array();
for (var i = 0; i < subs.length; i++) {
if (subs[i] != '') {
if (clangs[i] == undefined) {
var filename = subs[i].substr(subs[i].lastIndexOf('/') + 1);
filename = filename.substr(0, filename.lastIndexOf('.'));
clangs[i] = filename
}
CreateSub(i, subs[i], clangs[i]);
clangs[i] && vars.sublang ? (clangs[i] == vars.sublang ? sub_lang = i : '') : ''
} else {
if (sub_lang == i) {
sub_lang++
}
}
}
vars.sub_tmp = vars.sub;
delete vars.sub
}
function CreateSub(l, url, label) {
if (url) {
if (url.indexOf('#') == 0) {
url = un(url)
}
var url_shift = vars.sub_shift;
if (url.indexOf('shift=') > 0) {
url_shift = url.substr(url.indexOf('shift=') + 6) * 1
}
if (mobile && (nativecontrols || iphone)) {
var track = document.createElement('track');
track.setAttribute('src', url);
track.setAttribute('label', label);
vars.substart == 1 && l == 0 ? track.setAttribute('default', 'true') : '';
media.appendChild(track)
} else {
var subtxt = LoadFile(url);
if (subtxt) {
if (url.indexOf('.srt') > -1 || url.indexOf('.ass') > -1 || url.indexOf('.ssa') > -1 || url.indexOf('.vtt') > -1) {
sub[l] = Object();
sub[l][0] = Array();
sub[l][1] = Array();
var rows = Array();
rows = subtxt.split('\n');
var cnt = 1;
var t1 = 0;
var t2 = 0;
for (i = 0; i < rows.length; i++) {
if (url.indexOf('.srt') > -1 || url.indexOf('.vtt') > -1) {
if (rows[i].indexOf('-->') > -1 && rows[i].indexOf(':') > -1) {
t1 = TimerSub(rows[i].substr(0, rows[i].indexOf('-->'))) * 1 + url_shift;
t2 = TimerSub(rows[i].substr(rows[i].indexOf('-->') + 4, 12)) * 1 + url_shift;
sub[l][0][t1] = '';
for (var j = t1; j < t2; j++) {
sub[l][1][j] = t1
}
cnt++
} else {
if (rows[i] != '' && rows[i].length > 1 && rows[i] != cnt) {
sub[l][0][t1] += (sub[l][0][t1] != '' ? '
' : '') + rows[i]
}
}
}
if (url.indexOf('.ass') > -1 || url.indexOf('.ssa') > -1) {
if (rows[i].indexOf('Dialogue:') > -1) {
t1 = TimerSub(rows[i].substr((url.indexOf('.ssa') > -1 ? rows[i].indexOf('=0') + 3 : 12), 12)) * 1 + url_shift;
t2 = TimerSub(rows[i].substr((url.indexOf('.ssa') > -1 ? rows[i].indexOf('=0') + 14 : 23), 10)) * 1 + url_shift;
var p = '';
if (rows[i].indexOf('0,,') > 0) {
p = rows[i].substr(rows[i].indexOf('0,,') + 3)
} else {
if (rows[i].indexOf('ffect,') > 0) {
p = rows[i].substr(rows[i].indexOf('ffect,') + 6)
}
}
if (sub[l][0][t1] != undefined) {
sub[l][0][t1] += '\n' + p
} else {
sub[l][0][t1] = p
}
sub[l][0][t1] = sub[l][0][t1].replace(/{.*?}/, '');
sub[l][0][t1] = sub[l][0][t1].replace(/\\\\N/, '\n');
for (var j = t1; j < t2; j++) {
sub[l][1][j] = t1
}
}
}
}
}
}
vars.substart = 1
}
}
}
function ShowSub(str) {
if (sub_text) {
KillSub()
}
sub_text = createElement('div');
sub_bg = createElement('div');
body.c.appendChild(sub_bg);
body.c.appendChild(sub_text);
Show(sub_text);
Show(sub_bg);
sub_last = str;
sub_text.innerHTML = str;
sub_showed = true;
PositionSub()
}
function StopSub() {
if (sub_text) {
KillSub();
sub_showed = false
}
}
function KillSub() {
if (sub_text) {
sub_text.innerHTML = '';
body.c.removeChild(sub_bg);
body.c.removeChild(sub_text);
sub_bg = null;
sub_text = null
}
}
function PositionSub() {
var h = (!ifull ? vars.ph : vars.sh) - (vars.cntrlout == 1 && !ifull ? vars.padding / 2 : vars.cntrloutheight);
if (sub_text) {
var width = vars.sw - 60;
CSS(sub_text, {
"position": "absolute",
"color": (vars.subcolor.length == 6 ? '#' : '') + vars.subcolor,
'fontFamily': vars.subfont,
'fontSize': (vars.subsize * (ifull ? 1.5 : 1)) + '%',
'text-align': 'center',
'line-height': '120%',
'text-shadow': '1px 1px 1px rgba(1,1,1,0.4)'
});
CSS(sub_bg, {
"position": "absolute",
"backgroundColor": (vars.subbgcolor.length == 6 ? '#' : '') + vars.subbgcolor,
'opacity': vars.subbgalpha,
'borderRadius': vars.subbgo / 2
});
CSS(sub_text, {
'max-width': width
});
var top = h - vars.submargin * (ifull ? vars.sh / vars.stageheight : 1) - 10 - sub_text.offsetHeight - 5;
var left = (vars.sw - (sub_text.offsetWidth + 20)) / 2;
CSS(sub_text, {
"position": "absolute",
"top": top,
"left": left + 10
});
CSS(sub_bg, {
"width": sub_text.offsetWidth + 20,
"height": sub_text.offsetHeight + 10,
"position": "absolute",
"top": top - 5,
"left": left
})
}
if (sub_menu) {
var top2 = (h - sub_menu.offsetHeight);
var left2 = sub_b.c.offsetLeft - sub_menu.offsetWidth + sub_b.w + 5;
left2 < 0 ? left2 = 0 : '';
CSS(sub_menu, {
"position": "absolute",
"top": top2,
"left": left2
});
CSS(sub_menu_bg, {
"position": "absolute",
"top": top2,
"left": left2
})
}
}
function TimerSub(srt) {
var tmp = srt.split(':');
var out = 0;
tmp.length == 2 ? tmp.unshift("00") : '';
tmp[0] != '00' ? out += tmp[0] * 3600 : '';
tmp[1] != '00' ? out += tmp[1] * 60 : '';
out += tmp[2].substr(0, 2) * 1;
out = out * 10 + tmp[2].substr(3, 1) * 1;
return out
}
function SetSub() {
if (vars.submenu == 1) {
if (sub_menu) {
ToggleView(sub_menu_bg);
ToggleView(sub_menu);
PositionSub()
} else {
sub_menu = createElement('div');
sub_menu_bg = createElement('div');
body.c.appendChild(sub_menu_bg);
body.c.appendChild(sub_menu);
sub_menu.innerHTML = '';
document.getElementById("uppodplayer_sub_switcher").onclick = ToggleSub;
var sub_menu_x = createElement('div');
sub_menu.appendChild(sub_menu_x);
CSS(sub_menu_x, {
"fontSize": "80%",
"position": "absolute",
"top": 5,
"right": 7,
"color": "#fff",
"opacity": 0.5,
"margin-top": "-2px",
"cursor": "pointer"
});
sub_menu_x.innerHTML = '×';
sub_menu_x.onclick = SetSub;
CSS(sub_menu, {
"position": "absolute",
"top": 0,
"left": 0,
"color": "#fff",
"font": "90% sans-serif",
"borderRadius": 10,
"padding": 10,
"width": 119
});
sub_menu2 = createElement('div');
ToggleSubStyle();
sub_menu.appendChild(sub_menu2);
var b1 = createElement('div');
SetSubButStyle(b1, false);
b1.innerHTML = '+';
CSS(b1, {
"margin": "0 5px 5px 0"
});
var b2 = createElement('div');
SetSubButStyle(b2, false);
b2.innerHTML = '-';
CSS(b2, {
"margin": "0 20px 5px 0"
});
b1.onclick = function() {
vars.subsize += 10;
PositionSub()
};
b2.onclick = function() {
vars.subsize -= 10;
PositionSub()
};
var b3 = createElement('div');
SetSubButStyle(b3, false);
b3.innerHTML = '∧';
CSS(b3, {
"margin": "0 5px 5px 0"
});
var b4 = createElement('div');
SetSubButStyle(b4, false);
b4.innerHTML = '∨';
CSS(b4, {
"margin": "0 0 5px 0"
});
b3.onclick = function() {
vars.submargin += 10;
PositionSub()
};
b4.onclick = function() {
vars.submargin -= 10;
PositionSub()
};
var s1 = document.createElement('br');
sub_menu2.appendChild(s1);
var c = Array();
var ccolors = Array("FFFFFF", "000000", "FAED54", "FFB0BE", "72CCF8", "62DE50", "E8BBFF", "FEBA54");
var c_def = 2;
for (var i = 0; i < 7; i++) {
c[i] = createElement('div');
SetSubButStyle(c[i], true);
CSS(c[i], {
"border": "1px solid #" + (i == 1 ? '666' : ccolors[i]),
"opacity": 0.7,
"color": "#" + (ccolors[i])
});
c[i].onclick = function() {
vars.subcolor = this.style.color;
isub_menu_color.style.opacity = 0.7;
this.style.opacity = 1;
isub_menu_color = this;
PositionSub()
};
vars.subcolor == ccolors[i] ? c_def = i : ''
}
c[c_def].style.opacity = 1;
isub_menu_color = c[c_def];
var s2 = document.createElement('br');
sub_menu2.appendChild(s2);
var cbg = Array();
var cbgcolors = Array("FFFFFF", "000000", "FEF370", "D90000", "073DA0", "409829", "644082", "a56305");
var cbg_def = 1;
for (i = 0; i < 7; i++) {
cbg[i] = createElement('div');
SetSubButStyle(cbg[i], true);
CSS(cbg[i], {
"background-color": "#" + (cbgcolors[i]),
"borderColor": "#" + (i == 1 ? '666' : cbgcolors[i]),
"opacity": 0.7,
"color": "#fff"
});
i == 0 || i == 2 ? CSS(cbg[i], {
"color": "#000"
}) : '';
cbg[i].onclick = function() {
vars.subbgcolor = this.style.backgroundColor;
isub_menu_bgcolor.style.opacity = 0.7;
this.style.opacity = 1;
isub_menu_bgcolor = this;
PositionSub()
};
vars.subbgcolor == cbgcolors[i] ? cbg_def = i : ''
}
cbg[cbg_def].style.opacity = 1;
isub_menu_bgcolor = cbg[cbg_def];
var s3 = document.createElement('br');
sub_menu2.appendChild(s3);
var ca0 = createElement('div');
sub_menu2.appendChild(ca0);
CSS(ca0, {
"float": "left",
"margin": "0 2px 0 2px",
"cursor": "default"
});
ca0.innerHTML = '-';
var ca = createElement('div');
CSS(ca, {
"width": 91,
"height": 4,
"border": "1px solid #fff",
"borderRadius": 4,
"float": "left",
"margin": "5px 3px",
"cursor": "pointer"
});
sub_menu2.appendChild(ca);
var ca2 = createElement('div');
ca.appendChild(ca2);
CSS(ca2, {
"width": (vars.subbgalpha * 100) + "%",
"height": 4,
"borderRadius": 4,
"background": "#fff"
});
var ca1 = createElement('div');
sub_menu2.appendChild(ca1);
CSS(ca1, {
"float": "left",
"margin": "0 0 0 2px",
"fontSize": "80%",
"cursor": "default"
});
ca1.innerHTML = '+';
ca.onclick = function(e) {
var n = e.clientX - findLeft(this);
n < 5 ? n = 0 : '';
CSS(this.firstElementChild, {
'width': n
});
vars.subbgalpha = n / this.offsetWidth;
PositionSub()
};
if (vars.sublangs) {
var clang = document.createElement('select');
var clangs = vars.sublangs.split(',');
var subs = vars.sub_tmp.split(',');
for (var l = 0; l < clangs.length; l++) {
var cl = document.createElement('option');
cl.innerHTML = clangs[l];
clang.appendChild(cl);
if (clangs[l] == vars.sublang) {
sub_lang = l;
cl.setAttribute("selected", "true")
}
if (subs[l] == '') {
cl.setAttribute("disabled", "true")
}
}
if (vars.sublangsall == 1 && clangs.length > 1) {
var cl = document.createElement('option');
cl.innerHTML = vars.lang2['all'];
clang.appendChild(cl)
}
sub_menu2.appendChild(clang);
clang.onchange = function() {
if (vars.sublangsall == 1 && this.selectedIndex == this.length - 1) {
sub_lang = 0;
sub_lang_all = true
} else {
sub_lang_all = false;
sub_lang = this.selectedIndex
}
};
CSS(clang, {
'width': 120,
'cursor': 'pointer'
})
}
CSS(sub_menu_bg, {
"position": "absolute",
"top": 0,
"left": 0,
"background": "#000",
"width": sub_menu.offsetWidth,
"height": sub_menu.offsetHeight,
"opacity": "0.7",
"borderRadius": 10
});
PositionSub();
sub_menu.style.zIndex = 7;
sub_menu_bg.style.zIndex = 7
}
} else {
ToggleSub()
}
}
function ToggleSub() {
if (vars.submenu == 1) {
var el = sub_menu.firstElementChild.firstElementChild.firstElementChild;
CSS(el, {
"float": (vars.substart == 1 ? "left" : "right")
})
}
if (sub) {
vars.substart == 0 ? vars.substart = 1 : vars.substart = 0
} else {
if (vars.sub && vars.substart == 0) {
CreateSubs();
vars.substart = 1
} else {
vars.substart == 0 ? vars.substart = 1 : vars.substart = 0
}
}
if (vars.substart == 0) {
StopSub()
}
if (vars.submenu == 1) {
ToggleSubStyle()
} else {
if (sub_b) {
vars.substart ? CSS(sub_b.c, {
'opacity': sub_b.s.alpha
}) : CSS(sub_b.c, {
'opacity': sub_b.s.alpha0
})
}
}
}
function ToggleSubStyle() {
vars.substart == 0 ? CSS(sub_menu2, {
"visibility": "hidden"
}) : CSS(sub_menu2, {
"visibility": "visible"
});
CSS(document.getElementById("uppodplayer_sub_switcher_dot"), {
"background": (vars.substart == 0 ? "#fff" : "#000")
});
CSS(document.getElementById("uppodplayer_sub_switcher_bg"), {
"background": (vars.substart == 0 ? 0 : "#fff")
})
}
function SetSubButStyle(b, small) {
sub_menu2.appendChild(b);
CSS(b, {
"float": "left",
"textAlign": "center",
"width": (small ? 11 : 20),
"height": (small ? 11 : "auto"),
"border": "1px solid rgba(255,255,255,0.5)",
"borderRadius": (small ? 11 : 20),
"margin": (small ? "3px 2px 7px 2px" : 0),
"padding": (small ? "0" : "0 0 0 0"),
"cursor": "pointer"
})
}
function Controls() {
if (vars.youtube && browser.restrictMediaPlay) {}
var controlsObj = uppod.controls();
controlsObj.add(new Uppod.ControlBar(uppod));
controls = controlsObj.ControlBar.dom;
controls.onmouseover = function() {
vars.controls_active = true
};
controls.onmouseout = function() {
vars.controls_active = false
};
if (!mobile && vars.hotkey == 1 && vars.m == "video") {
controls.addEventListener("dblclick", function(event) {
event.stopPropagation()
})
}
sep_b = [];
sep = 0;
CntrlBg();
cntrl = vars.controls.split(',');
cntrlength = 0;
cntrls = [];
cntrli = [];
for (var i = 0; i < cntrl.length; i++) {
if (cntrl[i] == 'play' || cntrl[i] == 'playstop') {
play_b = new Element('play', 20, 20);
controlsObj.addElement('Play', play_b);
controls.appendChild(play_b.c);
CSS(play_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - play_b.h) / 2 + play_b.s.margintop - play_b.s.marginbottom
});
play_b.c.onclick = Toggle;
if (vars.tip == 1 && play_b.s.notip == 0) {
play_b.c.onmouseover = function() {
var txt = play_b.s.play_tip ? play_b.s.play_tip : vars.lang2['play'];
ToolTip(play_b.c, txt)
};
play_b.c.onmouseout = function() {
ToolTipHide(play_b.c)
}
}
pause_b = new Element((cntrl[i] == 'playstop' ? 'stop' : 'pause'), 20, 20, '', 'play');
controlsObj.addElement('Pause', pause_b);
controls.appendChild(pause_b.c);
CSS(pause_b.c, {
'cursor': 'pointer',
'display': 'none',
'position': 'absolute',
'top': (vars.cntrloutheight - pause_b.h) / 2 + pause_b.s.margintop - pause_b.s.marginbottom
});
cntrl[i] == 'playstop' ? pause_b.c.onclick = Stop : pause_b.c.onclick = Toggle;
cntrls[i] = pause_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + play_b.s.marginleft + play_b.s.marginright;
cntrli[i] = play_b;
if (vars.tip == 1 && pause_b.s.notip == 0) {
pause_b.c.onmouseover = function() {
ToolTip(pause_b.c, pause_b.s.pause_tip ? pause_b.s.pause_tip : vars.lang2['pause'])
};
pause_b.c.onmouseout = function() {
ToolTipHide(pause_b.c)
}
}
}
if (cntrl[i] == 'back') {
back_b = new Element('back', 30, 20);
controlsObj.addElement('Back', back_b);
controls.appendChild(back_b.c);
CSS(back_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - back_b.h) / 2 + back_b.s.margintop - back_b.s.marginbottom
});
back_b.c.onclick = Back;
cntrls[i] = back_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + back_b.s.marginleft + back_b.s.marginright;
cntrli[i] = back_b;
if (vars.tip == 1 && back_b.s.notip == 0) {
back_b.c.onmouseover = function() {
ToolTip(back_b.c, back_b.s.tip ? back_b.s.tip : vars.lang2['back'])
};
back_b.c.onmouseout = function() {
ToolTipHide(back_b.c)
}
}
}
if (cntrl[i] == 'stop') {
stop_b = new Element('stop', 20, 20);
controlsObj.addElement('Stop', stop_b);
controls.appendChild(stop_b.c);
CSS(stop_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - stop_b.h) / 2 + stop_b.s.margintop - stop_b.s.marginbottom
});
stop_b.c.onclick = Stop;
cntrls[i] = stop_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + stop_b.s.marginleft + stop_b.s.marginright;
cntrli[i] = stop_b;
if (vars.tip == 1 && stop_b.s.notip == 0) {
stop_b.c.onmouseover = function() {
ToolTip(stop_b.c, stop_b.s.tip ? stop_b.s.tip : vars.lang2['stop'])
};
stop_b.c.onmouseout = function() {
ToolTipHide(stop_b.c)
}
}
}
if (cntrl[i].indexOf('my') == 0) {
var m = cntrl[i].substr(2);
mybuts[m] = new Element('my' + m, 20, 20);
controls.appendChild(mybuts[m].c);
CSS(mybuts[m].c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - mybuts[m].h) / 2 + mybuts[m].s.margintop - mybuts[m].s.marginbottom
});
mybuts[m].c.id = 'uppod_mybut' + m;
mybuts[m].c.onclick = function() {
Mybut(this.id)
};
cntrls[i] = mybuts[m].w + vars.cntrlmargin;
cntrlength += cntrls[i] + mybuts[m].s.marginleft + mybuts[m].s.marginright;
cntrli[i] = mybuts[m];
if (vars.tip == 1 && mybuts[m].s.notip == 0 && mybuts[m].s.tip) {
mybuts[m].c.onmouseover = function() {
ToolTip(mybuts[m].c, mybuts[m].s.tip)
};
mybuts[m].c.onmouseout = function() {
ToolTipHide(mybuts[m].c)
}
}
}
if (cntrl[i] == 'download') {
download_b = new Element('download', 20, 20);
controlsObj.addElement('Download', download_b);
controls.appendChild(download_b.c);
CSS(download_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - download_b.h) / 2 + download_b.s.margintop - download_b.s.marginbottom
});
download_b.c.onclick = Download;
cntrls[i] = download_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + download_b.s.marginleft + download_b.s.marginright;
cntrli[i] = download_b;
if (vars.tip == 1 && download_b.s.notip == 0) {
download_b.c.onmouseover = function() {
ToolTip(download_b.c, download_b.s.tip ? download_b.s.tip : vars.lang2['download'])
};
download_b.c.onmouseout = function() {
ToolTipHide(download_b.c)
}
}
}
if (cntrl[i] == 'next') {
next_b = new Element('next', 20, 20);
controlsObj.addElement('Next', next_b);
controls.appendChild(next_b.c);
CSS(next_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - next_b.h) / 2 + next_b.s.margintop - next_b.s.marginbottom
});
next_b.c.onclick = Next;
cntrls[i] = next_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + next_b.s.marginleft + next_b.s.marginright;
cntrli[i] = next_b;
if (vars.tip == 1 && next_b.s.notip == 0) {
next_b.c.onmouseover = function() {
ToolTip(next_b.c, next_b.s.tip ? next_b.s.tip : vars.lang2['next'])
};
next_b.c.onmouseout = function() {
ToolTipHide(next_b.c)
}
}
}
if (cntrl[i] == 'prev') {
prev_b = new Element('prev', 20, 20);
controlsObj.addElement('Prev', prev_b);
controls.appendChild(prev_b.c);
CSS(prev_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - prev_b.h) / 2 + prev_b.s.margintop - prev_b.s.marginbottom
});
if (vars.random == 0) {
CSS(prev_b.c, {
'opacity': 0.3,
'filter': 'alpha(opacity=30)',
'cursor': 'default'
})
}
prev_b.c.onclick = Prev;
cntrls[i] = prev_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + prev_b.s.marginleft + prev_b.s.marginright;
cntrli[i] = prev_b;
if (vars.tip == 1 && prev_b.s.notip == 0) {
prev_b.c.onmouseover = function() {
ToolTip(prev_b.c, prev_b.s.tip ? prev_b.s.tip : vars.lang2['prev'])
};
prev_b.c.onmouseout = function() {
ToolTipHide(prev_b.c)
}
}
}
if (cntrl[i] == 'time_play') {
time_play_b = new Element('time_play', 30, 20);
controlsObj.addElement('TimePlay', time_play_b);
controls.appendChild(time_play_b.c);
CSS(time_play_b.c, {
'cursor': 'default',
'position': 'absolute',
'top': (vars.cntrloutheight - time_play_b.h) / 2 + 3 + time_play_b.s.margintop * 1 - time_play_b.s.marginbottom * 1,
'white-space': 'nowrap'
});
cntrls[i] = time_play_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + time_play_b.s.marginleft + time_play_b.s.marginright;
cntrli[i] = time_play_b;
timeitems++
}
if (cntrl[i] == 'time_back') {
time_back_b = new Element('time_back', 30, 20);
controlsObj.addElement('TimeBack', time_back_b);
controls.appendChild(time_back_b.c);
CSS(time_back_b.c, {
'cursor': 'default',
'position': 'absolute',
'top': (vars.cntrloutheight - time_back_b.h) / 2 + 3 + time_back_b.s.margintop * 1 - time_back_b.s.marginbottom * 1,
'white-space': 'nowrap'
});
cntrls[i] = time_back_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + time_back_b.s.marginleft + time_back_b.s.marginright;
cntrli[i] = time_back_b;
timeitems++
}
if (cntrl[i] == 'time_all') {
time_all_b = new Element('time_all', 30, 20);
controlsObj.addElement('TimeAll', time_all_b);
controls.appendChild(time_all_b.c);
CSS(time_all_b.c, {
'cursor': 'default',
'position': 'absolute',
'top': (vars.cntrloutheight - time_all_b.h) / 2 + 3 + time_all_b.s.margintop * 1 - time_all_b.s.marginbottom * 1,
'white-space': 'nowrap'
});
cntrls[i] = time_all_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + time_all_b.s.marginleft + time_all_b.s.marginright;
cntrli[i] = time_all_b;
timeitems++
}
if (cntrl[i] == '|') {
sep_b[sep] = new Element('separator', 5, 20);
controlsObj.addElement('Separator', sep_b[sep]);
controls.appendChild(sep_b[sep].c);
CSS(sep_b[sep].c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - sep_b[sep].h) / 2 + sep_b[sep].s.margintop - sep_b[sep].s.marginbottom
});
cntrls[i] = sep_b[sep].w + vars.cntrlmargin;
cntrlength += cntrls[i] + sep_b[sep].s.marginleft + sep_b[sep].s.marginright;
cntrli[i] = sep_b[sep];
sep++
}
if (cntrl[i] == 'run_line') {
var run_s = Cntrl_Style('run');
run_b = createElement('div');
controlsObj.addDom('RunLine', run_b);
controls.appendChild(run_b);
var lh = vars.cntrlline['h'];
if (vars.cntrl_line) {
if (vars.cntrl_line['h']) {
lh = vars.cntrl_line['h']
}
}
if (run_s['position'] == 0) {
if (lh % 2 != run_s['h'] % 2) {
run_s['h']++
}
if (run_s['o'] == 1) {
run_s['w'] = run_s['h']
}
}
CSS(run_b, {
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': run_s['margintop'] * 1 - run_s['marginbottom'] * 1,
'width': run_s['w'] + 'px',
'height': run_s['h'] + 'px',
'borderRadius': (run_s['w'] * run_s['o']) + 'px',
'opacity(': run_s['alpha'],
'filter': 'alpha(opacity=' + (run_s['alpha'] * 100) + ')'
});
CheckGradiendDiv(run_b, run_s['color']);
if (run_s['icon']) {
if (String(run_s['icon']).indexOf("http") == 0) {
IconImg(run_s['icon'], run_b, 0, run_s['pic_w'], run_s['pic_h'], run_s['halficonisover'])
}
}
if (run_s['bg'] == 1) {
CSS(run_b, {
'border': '2px solid #' + ReColor(run_s['bgcolor'])
})
}
run_pos = run_s['position'];
if (vars.tip == 1 && line_s['notip'] == 0) {
run_b.onmouseover = function() {
media.duration ? ToolTip(run_b, 'line') : ''
};
run_b.onmouseout = function() {
ToolTipHide(run_b)
}
}
}
if (cntrl[i] == 'run_volume' && !mobile) {
var run_s = Cntrl_Style('run_volume');
runvolume_b = createElement('div');
controlsObj.addDom('RunVolume', runvolume_b);
controls.appendChild(runvolume_b);
CSS(runvolume_b, {
'pointer-events': 'none',
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': 0,
'width': run_s['w'] + 'px',
'height': run_s['h'] + 'px',
'borderRadius': (run_s['w'] * run_s['o']) + 'px',
'opacity': run_s['alpha'],
'filter': 'alpha(opacity=' + (run_s['alpha'] * 100) + ')'
});
CheckGradiendDiv(runvolume_b, run_s['color']);
runvolume_pos = run_s['position'];
if (vars.ivolbar_v) {
Hide(runvolume_b)
}
if (run_s['bg'] == 1) {
CSS(runvolume_b, {
'border': '2px solid #' + ReColor(run_s['bgcolor'])
})
}
}
if (cntrl[i] == 'sound' && !mobile && vars.controls.indexOf("volbarline") > -1) {
cntrl[i] = 'volume';
vars.cntrl_volume = vars.cntrl_sound
}
if ((cntrl[i] == 'volume' || cntrl[i] == 'volbarline_v') && !mobile) {
volume_b = new Element('volume', 20, 20);
controlsObj.addElement('Volume', volume_b);
controls.appendChild(volume_b.c);
CSS(volume_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - volume_b.h) / 2 + volume_b.s.margintop - volume_b.s.marginbottom
});
volume_b.c.onclick = Mute;
volume_mute_b = new Element('volume_mute', 20, 20, '', 'volume');
controlsObj.addElement('VolumeMute', volume_mute_b);
controls.appendChild(volume_mute_b.c);
CSS(volume_mute_b.c, {
'display': 'none',
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - volume_mute_b.h) / 2 + volume_mute_b.s.margintop - volume_mute_b.s.marginbottom
});
cntrls[i] = volume_mute_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + volume_mute_b.s.marginleft + volume_mute_b.s.marginright;
volume_mute_b.c.onclick = Mute;
cntrli[i] = volume_b;
if (vars.tip == 1 && volume_b.s.notip == 0) {
volume_b.c.addEventListener("mouseover", function() {
var txt = vars.lang2['sound'];
ToolTip(volume_b.c, txt)
});
volume_b.c.addEventListener("mouseout", function() {
ToolTipHide(volume_b.c)
});
volume_mute_b.c.addEventListener("mouseover", function() {
var txt = vars.lang2['sound_off'];
ToolTip(volume_mute_b.c, txt)
});
volume_mute_b.c.addEventListener("mouseout", function() {
ToolTipHide(volume_mute_b.c)
})
}
if (cntrl[i] == 'volbarline_v') {
vars.ivolbar_v = true;
volbarline_b = createElement('div');
controlsObj.addDom('VolumeBarlineV', volbarline_b);
controls.appendChild(volbarline_b);
vars.cntrl_volbarline_v.bg = 0;
CSS(volbarline_b, {
'cursor': 'pointer',
'position': 'absolute',
'top': 0
});
volbarline_s = Cntrl_Style('volbarline_v');
volbarline_all_b = createElement('div');
volbarline_b.appendChild(volbarline_all_b);
CSS(volbarline_all_b, {
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': 0,
'width': volbarline_s['w'],
'height': volbarline_s['h'],
'borderRadius': ((volbarline_s['h'] / 2) * volbarline_s['o']) + 'px',
'opacity': volbarline_s['all_a'],
'filter': 'alpha(opacity=' + (volbarline_s['all_a'] * 100) + ')'
});
CheckGradiendDiv(volbarline_all_b, volbarline_s['color_all']);
volbarline_s['active'] = false;
CSS(volbarline_b, {
'display': 'none',
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - volbarline_s['h']) - 10
});
volbarline_play_b = createElement('div');
volbarline_b.appendChild(volbarline_play_b);
CSS(volbarline_play_b, {
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': 0,
'width': volbarline_s['w'],
'height': volbarline_s['h'],
'borderRadius': ((volbarline_s['h'] / 2) * volbarline_s['o']) + 'px',
'opacity': volbarline_s['play_a'],
'filter': 'alpha(opacity=' + (volbarline_s['play_a'] * 100) + ')'
});
if (volbarline_s['color_load']) {
volbarline_s['color_play'] = volbarline_s['color_load']
}
CheckGradiendDiv(volbarline_play_b, volbarline_s['color_play']);
CSS(volbarline_b, {
'cursor': 'pointer',
'position': 'absolute',
'top': (-volbarline_s['h'])
});
CSS(volbarline_play_b, {
'height': volbarline_s['h'] * vars.volume,
'top': volbarline_s['h'] - volbarline_s['h'] * vars.volume
});
volbarline_b.onmousedown = function VolbarlineDown(e) {
volbarline_s['active'] = true;
if (!e) var e = window.event;
VolumeMove_v(e)
};
volbarline_b.onmousemove = function VolbarlineMove(e) {
if (!e) var e = window.event;
VolumeMove_v(e)
};
volbarline_b.onmouseup = function VolbarlineUp(e) {
volbarline_s['active'] = false
};
volbarline_b.onmouseover = function VolbarlineOver(e) {
volbarline_s['over'] = true
};
volbarline_b.onmouseout = function VolbarlineOut(e) {
volbarline_s['over'] = false
};
volume_mute_b.c.addEventListener("mouseover", VolumeButOver);
volume_b.c.addEventListener("mouseout", VolumeButOver);
volume_mute_b.c.addEventListener("mouseout", VolumeButOver);
volume_b.c.addEventListener("mouseover", VolumeButOver);
volume_mute_b.c.onmouseout = volume_b.c.onmouseout = VolbarHide;
volbarline_b.style.zIndex = 7;
if (runvolume_b) {
Hide(runvolume_b)
}
}
}
if (cntrl[i] == 'tune' && !mobile) {
cntrl[i] = 'volbarline';
vars.cntrl_volbarline = vars.cntrl_tune
}
if (cntrl[i] == 'volbarline' && !mobile) {
volbarline_b = createElement('div');
controlsObj.addDom('VolumeBarline', volbarline_b);
controls.appendChild(volbarline_b);
volbarline_s = Cntrl_Style('volbarline');
var volbarline_bg_b = createElement('div');
volbarline_b.appendChild(volbarline_bg_b);
CSS(volbarline_bg_b, {
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': -10,
'width': volbarline_s['w'],
'height': (volbarline_s['h'] + 20),
'opacity': '0',
'filter': 'alpha(opacity=0)'
});
volbarline_all_b = createElement('div');
volbarline_b.appendChild(volbarline_all_b);
CSS(volbarline_all_b, {
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': 0,
'width': volbarline_s['w'],
'height': volbarline_s['h'],
'borderRadius': ((volbarline_s['h'] / 2) * volbarline_s['o']) + 'px',
'opacity': volbarline_s['all_a'],
'filter': 'alpha(opacity=' + (volbarline_s['all_a'] * 100) + ')'
});
CheckGradiendDiv(volbarline_all_b, volbarline_s['color_all']);
volbarline_s['active'] = false;
volbarline_play_b = createElement('div');
volbarline_b.appendChild(volbarline_play_b);
CSS(volbarline_play_b, {
'cursor': 'pointer',
'position': 'absolute',
'left': 0,
'top': 0,
'height': volbarline_s['h'],
'borderRadius': ((volbarline_s['h'] / 2) * volbarline_s['o']) + 'px',
'opacity': volbarline_s['play_a'],
'filter': 'alpha(opacity=' + (volbarline_s['play_a'] * 100) + ')'
});
if (volbarline_s['color_load']) {
volbarline_s['color_play'] = volbarline_s['color_load']
}
CheckGradiendDiv(volbarline_play_b, volbarline_s['color_play']);
CSS(volbarline_b, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - volbarline_s['h']) / 2 + volbarline_s['margintop'] - volbarline_s['marginbottom']
});
cntrls[i] = volbarline_s['w'] + vars.cntrlmargin + 5;
cntrlength += cntrls[i] + volbarline_s['marginleft'] + volbarline_s['marginright'];
CSS(volbarline_play_b, {
'width': volbarline_s['w'] * (v ? v : vars.volume)
});
volbarline_b.onmousedown = function(e) {
volbarline_s['active'] = true;
if (!e) var e = window.event;
VolumeMove(e)
};
volbarline_b.onmousemove = function(e) {
if (!e) var e = window.event;
VolumeMove(e)
};
volbarline_b.onmouseout = function(e) {
if (!e) var e = window.event;
VolumeOut(e)
};
volbarline_b.onmouseup = function(e) {};
cntrli[i] = volbarline_b
}
if (cntrl[i] == 'volbar' && !mobile) {
volbar_b = createElement('div');
controlsObj.addDom('VolumeBar', volbar_b);
controls.appendChild(volbar_b);
volbars = [];
vars.cntrl_volbar.all_a ? vars.cntrlvolbar.all_a = vars.cntrl_volbar.all_a : '';
vars.cntrl_volbar.play_a ? vars.cntrlvolbar.play_a = vars.cntrl_volbar.play_a : '';
if (vars.cntrl_volbar.icon) {
if (vars.cntrl_volbar.icon == 1) {
vars.cntrlvolbar.n = 10;
vars.cntrlvolbar.bar = 1
}
if (vars.cntrl_volbar.icon == 2) {
vars.cntrlvolbar.n = 5;
vars.cntrlvolbar.bar = 0
}
if (vars.cntrl_volbar.icon == 3) {
vars.cntrlvolbar.n = 10;
vars.cntrlvolbar.bar = 0
}
}
vars.cntrl_volbar.n ? vars.cntrlvolbar.n = vars.cntrl_volbar.n : '';
vars.cntrl_volbar.bar ? vars.cntrlvolbar.bar = vars.cntrl_volbar.bar : '';
vars.cntrl_volbar.scale ? vars.cntrlvolbar.scale = vars.cntrl_volbar.scale : '';
vars.cntrl_volbar.margintop ? vars.cntrlvolbar.margintop = vars.cntrl_volbar.margintop : vars.cntrlvolbar.margintop = 0;
vars.cntrl_volbar.marginbottom ? vars.cntrlvolbar.marginbottom = vars.cntrl_volbar.marginbottom : vars.cntrlvolbar.marginbottom = 0;
vars.cntrlvolbar.w = vars.cntrlvolbar.n * 5 * vars.cntrlvolbar.scale;
vars.cntrlvolbar.h = 10 * vars.cntrlvolbar.scale;
for (vb = 0; vb < vars.cntrlvolbar.n; vb++) {
var vbh = (vars.cntrlvolbar.bar == 1 ? (10 / vars.cntrlvolbar.n) * (vb + 1) : 10 * vars.cntrlvolbar.scale);
volbars[vb] = new Element('volbar', 3 * vars.cntrlvolbar.scale, vbh);
volbar_b.appendChild(volbars[vb].c);
CSS(volbars[vb].c, {
'position': 'absolute',
'top': 10 * vars.cntrlvolbar.scale - vbh * vars.cntrlvolbar.scale,
'left': vb * 5 * vars.cntrlvolbar.scale + 10 * (vars.cntrlvolbar.scale - 1),
'opacity': vars.cntrlvolbar.all_a
});
if (vars.cntrl_volbar.bar == 1) {
volbars[vb].c.onmouseover = function(e) {
CSS(this, {
'top': vbh - 1
})
};
volbars[vb].c.onmouseout = function(e) {
CSS(this, {
'top': vbh
})
}
}
};
volbar_b.onmousedown = function(e) {
volbar_b.active = true;
if (!e) var e = window.event;
VolbarMove(e)
};
volbar_b.onmousemove = function(e) {
if (!e) var e = window.event;
VolbarMove(e)
};
volbar_b.onmouseup = function(e) {
volbar_b.active = false
};
CSS(volbar_b, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - vars.cntrlvolbar.h) / 2 + (vars.cntrlvolbar.h - 10) * vars.cntrlvolbar.scale + vars.cntrlvolbar.margintop - vars.cntrlvolbar.marginbottom,
'width': vars.cntrlvolbar.w,
'height': vars.cntrlvolbar.h
});
cntrls[i] = (vars.cntrlvolbar.n + 1) * 5 + vars.cntrlmargin;
cntrlength += cntrls[i] + (vars.cntrlvolbar.marginleft ? vars.cntrlvolbar.marginleft : 0) + (vars.cntrlvolbar.marginright ? vars.cntrlvolbar.marginright : 0);
cntrli[i] = volbar_b;
v != 0 ? VolumeDraw(-v) : ''
}
if (cntrl[i] == 'full') {
controlsObj.add(new Uppod.EnterFullscreenControl(uppod));
controlsObj.add(new Uppod.ExitFullscreenControl(uppod));
full_b = uppod.controls().EnterFullscreen.options.element;
full_back_b = uppod.controls().ExitFullscreen.options.element;
cntrls[i] = full_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + full_b.s.marginleft + full_b.s.marginright;
cntrli[i] = full_b;
if (vars.tip == 1 && full_b.s.notip == 0) {
full_b.c.onmouseover = function() {
ToolTip(full_b.c, (full_b.s.tip ? full_b.s.tip : vars.lang2['full']))
};
full_b.c.onmouseout = function() {
ToolTipHide(full_b.c)
};
full_back_b.c.onmouseover = function() {
ToolTip(full_back_b.c, (full_back_b.s.tip ? full_back_b.s.tip : vars.lang2['full_back']))
};
full_back_b.c.onmouseout = function() {
ToolTipHide(full_back_b.c)
}
}
}
if (cntrl[i] == 'sub') {
sub_b = new Element('sub', 20, 20);
controlsObj.addElement('Sub', sub_b);
controls.appendChild(sub_b.c);
CSS(sub_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - sub_b.h) / 2 + sub_b.s.margintop - sub_b.s.marginbottom
});
sub_b.c.onclick = SetSub;
cntrls[i] = sub_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + sub_b.s.marginleft + sub_b.s.marginright;
cntrli[i] = sub_b;
if (vars.tip == 1 && sub_b.s.notip == 0) {
sub_b.c.onmouseover = function() {
ToolTip(sub_b.c, sub_b.s.tip ? sub_b.s.tip : vars.lang2['sub'])
};
sub_b.c.onmouseout = function() {
ToolTipHide(sub_b.c)
}
}
vars.substart == 0 ? CSS(sub_b.c, {
'opacity': sub_b.s.alpha0
}) : ''
}
if (cntrl[i] == 'hd') {
if (vars.youtube) {
vars.hdlinks = 'hd720,large,medium,small,auto';
vars.hd = '720p,480p,320p,240p,auto';
vars.hdsw == 60 ? vars.hdsw = 55 : '';
vars.filehd = ''
}
if (vars.hd || vars.filehd != '') {
var isbutton = false;
if (vars.hd) {
vars.hd.indexOf('::') > -1 ? isbutton = true : ''
} else {
vars.filehd != '' ? isbutton = true : ''
}
if (isbutton) {
hd_b = new Element('hd', 20, 20);
controlsObj.addElement('Hd', hd_b);
controls.appendChild(hd_b.c);
CSS(hd_b.c, {
'cursor': 'pointer',
'display': (vars.hd1 == 1 ? 'none' : 'block'),
'position': 'absolute',
'top': Math.floor((vars.cntrloutheight - hd_b.h) / 2 + hd_b.s.margintop - hd_b.s.marginbottom)
});
if (hd_b.s.icon2) {
if (hd_b.s.icon == hd_b.s.icon2) {
CSS(hd_b.c, {
'opacity': hd_b.s.alpha0
})
}
}
cntrls[i] = hd_b.w + vars.cntrlmargin;
hd_b.c.onclick = Quality;
cntrlength += cntrls[i] + hd_b.s.marginleft + hd_b.s.marginright;
cntrli[i] = hd_b;
if (vars.tip == 1 && hd_b.s.notip == 0) {
hd_b.c.onmouseover = function() {
ToolTip(hd_b.c, hd_b.s.tip ? hd_b.s.tip : vars.lang2['hd'])
};
hd_b.c.onmouseout = function() {
ToolTipHide(hd_b.c)
}
}
hd1_b = new Element('hd1', 20, 20, '', 'hd');
controlsObj.addElement('Hd1', hd1_b);
controls.appendChild(hd1_b.c);
CSS(hd1_b.c, {
'cursor': 'pointer',
'display': (vars.hd1 == 1 ? 'block' : 'none'),
'position': 'absolute',
'top': Math.floor((vars.cntrloutheight - hd1_b.h) / 2 + hd1_b.s.margintop - hd1_b.s.marginbottom)
});
hd1_b.c.onclick = Quality;
if (vars.tip == 1 && hd1_b.s.notip == 0) {
hd1_b.c.onmouseover = function() {
ToolTip(hd1_b.c, hd_b.s.tip_off ? hd_b.s.tip_off : vars.lang2['hd'])
};
hd1_b.c.onmouseout = function() {
ToolTipHide(hd1_b.c)
}
}
} else {
if (vars.hd.indexOf(',') > -1) {
vars.hda = vars.hd.split(',');
if (vars.hdsw == 60 && vars.hlsautoquality == 0) {
vars.hdsw = 0;
for (var h = 0; h < vars.hda.length; h++) {
vars.hdsw < measureText(vars.hda[h], 12).width ? vars.hdsw = measureText(vars.hda[h], 12).width : ''
}
vars.hdsw += 22
}
hd_b = new Element('hdselect', vars.hdsw, 20, '', 'hd');
controlsObj.addElement('HdSelect', hd_b);
controls.appendChild(hd_b.c);
CSS(hd_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': Math.floor((vars.cntrloutheight - hd_b.h) / 2 + hd_b.s.margintop - hd_b.s.marginbottom)
});
cntrls[i] = hd_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + hd_b.s.marginleft + hd_b.s.marginright;
cntrli[i] = hd_b;
vars.tip == 1 && hd_b.s.notip == 0 ? hd_b.c.title = (hd_b.s.tip ? hd_b.s.tip : vars.lang2['hd']) : '';
hdselect = document.createElement('select');
hd_b.c.appendChild(hdselect);
HdSelect();
CSS(hdselect, {
'position': 'absolute',
'margin': '1px 0px 0px -5px',
'opacity': 0,
'cursor': 'pointer',
"width": vars.hdsw
});
hdselect.onchange = QualitySelecter
}
}
}
}
if (cntrl[i] == 'playlist') {
if (vars.pl != '') {
playlist_b = new Element('playlist', 20, 20);
controlsObj.addElement('Playlist', playlist_b);
controls.appendChild(playlist_b.c);
CSS(playlist_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - playlist_b.h) / 2 + playlist_b.s.margintop - playlist_b.s.marginbottom
});
playlist_b.c.onclick = Pl;
cntrls[i] = playlist_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + playlist_b.s.marginleft + playlist_b.s.marginright;
cntrli[i] = playlist_b;
if (vars.tip == 1 && playlist_b.s.notip == 0) {
playlist_b.c.onmouseover = function() {
ToolTip(playlist_b.c, playlist_b.s.tip ? playlist_b.s.tip : vars.lang2['list'])
};
playlist_b.c.onmouseout = function() {
ToolTipHide(playlist_b.c)
}
}
}
}
if (cntrl[i] == 'menu') {
menu_b = new Element('menu', 20, 20);
controlsObj.addElement('Menu', menu_b);
controls.appendChild(menu_b.c);
CSS(menu_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': (vars.cntrloutheight - menu_b.h) / 2 + menu_b.s.margintop - menu_b.s.marginbottom
});
menu_b.c.onclick = Menu;
cntrls[i] = menu_b.w + vars.cntrlmargin;
cntrlength += cntrls[i] + menu_b.s.marginleft + menu_b.s.marginright;
cntrli[i] = menu_b;
if (vars.tip == 1 && menu_b.s.notip == 0) {
menu_b.c.onmouseover = function() {
ToolTip(menu_b.c, menu_b.s.tip ? menu_b.s.tip : vars.lang2['menu'])
};
menu_b.c.onmouseout = function() {
ToolTipHide(menu_b.c)
}
}
}
if (cntrl[i] == 'buffer') {
if (line_b) {
buffer_b = new Element('buffer', 30, 14);
controlsObj.addElement('Buffer', buffer_b);
controls.appendChild(buffer_b.c);
CSS(buffer_b.c, {
'cursor': 'default',
'position': 'absolute',
'white-space': 'nowrap'
});
cntrli[i] = buffer_b;
cntrls[i] = 0;
buffer_b.c.innerHTML = vars.lang2['loading']
}
}
if (cntrl[i] == 'start') {
if (vars.m == 'video' && nativecontrols) {} else {
start_b = new Element('start', 20, 20);
controlsObj.addElement('Start', start_b);
body.c.appendChild(start_b.c);
CSS(start_b.c, {
'cursor': 'pointer',
'position': 'absolute',
'top': ((vars.ph) / 2 - start_b.h / 2),
'left': ((vars.sw) / 2 - start_b.w / 2),
'zIndex': 7
});
start_b.c.onclick = Toggle;
start_b.c.style.zIndex = 7
}
}
if (cntrl[i] == 'space') {
space_b = createElement('div');
controlsObj.addDom('Space', space_b);
controls.appendChild(space_b);
CSS(space_b, {
'position': 'absolute',
'top': (vars.cntrloutheight - 20) / 2
});
cntrli[i] = space_b
}
if (cntrl[i] == 'line') {
iline = true;
line_b = createElement('div');
controlsObj.addDom('Line', line_b);
controls.appendChild(line_b);
line_s = Cntrl_Style('line');
line_all_b = createElement('div');
line_b.appendChild(line_all_b);
CSS(line_all_b, {
'position': 'absolute',
'left': 0,
'top': 0,
'width': '100%',
'height': line_s['h'],
'borderRadius': ((line_s['h'] / 2) * line_s['o']) + 'px',
'opacity': line_s['all_a'],
'filter': 'alpha(opacity=' + (line_s['all_a'] * 100) + ')'
});
CheckGradiendDiv(line_all_b, line_s['color_all']);
line_load_b = createElement('div');
line_b.appendChild(line_load_b);
CSS(line_load_b, {
'position': 'absolute',
'left': 0,
'top': 0,
'width': '100%',
'height': line_s['h'],
'backgroundColor': '#' + ReColor(line_s['color_load']),
'borderRadius': ((line_s['h'] / 2) * line_s['o']) + 'px',
'opacity': line_s['load_a'],
'filter': 'alpha(opacity=' + (line_s['load_a'] * 100) + ')'
});
CheckGradiendDiv(line_load_b, line_s['color_load']);
line_play_b = createElement('div');
line_b.appendChild(line_play_b);
CSS(line_play_b, {
'position': 'absolute',
'left': 0,
'top': 0,
'width': '100%',
'height': line_s['h'],
'backgroundColor': '#' + ReColor(line_s['color_play']),
'borderRadius': ((line_s['h'] / 2) * line_s['o']) + 'px',
'opacity': line_s['play_a'],
'filter': 'alpha(opacity=' + (line_s['play_a'] * 100) + ')'
});
CheckGradiendDiv(line_play_b, line_s['color_play']);
CSS(line_b, {
'position': 'absolute',
'top': (vars.cntrloutheight - line_s['h']) / 2 + line_s['margintop'] * 1 - line_s['marginbottom'] * 1,
'cursor': 'pointer'
});
CSS(line_play_b, {
'width': '0'
});
CSS(line_load_b, {
'width': '0'
});
line_s['active'] = false;
line_but_b = createElement('div');
controlsObj.addDom('LineBtn', line_but_b);
controls.appendChild(line_but_b);
CSS(line_but_b, {
'position': 'absolute',
'height': (line_s['h'] < 10 ? 20 : line_s['h'] * 2),
'cursor': 'pointer'
});
line_but_b.onmousedown = function(e) {
Uppod.trace('line_but_b.onmousedown');
if (!istart) {
Toggle()
}
line_s['active'] = true;
if (!e) var e = window.event
};
line_but_b.onmouseup = function(e) {
Uppod.trace('line_but_b.onmouseup');
if (istart) {
SeekMove(e);
line_s['active'] = false
}
};
if (vars.tip == 1 && line_s['notip'] == 0) {
line_but_b.onmouseover = function() {
ToolTip(line_but_b, 'line')
};
line_but_b.onmouseout = function() {
ToolTipHide(line_but_b)
}
}
cntrli[i] = line_b
}
}
time_all_b && vars.time > 0 ? time_all_b.c.innerHTML = formatTime(vars.time) : '';
PlaceControls()
}
function CntrlBg() {
if (uibg) {
Remove('uibg')
}
if (vars.cntrlout != 1 && vars.cntrlbg == 1) {
vars.cntrlbgcolor.indexOf('|') == -1 ? vars.cntrlbgcolor = vars.cntrlbgcolor + '|' + vars.cntrlbgcolor : '';
uibg = new Shaper2({
w: (vars.scrn_w - vars.cntrlbgmargin * 2 - vars.cntrlbgmarginleft - vars.cntrlbgmarginright),
h: vars.cntrloutheight,
onotop: (vars.cntrloutheight == vars.h ? 0 : 1),
bgc: vars.cntrlbgcolor,
bga1: vars.cntrlbgalpha1,
bga2: vars.cntrlbgalpha2,
o: (vars.padding > 0 ? vars.o / 2 : vars.cntrlbgo)
})
}
if (vars.cntrlout == 1 && vars.padding == 0) {
vars.cntrlbgcolor.indexOf('|') == -1 ? vars.cntrlbgcolor = vars.cntrlbgcolor + '|' + vars.cntrlbgcolor : '';
uibg = new Shaper2({
w: vars.scrn_w,
h: vars.cntrloutheight,
o: vars.o / 2 - vars.padding,
onotop: (vars.cntrloutheight == vars.h ? 0 : 1),
bgc: vars.bodycolor,
bga1: 1,
bga2: 1,
o: (vars.padding > 0 ? vars.o / 2 : vars.cntrlbgo)
})
}
if (uibg) {
uibg.c.setAttribute('id', 'uibg');
controls.appendChild(uibg.c);
CSS(uibg.canvas, {
"position": "absolute",
"top": 0,
"left": vars.cntrlbgmarginleft + 'px'
});
if (vars.glass == 1) {
uibg_gl = new Shaper2({
w: vars.scrn_w,
h: vars.cntrloutheight / 2,
o: vars.o / 2 - vars.padding,
bgc: (vars.glasscolor.indexOf('|') == -1 ? vars.glasscolor + '|' + vars.glasscolor : vars.glasscolor),
bga1: vars.glassalpha1,
bga2: vars.glassalpha2
});
uibg.c.appendChild(uibg_gl.c);
CSS(uibg_gl.canvas, {
"position": "absolute",
"top": 0,
"left": 0,
"height": vars.cntrloutheight / 2,
"width": vars.scrn_w
})
}
}
}
function PlaceControls() {
var line_w = vars.sw - cntrlength - vars.cntrlendmargin * 2 - vars.cntrlmargin * 2 - (!ifull ? vars.padding * 2 : 0) - vars.cntrlmarginleft - vars.cntrlmarginright - (timelength - 4) * 4 * timeitems;
var cntrl_x = vars.cntrlendmargin + vars.cntrlmarginleft;
var marginleft;
var marginright;
for (i = 0; i < cntrl.length; i++) {
if (cntrli[i]) {
marginleft = 0;
marginright = 0;
if (cntrli[i].s) {
marginleft = parseInt(cntrli[i].s.marginleft);
marginright = parseInt(cntrli[i].s.marginright)
}
if (cntrl[i] == 'volbarline') {
marginleft = (vars.cntrl_volbarline.marginleft ? vars.cntrl_volbarline.marginleft : 0);
marginright = (vars.cntrl_volbarline.marginright ? vars.cntrl_volbarline.marginright : 0)
}
cntrl_x += marginleft;
if (cntrli[i] != line_b && cntrli[i] != space_b) {
CSS((cntrli[i].c != undefined ? cntrli[i].c : cntrli[i]), {
'left': cntrl_x
});
if (cntrl[i] == 'play' || cntrl[i] == 'playstop') {
CSS(pause_b.c, {
'left': cntrl_x
})
}
if (cntrl[i] == 'full') {
CSS(full_back_b.c, {
'left': cntrl_x
})
}
if (cntrl[i] == 'hd') {
hd1_b ? CSS(hd1_b.c, {
'left': cntrl_x
}) : ''
}
if (cntrl[i] == 'volume' || cntrl[i] == 'volbarline_v') {
CSS(volume_mute_b.c, {
'left': cntrl_x,
'opacity': (volume_mute_b.s.icon == 2 ? 0.5 : 1)
})
}
if (cntrl[i] == 'volbarline_v') {
CSS(volbarline_b, {
'left': cntrl_x + volume_b.w / 2 - volbarline_s['w'] / 2
})
}
if (cntrl[i].indexOf('time') > -1) {
cntrl_x += (timelength - 4) * 4 + (vars.cntrlmargin - 5)
}
cntrl_x += Math.floor(cntrls[i] + marginright)
} else {
if (cntrli[i] == line_b) {
if (vars.cntrl_line.full == 1) {
CSS(line_b, {
'left': (vars.cntrl_line.marginleft ? vars.cntrl_line.marginleft : 0),
'top': (vars.cntrloutheight) / 2 + line_all_b.h - (vars.cntrl_line.marginbottom ? vars.cntrl_line.marginbottom : 0) + (vars.cntrl_line.margintop ? vars.cntrl_line.margintop : 0)
});
line_all_b.w = vars.sw - (vars.cntrl_line.marginleft ? vars.cntrl_line.marginleft : 0) - (vars.cntrl_line.marginright ? vars.cntrl_line.marginright : 0);
line_play_b.w = line_all_b.w;
line_load_b.w = line_all_b.w;
CSS(line_all_b, {
'width': '' + line_all_b.w + 'px'
})
} else {
CSS(line_b, {
'left': cntrl_x + 3 + (vars.cntrl_line.marginleft ? vars.cntrl_line.marginleft : 0)
});
line_all_b.w = line_w;
line_play_b.w = line_w;
line_load_b.w = line_w;
CSS(line_all_b, {
'width': '' + line_w + 'px'
});
cntrls[i] = line_w;
cntrl_x += Math.floor(cntrls[i] + vars.cntrlmargin + 6 + (vars.cntrl_line.marginright ? vars.cntrl_line.marginright : 0) + (vars.cntrl_line.marginleft ? vars.cntrl_line.marginleft : 0))
}
CSS(line_but_b, {
'width': line_all_b.w + 'px',
'position': 'absolute',
'top': (parseInt(line_b.style.top) + line_s.h / 2 - parseInt(line_but_b.style.height) / 2),
'left': line_b.style.left,
'cursor': 'pointer'
})
}
if (cntrli[i] == space_b) {
CSS(space_b, {
'left': cntrl_x + 3,
'width': '' + line_w + 'px'
});
cntrls[i] = line_w;
cntrl_x += Math.floor(cntrls[i] + vars.cntrlmargin + 6)
}
}
if (buffer_b) {
CSS(buffer_b.c, {
'left': line_b.offsetLeft
});
CSS(buffer_b.c, {
'top': line_b.offsetTop - 10
})
}
}
}
line_b && run_b ? RunPos(run_b, line_b, line_play_b, line_all_b, run_pos) : '';
if (volbarline_b && runvolume_b) {
RunPos(runvolume_b, volbarline_b, volbarline_play_b, volbarline_all_b, runvolume_pos)
}
}
function RunPos(run, line, line_play, line_all, pos) {
if (run == runvolume_b && vars.ivolbar_v) {
var rl = (-line_play.offsetHeight) - (pos > 0 ? run.offsetHeight : run.offsetHeight / 2);
rl < line.offsetTop ? rl = line.offsetTop : '';
rl > 0 + run.offsetHeight ? rl = run.offsetHeight : '';
CSS(run, {
'top': rl + 'px',
'left': '' + (line.offsetLeft + line_all.offsetWidth / 2 - run.offsetWidth / 2 - (pos == '1' ? run.offsetWidth / 2 + line_all.offsetWidth / 2 : 0) + (pos == '2' ? run.offsetWidth / 2 + line_all.offsetWidth / 2 : 0)) + 'px'
})
} else {
var rl = (line_play.offsetWidth + line.offsetLeft) - (pos > 0 ? run.offsetWidth : run.offsetWidth / 2);
rl < line.offsetLeft ? rl = line.offsetLeft : '';
rl > line.offsetLeft + line_all.offsetWidth - run.offsetWidth ? rl = line.offsetLeft + line_all.offsetWidth - run.offsetWidth : '';
CSS(run, {
'left': rl + 'px',
'top': '' + Math.floor(line_all.offsetTop + line.offsetTop + line_all.offsetHeight / 2 - run.offsetHeight / 2 - (pos == '1' ? run.offsetHeight / 2 + line_all.offsetHeight / 2 : 0) + (pos == '2' ? run.offsetHeight / 2 + line_all.offsetHeight / 2 : 0) + (vars.cntrl_run['margintop'] ? vars.cntrl_run['margintop'] * 1 : "") - (vars.cntrl_run['marginbottom'] ? vars.cntrl_run['marginbottom'] * 1 : "")) + 'px'
})
}
}
function Cntrl_Style(st) {
var s = [];
for (var key in vars.cntrlstyle) {
s[key] = vars.cntrlstyle[key]
}
for (var key in vars['cntrl' + st]) {
s[key] = vars['cntrl' + st][key]
}
for (var key in vars['cntrl_' + st]) {
s[key] = vars['cntrl_' + st][key]
}
return s
}
function findLeft(obj) {
var curleft = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft;
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
}
}
var body_style = window.getComputedStyle(document.body, null);
var bodyleft = 0;
if (body_style.position == "relative") {
bodyleft = document.body.getBoundingClientRect().left
}
return curleft + bodyleft
}
function findTop(obj) {
var curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop;
while (obj = obj.offsetParent) {
curtop += obj.offsetTop
}
}
return curtop
}
function VolumeButOver() {
CSS(volbarline_b, {
"display": "block"
});
if (runvolume_b) {
CSS(runvolume_b, {
"display": "block"
});
runvolume_b.style.zIndex = 8;
RunPos(runvolume_b, volbarline_b, volbarline_play_b, volbarline_all_b, runvolume_pos)
}
volbarline_s['over'] = true
}
function VolbarHide() {
volbarline_s['over'] = false;
setTimeout(VolbarHideProcess, 1000)
}
function VolbarHideProcess() {
if (!volbarline_s['over']) {
CSS(volbarline_b, {
"display": "none"
});
if (runvolume_b) {
CSS(runvolume_b, {
"display": "none"
})
}
} else {
setTimeout(VolbarHideProcess, 1000)
}
}
function VolumeMove(e) {
if (volbarline_s['active']) {
if (!e) var e = window.event;
var clickX = e.pageX - findLeft(volbarline_b);
Volume(clickX)
}
}
function VolumeOut(e) {
if (volbarline_s['active']) {
if (!e) var e = window.event;
var clickX = e.pageX - findLeft(volbarline_b);
if (clickX >= volbarline_s['w']) {
volbarline_s['active'] = false
}
}
}
function VolumeMove_v(e) {
if (volbarline_s['active'] && vars.ivolbar_v) {
if (!e) var e = window.event;
var clickY = e.pageY - findTop(volbarline_b);
Volume(volbarline_s['h'] - clickY)
}
}
function VolbarMove(e) {
if (volbar_b.active) {
if (!e) var e = window.event;
var clickX = e.pageX - findLeft(volbar_b);
Volume(clickX)
}
}
function Volume(n) {
var v = VolumeDraw(n);
VolumeN(v);
if (vars.remvolume == 1) {
document.cookie = "uppodhtml5_volume=" + v + "; path=/; expires=Mon, 01-Jan-2099 00:00:00 GMT"
}
}
function VolumeDraw(n) {
if (volbarline_play_b) {
if (vars.ivolbar_v) {
n > 0 ? v = Math.max(0, Math.min(1, (n) / volbarline_s['h'])) : v = -n;
CSS(volbarline_play_b, {
'height': '' + volbarline_s['h'] * v + 'px',
'top': volbarline_s['h'] - volbarline_s['h'] * v
})
} else {
n > 0 ? v = Math.max(0, Math.min(1, (n) / volbarline_s['w'])) : v = -n;
CSS(volbarline_play_b, {
'width': '' + (volbarline_s['w'] * v) + 'px'
})
}
}
if (volbar_b) {
for (vb = 0; vb < volbars.length; vb++) {
n > 0 ? v = Math.max(0, Math.min(1, (n) / vars.cntrlvolbar.w)) : v = -n;
if (vb < Math.ceil(volbars.length * v)) {
CSS(volbars[vb].c, {
"opacity": vars.cntrlvolbar.play_a
})
} else {
CSS(volbars[vb].c, {
"opacity": vars.cntrlvolbar.all_a
})
}
}
}
volbarline_b && runvolume_b ? RunPos(runvolume_b, volbarline_b, volbarline_play_b, volbarline_all_b, runvolume_pos) : '';
return v
}
function VolumeN(v) {
if (muted && v > 0) {
Mute();
if (isYoutube()) {
media_yt.unMute()
}
}
v > 0 ? muted = false : muted = true;
if (isYoutube()) {
media_yt.setVolume(v * 100)
} else {
media.volume = v;
media ? media.muted = false : ''
}
MuteControl()
}
function SeekMove(e) {
var clickX = e.pageX - findLeft(line_b);
var obj = line_b;
Uppod.trace('SeekMove clickX = ' + clickX);
if (line_s['active']) {
if (!e) var e = window.event;
Seek(clickX)
}
}
function Seek(cursorX) {
Uppod.trace('Seek cursorX = ' + cursorX);
if (iline) {
var percent = Math.max(0, Math.min(1, (cursorX) / line_all_b.w))
} else {
var percent = 0
}
if (isYoutube()) {
media_yt.seekTo(percent * media_yt.getDuration())
} else {
if (media && media.duration) {
SeekTime(percent * media.duration)
}
}
StopSub()
}
function SeekTime(t) {
Uppod.trace('SeekTime to ' + t);
if (media) {
if (media.duration) {
media.currentTime = t
}
}
}
function IconImg() {
return Uppod.IconImg.apply(this, arguments)
}
function CheckBase64() {
return Uppod.CheckBase64.apply(this, arguments)
}
function CSS() {
return Uppod.setStyle.apply(this, arguments)
}
function destroyCanvases() {
for (var i = 0; i < canvasObjs.length; i++) {
var canvasObj = canvasObjs[i];
if (canvasObj) {
canvasObj.canvas = null
}
}
}
this.destroy = function() {
if (uppod.ads()) {
uppod.ads().destroy()
}
if (isYoutube()) {
media_yt.destroy()
} else {
DestroyMedia()
}
elems = uppod.document.querySelectorAll('*');
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
if (elem.parentNode) {
elem.parentNode.removeChild(elem)
}
}
destroyCanvases();
if (uppod.iframe.parentNode) {
uppod.iframe.parentNode.removeChild(uppod.iframe)
}
};
this.getStatus = function() {
return !istart ? 0 : (ibuff ? 3 : (iplay ? 1 : 2))
};
this.Play = function(s) {
if (s) {
ClearOldVars();
NewFile(s, true)
} else {
!iplay ? Toggle() : ''
}
};
this.Init = function(s) {
Init()
};
this.Pause = function() {
iplay ? Toggle() : ''
};
this.Toggle = function() {
Toggle()
};
this.Stop = function() {
init ? Stop() : ''
};
this.Seek = function(s) {
init ? SeekTime(s) : ''
};
this.Download = function() {
init ? Download() : ''
};
this.Resize = function() {
Resize()
};
this.Alert = function(s) {
Alert(s, true)
};
this.CloseAlert = function(s) {
CloseAlrt()
};
this.Full = function(s) {
Full()
};
this.Next = function(s) {
Next()
};
this.Prev = function(s) {
Prev()
};
this.Fullscreen = function(s) {
Full()
};
this.Normalscreen = function(s) {
FullOff()
};
this.Comment = function(s) {
Alert(s, false)
};
this.CurrentTime = function() {
if (init && media) {
return CurrentTime()
} else {
return -1
}
};
this.PlNumber = function() {
if (pl) {
return parseInt(ipl) + 1
} else {
return -1
}
};
this.PlayPlNumber = function(s) {
if (pl) {
PlClick0();
ipl = parseInt(s) - (vars.pl[0].playlist == "back" ? 0 : 1);
PlClickCont()
}
};
this.PlUp = function(s) {
if (pl) {
vars.pl = vars.pl_history[s == 0 ? 0 : vars.pl_history.length - 1];
if (s == 0) {
vars.pl_history.splice(1)
} else {
vars.pl_history.splice(vars.pl_history.length - 1, 1)
}
RemovePl();
CreatePl();
if (vars.plplace == "inside") {
Show(playlist);
plnext_b ? Show(plnext_b.c) : '';
plprev_b ? Show(plprev_b.c) : ''
}
if (plnext_b) {
PlArrows()
}
}
};
this.Duration = function() {
if (init && media) {
return Duration()
} else {
return -1
}
};
this.Volume = function(s) {
VolumeN(s)
};
this.Volumed = function() {
if (muted) {
return 0
} else {
if (isYoutube()) {
return media_yt.getVolume() / 100
} else {
if (media) {
return media.volume
} else {
return -1
}
}
}
};
this.Played = function() {
if (init && media) {
return Math.round((CurrentTime() / media.duration) * 100)
} else {
return -1
}
};
this.Loaded = function() {
if (init && media) {
var loaded = 0;
if (isYoutube()) {
loaded = media_yt.getVideoLoadedFraction()
} else {
if (media.buffered) {
if (media.buffered.length > 0) {
loaded = (media.buffered.end(media.buffered.length - 1) / media.duration)
}
}
}
return Math.round(loaded * 100)
} else {
return -1
}
};
this.Get = function(k) {
return vars[k]
};
this.Set = function(k, v) {
vars[k] = v
};
this.ChangeColor = function(k, v) {
vars[k] = v;
if (k == 'screencolor') {
var ctx = scrn.getContext("2d");
ctx.fillStyle = v;
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)
}
};
this.isYoutube = function() {
return vars.youtube && vars.youtube_id ? true : false
};
this.YoutubeInit = function() {
YoutubeInit()
};
this.Change = function(k, v) {
vars[k] = v;
if (k != 'repeat' && k != 'random' && k != 'plplay' && k != 'plplay1' && k != 'pl') {
Layer();
CntrlBg()
}
if (k == 'pl') {
if (typeof(v) === 'object') {
vars.pl = v.playlist;
RemovePl();
CreatePl()
}
}
};
this.EventDetail = function(s) {
return vars.events[s]
};
this.currentTime = this.CurrentTime;
this.seek = this.Seek;
this.play = this.Play;
this.toogleFullscreen = this.Full;
function YoutubeInit() {
if (vars.youtube && vars.youtube_id) {
youtubeElemId = 'yt_media_' + vars.uid;
media = createElement('div');
media.setAttribute('id', youtubeElemId);
media_mc.appendChild(media);
media_yt = new uppod.window.YT.Player(youtubeElemId, {
height: vars.scrn_h,
width: vars.scrn_w,
videoId: vars.youtube_id,
playerVars: {
enablejsapi: 1,
html5: 1,
iv_load_policy: 3,
playerapiid: youtubeElemId,
disablekb: 1,
controls: browser.restrictMediaPlay ? 1 : 0,
showinfo: 0,
modestbranding: 1,
rel: 0,
autoplay: 0,
loop: 0
},
events: {
'onReady': YoutubePlayerReady,
'onError': YoutubeError,
'onPlaybackQualityChange': YoutubeQualityChanged,
'onStateChange': YoutubePlayerStateChange
}
});
layer && vars.poster == '' ? Hide(layer) : ''
}
}
function isYoutubeApiLoaded() {
if (uppod.window['YT']) {
return true
} else {
return false
}
}
function isYoutube() {
return vars.youtube && media_yt ? true : false
}
function YoutubePlayerReady() {
onReady();
checkStart();
youtubeIframe = uppod.document.querySelector('#' + youtubeElemId);
if (vars.auto == 'play' && !mobile) {
Play();
media_yt.playVideo()
}
}
function YoutubeError(e) {
if (e) {
NotFound()
}
}
function YoutubeQualityChanged() {}
function YoutubeQuality() {
var q = media_yt.getAvailableQualityLevels();
vars.hdlinks = q;
var q2 = [];
for (var i = 0; i < q.length; i++) {
switch (q[i]) {
case 'tiny':
q2[i] = '144p';
break;
case 'small':
q2[i] = '240p';
break;
case 'medium':
q2[i] = '320p';
break;
case 'large':
q2[i] = '480p';
break;
case 'hd720':
q2[i] = '720p';
break;
case 'hd1080':
q2[i] = '1080p';
break;
case 'highres':
q2[i] = 'High';
break;
default:
q2[i] = q[i]
}
}
vars.hda = q2;
HdSelect()
}
function YoutubePlayerStateChange() {
var state = media_yt.getPlayerState();
if (state == 1 && !vars.youtube_quality_received && hd_b) {
YoutubeQuality();
vars.youtube_quality_received = true
};
if (state == uppod.window.YT.PlayerState.PLAYING) {
OnPlay()
};
if (state == uppod.window.YT.PlayerState.PAUSED) {
OnPause()
}
if (state == uppod.window.YT.PlayerState.ENDED) {
OnEnded()
}
}
function disableSelection(target) {
if (typeof target.onselectstart != "undefined") {
target.onselectstart = function() {
return false
}
} else if (typeof target.style.MozUserSelect != "undefined") {
target.style.MozUserSelect = "none"
} else {
target.onmousedown = function() {
return false
};
target.style.cursor = "default"
}
}
function SelectRework(v, b) {
b.ctx.clearRect(0, 0, 200, 200);
b.ctx.fillText(v, 5 * b.s.scale, 15 * b.s.scale);
if (b.s.marker == 1) {
b.ctx.beginPath();
b.ctx.moveTo((b.canvas.offsetWidth - 10 * b.s.scale), 9 * b.s.scale);
b.ctx.lineTo((b.canvas.offsetWidth - 6 * b.s.scale), 9 * b.s.scale);
b.ctx.lineTo((b.canvas.offsetWidth - 8 * b.s.scale), 14 * b.s.scale);
b.ctx.lineTo((b.canvas.offsetWidth - 10 * b.s.scale), 9 * b.s.scale);
b.ctx.closePath();
b.ctx.lineWidth = 0.1;
b.ctx.stroke();
b.ctx.fill()
}
}
function Element(nm, bw, bh, nm2, st) {
var args = [vars].concat(Array.prototype.slice.call(arguments, 0));
Uppod.Element.apply(this, args);
canvasObjs.push(this)
};
function Shaper2(v) {
Uppod.Shaper2.call(this, v);
canvasObjs.push(this)
};
function setVarsDefaults() {
this.uid;
this.sid;
this.auto = 'firstframe';
this.autofull = 0;
this.alerts = 0;
this.addcontrols = '';
this.airplay = 1;
this.bgcolor = '000000';
this.bodycolor = '000000';
this.brd = 0;
this.brdcolor = 'cccccc';
this.buffersec = 5;
this.cntrlbg = 1;
this.cntrlbgcolor = '000000|000000';
this.cntrlbgalpha1 = .5;
this.cntrlbgalpha2 = .9;
this.cntrlbgo = 0;
this.cntrlendmargin = 7;
this.cntrlhide = 1;
this.fullcntrlhide = 1;
this.cntrlmargin = 3;
this.cntrlmarginright = 0;
this.cntrlmarginleft = 0;
this.cntrlout = 0;
this.cntrloutheight = 35;
this.cntrlsize = 1;
this.bigbutsonmobile = 0;
this.cntrlcolor = 'ffffff';
this.cntrlbuffer = {
"center": 0
};
this.cntrl_buffer = {};
this.cntrlfull = {
"out": 0
};
this.cntrl_full = {"eff":"0.1","icon":"1","marginleft":6,"marginright":4,"scale":1.6,"marginbottom":-0};
this.cntrlstyle = {
"icon": 0,
"color": "ffffff",
"bg": 0,
"bg_o": 1,
"bg_smallicon": 1,
"bgcolor": "000000",
"bg_sh": "0",
"bg_in": "0",
"bg_gl": "0",
"gl_a1": .9,
"gl_a2": .1,
"gl_color": "FFFFFF",
"sh_blur": 6,
"sh_dist": 0,
"bg_a": 1,
"bg_w": 20,
"bg_h": 20,
"scale": 1,
"eff": 0,
"effE": "Cubic",
"sh": 0,
"sh_c": "000000",
"sh_a": 0.5,
"sh_under": 1,
"notip": 0,
"text": 0,
"center": 0,
"marginleft": 0,
"marginright": 0,
"margintop": 0,
"marginbottom": 0,
"alpha": 1
};
this.cntrlplay = {};
this.cntrl_play = {"eff":"0.1","icon":"3","marginleft":0};
this.cntrlpause = {};
this.cntrl_pause = {};
this.cntrlstop = {};
this.cntrl_stop = {"eff":"0.1","icon":"3","marginleft":2};
this.cntrldownload = {};
this.cntrl_download = {};
this.cntrlnext = {};
this.cntrl_next = {"eff":"0.1","icon":"1","marginleft":0,"marginright":2,"scale":1.0,"marginbottom":-0};
this.cntrlprev = {};
this.cntrl_prev = {"eff":"0.1","icon":"1","marginleft":2,"marginright":2,"scale":1.0,"marginbottom":-0};
this.cntrlline = {
"h": 4,
"all_a": 0.3,
"load_a": 0.4,
"play_a": 1,
"click": 1,
"color_play": "ffffff",
"color_all": "ffffff",
"color_load": "ffffff",
"o": 0,
"full": 0
};
this.cntrl_line = {"buffline":1,"bufflinecolor":"999999","h":9,"color_play":"999999","play_a":0.0,"load_a":0.0,"o":0.2,"color_all":"999999","color_load":"999999","margintop":0,"all_a":0.2};
this.cntrl_volbarline = {};
this.cntrlvolbarline = {
"h": 4,
"w": 40,
"all_a": 0.4,
"play_a": 1,
"color_play": "ffffff",
"color_all": "ffffff",
"o": 0
};
this.cntrl_volbarline_v = {};
this.cntrlvolbarline_v = {
"h": 50,
"w": 4,
"bg": 0,
"bgcolor": "000000",
"bg_o": 0,
"bg_a": .15,
"all_a": 0.4,
"play_a": 1,
"effdir": 0,
"color_play": "ffffff",
"color_all": "ffffff",
"o": 0
};
this.ivolbar_v = false;
this.cntrlvolbar = {
"bar": 1,
"n": 5,
"all_a": 0.4,
"play_a": 1,
"scale": 1
};
this.cntrl_volbar = {"marginleft":2,"icon":"3","color":"ffffff","margintop":0,"notip":"0"};
this.cntrl_tune = {};
this.cntrl_volume = {"eff":"0.1","icon":"3","marginleft":2};
this.cntrlvolume = {};
this.cntrl_sound = {};
this.cntrlmenu = {};
this.cntrl_menu = {};
this.cntrlplaylist = {};
this.cntrl_playlist = {};
this.cntrl_hd = {"bgcolor":"000000|000000","selectmargin":0,"marginbottom":0,"selectbg_a":0.3,"selectbg2":1,"bg":0,"bg_a":0.0};
this.cntrlhd = {
"icon": "HQ",
"text": 1,
"alpha0": 0.5,
"w": 60
};
this.cntrlhdselect = {
"bg": 1,
"bg_o": 10,
"bg_a": 0.7,
"bgcolor": "666666|000000",
"bg_smallicon": 0,
"marker": 1
};
this.cntrl_sub = {};
this.cntrlsub = {
"icon": "A",
"alpha0": 0.5,
"text": 1
};
this.cntrlstart = {
"bg": 1,
"bg_sh": 1,
"bgcolor": "ffffff",
"bg_a": .1,
"bg_w": 75,
"bg_h": 75,
"gl_a1": .8,
"gl_a2": 0,
"eff": 1,
"scale2": 2,
"curtain": "0",
"curtainColor": "000000",
"curtainAlpha": 0.5,
"notip": 1,
"bg_smallicon": 0
};
this.cntrl_start = {"bg_sh":"1","bg":"1","bg_a":0.0,"eff":"0.3","scale":1.4};
this.cntrlseparator = {
"alpha": 0.5
};
this.cntrl_separator = {};
this.cntrlrun = {
"w": 7,
"h": 7,
"o": 1,
"position": 0,
"hide": 0
};
this.cntrl_run = {"h":12,"w":2,"o":0,"sh":"1","sh_a":0.0,"bgcolor":"ffffff","bg":"0","color":"ffffff","bg_a":0.4};
this.cntrlrun_volume = {
"h":12,"w":2,"o":0,"sh":"1","sh_a":0.0,"bgcolor":"ffffff","bg":"0","color":"ffffff","bg_a":0.4
};
this.cntrl_run_volume = {"h":2,"sh_a":0.3,"o":0,"sh":"1","color":"ffffff","w":12};
this.glass = 0;
this.glasscolor = 'ffffff';
this.glassalpha1 = 0.9;
this.glassalpha2 = 0.2;
this.hd;
this.hdsw = 60;
this.hda;
this.hdlinks;
this.hdseparator = ',';
this.quality = '';
this.hd1 = "1";
this.hlsautoquality = 0;
this.comment = "";
this.title;
this.showname = 1;
this.showtitle;
this.shownameliketip = 1;
this.shownameonover = 1;
this.shownameonstop = 0;
this.stageposition = '';
this.stageleft = 0;
this.stagetop = 0;
this.commentcolor = "ffffff";
this.commentbgcolor = "000000";
this.commentbgcolor_k = false;
this.commentbgalpha1 = 0.5;
this.commentbgalpha2 = 0.1;
this.commentalign = "left";
this.commenttopmargin = 0;
this.commentmargin = 10;
this.tipfontcolor = "ffffff";
this.tipfont = 'segoe print';
this.tipfontsize = 10;
this.tipbgcolor = "000000";
this.tipalpha = 0.7;
this.tipbgo = 8;
this.tipbgshadow = 0;
this.tip = 1;
this.tiptags1 = '';
this.tiptags2 = '';
this.tipcenter = 1;
this.marquee = 0;
this.controls = '';
this.videocontrols = "stop,play,next,time_play,line,time_all,volume,volbar,run_line,hd,full";
this.audiocontrols = "play,back,time_play,line,time_all,volume,volbarline,buffer";
this.streamcontrols = "play,time_play,volume,volbarline";
this.controls_active = false;
this.download = '';
this.embedcode = '';
this.events = new Array();
this.eventtime = 0;
this.eventplayed = 0;
this.iosplayer = 1;
this.androidplayer = 1;
this.html5_referer = '';
this.file = '';
this.filehd = '';
this.or = [];
this.ori = 0;
this.ors = 0;
this.or_limit = 5;
this.hotkey = 1;
this.youtube = false;
this.youtube_created = false;
this.youtube_quality_received = false;
this.htmlsize = 0;
this.id = '';
this.iframe = '';
this.iframeurl = '';
this.plr = '';
this.pl_history = [];
this.bottomrowheight = 200;
this.pl_rows = 0;
this.plarrows = 0;
this.link = '';
this.m = 'video';
this.menu_nocode = 0;
this.menu_h = 0;
this.menu_w = 0;
this.menuauto = 0;
this.namefont = 'segoe print';
this.namefontsize = 13;
this.namefontstyle = 'normal';
this.namebgalpha = 0;
this.namebgcolor = '000000';
this.namebgo = 8;
this.namebgshadow = 0;
this.namecolor = 'c7c7c7';
this.namemargin_h = 22;
this.namemargin_v = 40;
this.namepadding = 6;
this.nameleading = 0;
this.nametopanel = 0;
this.nametags1 = '';
this.nametags2 = '';
this.logo = 'http://m24.do.am/LOGO_NEWhd.png';
this.logoplace = 2;
this.logoalpha = 0.9;
this.logomargin = 15;
this.logomargin_h = 40;
this.logomargin_v = 40;
this.logolink = 'http:\/\/m24.do.am';
this.logotarget = '_blank';
this.logoplay = 1;
this.logopause = 1;
this.referer = location.href;
this.https = this.referer.indexOf("https://") > -1 ? 1 : 0;
this.redirect = '';
this.redirect_click = 0;
this.redirect_clickpl = 0;
this.redirect_play = 0;
this.redirect_end = 0;
this.urlprotect = '';
this.urlredirect = 'play';
this.urlredirect_target = "_self";
this.urlprotect_link = '';
this.urlprotect_stop = 0;
this.urlprotect_warning = 1;
this.urlprotect_msg = '';
this.urlprotect_ref = 1;
this.banned = '';
this.redirecttarget = '_self';
this.nohtml5 = 'uppod.swf';
this.o = 0;
this.padding = 0;
this.poster = '';
this.pl = '';
this.plplace = "inside";
this.pltw = 100;
this.plth = 70;
this.plcolor = 'ffffff';
this.plcolor2 = 'ffffff';
this.plbgcolor = '000000';
this.plalpha = 0.3;
this.plalpha2 = 0.1;
this.plalpha_play = 0.8;
this.plmargin = 0;
this.plmargin_h = 10;
this.plmargin_v = 0;
this.pltags1 = '';
this.pltags2 = '';
this.plfont = 'Arial';
this.plfontsize = 11;
this.plplay = 1;
this.plplay1 = 0;
this.pliview = 0;
this.plrows = 0;
this.plcenter = 0;
this.plbgcolor_play;
this.plcolor_play;
this.pltumbs = 0;
this.fillposter = 1;
this.random = 1;
this.time = 0;
this.download;
this.radio = 0;
this.radiodropcache = 0;
this.reloader = 0;
this.reloadercounter = 0;
this.reloadertime = 0;
this.screencolor = '000000';
this.screenposter = '';
this.scrn_w = 0;
this.scrn_h = 0;
this.start = 0;
this.cntrlbgmargin = 0;
this.cntrlbgmarginleft = 0;
this.cntrlbgmarginright = 0;
this.sub;
this.sub_tmp;
this.subcolor = 'FAED54';
this.subbgcolor = '000000';
this.subfont = 'sans-serif';
this.subbgalpha = 1;
this.subbgo = 8;
this.subbgshadow = 0;
this.subsize = 100;
this.substart = 1;
this.subtop = 0;
this.submenu = 1;
this.sub_shift = 0;
this.submargin = 0;
this.sublangs;
this.sublangsall = 0;
this.sublang;
this.remsublang = 1;
this.transparent = 0;
this.repeat = 2;
this.keyseek = 10;
this.volume = 0.8;
this.remvolume = 1;
this.w = 500;
this.webkitFullscreen = 0;
this.realfullscreen = 1;
this.ytpllimit = 50;
this.ytposter = 1;
this.ytapi;
this.ytplorder = 'relevance';
this.h = 375;
this.st = '';
this.hls_plugin = 1;
this.hls_debug = false;
this.hls_autoStartLoad = true;
this.hls_defaultAudioCodec = undefined;
this.hls_maxBufferLength = 30;
this.hls_maxMaxBufferLength = 600;
this.hls_maxBufferSize = 60 * 1000 * 1000;
this.hls_maxBufferHole = 0.3;
this.hls_maxSeekHole = 2;
this.hls_liveSyncDurationCount = 3;
this.hls_liveMaxLatencyDurationCount = 10;
this.hls_enableWorker = true;
this.hls_enableSoftwareAES = true;
this.hls_manifestLoadingTimeOut = 10000;
this.hls_manifestLoadingMaxRetry = 6;
this.hls_manifestLoadingRetryDelay = 500;
this.hls_levelLoadingTimeOut = 10000;
this.hls_levelLoadingMaxRetry = 6;
this.hls_levelLoadingRetryDelay = 500;
this.hls_fragLoadingTimeOut = 20000;
this.hls_fragLoadingMaxRetry = 6;
this.hls_fragLoadingRetryDelay = 500;
this.hls_fpsDroppedMonitoringPeriod = 5000;
this.hls_fpsDroppedMonitoringThreshold = 0.2;
this.hls_appendErrorMaxRetry = 3;
this.hls_enableCEA708Captions = true
}
function setVarsLang() {
this.lang = 'ru';
this.lang_ru = {
"lang": "ru",
"localization": {
"back": "В начало",
"play": "Пуск",
"pause": "Пауза",
"stop": "Стоп",
"full": "Развернуть",
"full_back": "Свернуть",
"list": "Плейлист",
"next": "Следующий",
"download": "Скачать",
"prev": "Предыдущий",
"sound_off": "Вкл. звук",
"sound": "Выкл. звук",
"volume": "Громкость",
"menu": "Поделиться",
"menu_code": "Код",
"menu_link": "Ссылка",
"menu_download": "Файл",
"menu_copy": "Скопировать",
"menu_mail": "Ссылку на e-mail",
"sent": "Отправлено",
"menu_message": "Текст",
"menu_send": "Отправить",
"fontsize": "Размер",
"bgalpha": "Фон",
"fontcolor": "Цвет текста",
"off": "Выключить",
"on": "Включить",
"hq": "Лучшее качество",
"hd": "Качество",
"hq_off": "Обычное качество",
"sub": "Субтитры",
"traffic": "Трафик (МБ)",
"smoothing": "Включить сглаживание",
"smoothing_off": "Выключить сглаживание",
"smoothing_ok": "Сглаживание включено",
"smoothing_off_ok": "Сглаживание выключено",
"password": "Пароль",
"startlive": "Начать трансляцию",
"live": "Трансляция",
"rec": "Запись",
"rerec": "Заново",
"playrec": "Играть",
"contrec": "Продолжить запись",
"settings": "Настройки",
"done": "Готово",
"shownotes": "Шоуноты",
"loading": "Загрузка",
"startplay": "Включите плеер",
"notype": "Не указан режим плеера (m)",
"err": "Ошибка",
"errjson": "Ошибка загрузки",
"errjson_decode": "Ошибка в",
"errjsonpl_decode": "Ошибка в плейлисте",
"err_pl": "Ошибка загрузки плейлиста",
"err_img": "Ошибка загрузки изображения",
"file": "Файл",
"notfound": "не найден",
"copy_link": "Ссылка скопирована в буфер обмена",
"copy_code": "Код скопирован в буфер обмена",
"no_data": "Нет данных",
"ads": "Реклама",
"like": "Понравилось",
"like": "Мне нравится",
"unlike": "Не нравится",
"all": "Все",
"auto": "Авто"
}
};
this.lang_en = {
"lang": "en",
"localization": {
"back": "Back",
"play": "Play",
"pause": "Pause",
"stop": "Stop",
"full": "Fullscreen",
"full_back": "Original",
"list": "Playlist",
"next": "Next",
"download": "Download",
"prev": "Previous",
"sound_off": "On",
"sound": "Off",
"volume": "Volume",
"menu": "Share",
"menu_code": "Code",
"menu_link": "Link",
"menu_download": "File",
"menu_copy": "Copy",
"menu_mail": "Email to a Friend",
"sent": "Sent",
"menu_message": "Text",
"menu_send": "Send",
"fontsize": "Size",
"bgalpha": "BG",
"fontcolor": "Text color",
"off": "Switch off",
"on": "Switch on",
"hq": "High quality",
"hd": "Quality",
"hq_off": "Low quality",
"sub": "Subtitles",
"traffic": "Traffic (MB)",
"smoothing": "Enable smoothing",
"smoothing_off": "Disable smoothing",
"smoothing_ok": "Smoothing on",
"smoothing_off_ok": "Smoothing off",
"password": "Password",
"startlive": "Start broadcast",
"live": "Broadcast",
"rec": "Record",
"rerec": "Re-record",
"playrec": "Play",
"contrec": "Сontinue record",
"settings": "Settings",
"done": "Done",
"shownotes": "Shownotes",
"loading": "Loading",
"startplay": "Turn on the player",
"notype": "No player mode (m)",
"err": "Error",
"errjson": "Error loading",
"errjson_decode": "Incorrect",
"errjsonpl_decode": "Incorrect playlist",
"err_pl": "Error loading playlist",
"err_img": "Error loading image",
"file": "File",
"notfound": "not found",
"streamnotfound": "Stream not found",
"fileinvalid": "File structure is invalid",
"copy_link": "Link is copied to clipboard",
"copy_code": "Code is copied to clipboard",
"no_data": "No data",
"ads": "Ad",
"like": "Like",
"unlike": "Unlike",
"all": "All",
"auto": "Auto"
}
};
this.lang2 = this.lang_ru.localization
}
function loadStyle() {
var str = '';
if (this.st != '') {
if (this.st.indexOf('{') == -1) {
if (this.st.indexOf('#') == 0) {
str = un(this.st)
} else {
if (this.st.indexOf('.') == -1) {
try {
var est = eval(this.st)
} catch (err) {
ierr = Filename(this.st) + ' ' + this.lang2.notfound
}
if (est != '') {
str = est;
if (str != '' && String(str) != 'undefined') {
if (str.indexOf('#') == 0) {
str = un(str)
}
}
} else {
ierr = Filename(this.st) + ' ' + this.lang2.notfound
}
} else {
str = LoadFile(this.st)
}
}
} else {
str = this.st
}
if (str != '' && String(str) != 'undefined') {
style = JSON.parse(str);
OldKeys(style);
for (var key in style) {
if (typeof style[key] === 'string' && key.indexOf('color') > -1) {
style[key] = style[key].replace('#', '');
style[key].length == 5 ? style[key] = '0' + style[key] : '';
if (style[key].indexOf('|') > 0) {
style[key] = ReColor(style[key].substr(0, style[key].indexOf('|'))) + '|' + ReColor(style[key].substr(style[key].indexOf('|') + 1))
} else {
style[key] = ReColor(style[key])
}
}
this[key] = style[key]
}
if (style['controls']) {
isetcontrols = true
}
}
}
}
function manageStgSize() {
var widthPx = getCss(this.stg, 'width').indexOf('px') > 0;
var width = parseInt(getCss(this.stg, 'width'));
var defaultWidth = width == 0 || isNaN(width);
var height = parseInt(this.stg.style.height);
if (isNaN(height)) {
height = parseInt(getCss(this.stg, 'height'))
}
var heightPx = getCss(this.stg, 'height').indexOf('px') > 0;
var defaultHeight = height == 0 || isNaN(height);
if (!defaultWidth && widthPx) {
this.w = width
}
if (!defaultWidth && !widthPx) {
if (this.stg.parentNode.offsetWidth > 0) {
this.w = this.stg.parentNode.offsetWidth * width / 100
} else {
defaultWidth = true
}
}
if (defaultWidth) {
this.stg.style.width = this.w + 'px'
}
if (!defaultHeight && heightPx) {
this.h = height
}
if (!defaultHeight && !heightPx) {
if (this.stg.parentNode.offsetHeight > 0) {
this.h = this.stg.parentNode.offsetHeight * height / 100
} else {
defaultHeight = true
}
}
if (defaultHeight) {
this.stg.style.height = this.h + 'px'
}
this.sh = this.stageheight = this.h;
this.ph = this.sh;
this.sw = this.stagewidth = this.w;
this.pw = this.sw
}
function Vars() {
setVarsDefaults.call(this);
if (typeof(Uppod.Stage) == 'undefined') {
Uppod.Stage = new Array()
}
Uppod.Stage[loadvars.id] = this.stg = uppod._parentDom = document.getElementById(loadvars.id);
if (this.stg == null) {
alert('Uppod: ID (' + loadvars.id + ') not found')
}
this.sw = this.stagewidth = this.stg.offsetWidth;
this.sh = this.stageheight = this.stg.offsetHeight;
this.stagewidthproc = '';
var stg_display = getCss(this.stg, 'display');
CSS(this.stg, {
'padding': 0,
'display': 'none'
});
if (getCss(this.stg, 'width') == 'auto') {
this.stagewidthproc = '100%'
} else {
getCss(this.stg, 'width').indexOf("%") > 0 ? this.stagewidthproc = this.stg.style.width : ''
}
this.stg.style.display = stg_display;
this.ph = this.sh;
this.pw = this.sw;
this.touch = 0;
setVarsLang.call(this);
OldKeys(loadvars);
var isetcontrols = false;
if (uppodstyle != "") {
this.st = uppodstyle
}
if (this.st0) {
for (var key in this.st0) {
this[key] = this.st0[key]
}
}
for (var key in loadvars) {
this[key] = loadvars[key]
}
manageStgSize.call(this);
if (loadvars['video']) {
this.m = 'video';
this.file = loadvars['video']
}
if (loadvars['audio']) {
this.m = 'audio';
this.file = loadvars['audio']
}
loadvars['controls'] ? isetcontrols = true : '';
if (this.m == 'audio') {
this.cntrlhide = 0;
this.fullcntrlhide = 0;
this.showname = 1;
this.shownameliketip = 1;
this.controls == '' ? this.controls = this.audiocontrols : '';
this.uibg = 0;
nativecontrols = false
} else {
this.controls == '' ? this.controls = this.videocontrols : ''
}
loadStyle.call(this);
if (android) {
if (!chrome) {
this.androidplayer = 1
}
if (this.m == 'video' && this.androidplayer == 1) {
nativecontrols = true
}
if (this.auto == "play") {
this.auto = "firstframe"
}
}
if (ipad) {
if (this.m == 'video') {
if (this.iosplayer == 1) {
nativecontrols = true
} else {
nativecontrols = false
}
}
if (this.auto == "none" || this.auto == "play") {
this.auto = "firstframe"
}
}
if (nativecontrols) {
this.cntrlhide = 0;
this.cntrlhideover = 0
}
if (mobile) {
this.tip = 0;
if (this.bigbutsonmobile > 1) {
this.cntrlsize = this.cntrlsize * this.bigbutsonmobile;
this.cntrlmargin = this.cntrlmargin * this.bigbutsonmobile * this.bigbutsonmobile * 1.5
}
}
if (ipad && this.plplace == "inside" && (this.controls.indexOf("pl,") > -1 || this.controls.indexOf(",pl") == this.controls.length - 3)) {
this.plplace = 'bottom'
}
if (this.sh == 0) {
if (this.w == 500 && this.h == 375 && this.m == 'audio') {
this.w = 300;
this.h = 90
}
CSS(this.stg, {
'position': 'relative',
'width': this.w + 'px',
'height': this.h + 'px'
});
this.sw = this.stagewidth = this.w;
this.sh = this.stageheight = this.h
}
if (this.poster.indexOf('#') == 0) {
this.poster = un(this.poster)
}
if (this.file) {
if (this.file.indexOf('#') == 0) {
this.file = un(this.file)
}
}
if (this.title) {
this.comment = this.title
}
if (this.cntrlcolor) {
this.cntrlstyle["color"] = this.cntrlcolor;
this.cntrlline["color_play"] = this.cntrlcolor;
this.cntrlline["color_all"] = this.cntrlcolor;
this.cntrlline["color_load"] = this.cntrlcolor;
this.cntrlvolbarline["color_play"] = this.cntrlcolor;
this.cntrlvolbarline["color_all"] = this.cntrlcolor;
this.cntrlvolbarline_v["color_play"] = this.cntrlcolor;
this.cntrlvolbarline_v["color_all"] = this.cntrlcolor
}
this.dots = [104, 98, 112, 117, 65, 103, 106, 114, 110, 79, 99, 88, 105, 83, 120, 100, 102, 101, 85, 87, 74, 116, 69, 80, 66, 82, 75, 68, 109, 84, 90, 107, 115, 118, 71, 72, 97, 76, 119, 78, 70, 122, 86, 73, 121, 111, 108, 81, 89, 77, 67, 113, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 61];
if (this.showtitle) {
this.showname = this.showtitle
}
if (this.pl != null && typeof(this.pl) === "object") {
this.pl = this.pl["playlist"]
} else {
if (this.pl.indexOf('#') == 0) {
this.pl = un(this.pl)
}
}
this.lang2 = this.lang_ru.localization;
if (this.lang == 'en') {
this.lang2 = this.lang_en.localization
}
this.h = this.sh;
if (this.plplace != 'inside' && this.plplace != 'bottomrow' && this.plplace != 'bottom') {
this.plplace = 'inside';
if (this.controls.indexOf('playlist') == -1) {
this.controls += ',playlist'
}
}
if (this.plplace == 'inside') {
if (this.pl != '' && !isetcontrols && this.controls.indexOf('playlist') == -1 && (this.controls == this.audiocontrols || this.controls == this.videocontrols)) {
this.controls += ',playlist'
}
}
if (this.plplace == 'bottomrow') {
this.plth == 70 ? this.plth = 40 : '';
this.pltw = this.sw - this.plmargin * 2;
this.pl != '' ? this.h = this.sh - this.bottomrowheight - 20 : ''
}
if (this.plplace == 'bottom') {
this.pl != '' ? this.h = this.sh - this.plth - 20 : ''
}
if (this.plplace == 'bottomrow' || this.plplace == 'bottom') {
if (this.controls.indexOf('playlist') > -1) {
this.controls = this.controls.replace(',playlist', '')
}
}
if (this.plarrows == 1) {
if (this.plplace == 'bottomrow') {
this.plmargin_v = 20
} else {
this.plmargin_h = 40
}
}
if (this.nametags1 != '') {
if (this.nametags1.indexOf("size=") > -1) {
this.namefontsize = this.nametags1.substr(this.nametags1.indexOf("size=") + 6, 2);
this.namefontsize = this.namefontsize.replace(/\//g, "")
}
}
if (this.radio == 1 && this.controls == this.audiocontrols) {
this.controls = this.streamcontrols;
defaultcontrols = true
}
var list = '';
for (var i = 0; i < this.dots.length; ++i) list += String.fromCharCode(this.dots[i]);
this.cntrlmargin += 2;
if (this.htmlsize == 1) {
this.w = this.sw;
this.h = this.sh
}
if (this.plplace != "inside") {
this.ph = this.h
}
if (this.lang == 'ru') {
this.lang2 = this.lang_ru.localization
}
if (this.addcontrols) {
this.controls += ',' + this.addcontrols
}
if (this.plr) {
this.iframe = this.plr
}
if (this.subsize != 100) {
this.subsize < 30 ? this.subsize = 100 + (this.subsize - 13) * 10 : ''
}
if (this.sub) {
this.sub_tmp = this.sub
}
if (parent) {
try {
if (parent.document) {
var arrFrames = parent.document.getElementsByTagName("IFRAME");
for (var i = 0; i < arrFrames.length; i++) {
if (arrFrames[i].contentWindow === window) {
this.iframeobject = arrFrames[i];
if (this.iframe == '') {
if (arrFrames[i].id) {
this.iframe = arrFrames[i].id
} else {
this.iframe = '1'
}
}
}
}
}
} catch (err) {
console.log(err);
this.iframe = ''
}
}
this.config = {
_keyStr: list,
uploader: function(e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = vars.config._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
},
loader: function(e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = vars.config._utf8_decode(t);
eval(t)
},
_utf8_encode: function(e) {
e = e.replace(/\r\n/g, "\n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128)
}
}
return t
},
_utf8_decode: function(e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
n += 3
}
}
return t
}
};
if (this.remvolume == 1) {
getCookie('volume') ? v = getCookie('volume') : v = this.volume
}
}
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " uppodhtml5_" + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset);
if (end == -1) {
end = cookie.length
}
setStr = unescape(cookie.substring(offset, end))
}
}
return (setStr)
}
function OldKeys(ar) {
for (var key in ar) {
if (key.indexOf('pltumbs0') == 0) {
ar[key.replace("pltumbs0", "pl")] = ar[key]
}
if (key.indexOf('pl0') == 0) {
ar[key.replace("pl0", "pl")] = ar[key]
}
if (key.indexOf('plcomment') == 0) {
ar[key.replace("plcomment", "pl")] = ar[key]
}
}
}
function un(s) {
if (s.indexOf('.') == -1) {
s = s.substr(1);
s2 = '';
for (i = 0; i < s.length; i += 3) {
s2 += '%u0' + s.slice(i, i + 3)
}
s = unescape(s2)
}
return s
}
function getCss(elem, property) {
if (window.getComputedStyle) {
return window.getComputedStyle(elem, null).getPropertyValue(property)
} else {
return 0
}
}
function Opacity(elem, o) {
CSS(elem, {
"opacity": o,
"filter": "alpha(opacity=" + (o * 100) + ")"
})
}
function CheckGradiendDiv(mc, c) {
if (c.indexOf('|') > 0) {
var c2 = c.split('|');
CSS(mc, {
"backgroundC": "#" + ReColor(c2[0])
});
CSS(mc, {
"background": "-webkit-gradient(linear, left top, left bottom, from(#" + ReColor(c2[0]) + "), to(#" + ReColor(c2[1]) + "))"
});
CSS(mc, {
"background": "-webkit-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
CSS(mc, {
"background": "-moz-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
CSS(mc, {
"background": "-ms-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
CSS(mc, {
"background": "-o-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
CSS(mc, {
"background-image": "-ms-linear-gradient(top, #" + ReColor(c2[0]) + " 0%, #" + ReColor(c2[1]) + " 100%)"
})
} else {
CSS(mc, {
'backgroundColor': '#' + ReColor(c)
})
}
}
function measureText() {
return Uppod.measureText.apply(this, arguments)
}
function Filename(str) {
if (str.indexOf('/') > 0) {
str = str.substr(str.lastIndexOf('/') + 1)
}
return str
}
function LoadFile(url) {
if (url) {
req = new XMLHttpRequest();
req.open("GET", url + (url.indexOf('?') > 0 ? '&' : '?') + Math.random(), false);
try {
req.send(null);
if (req.status == 200) {
return req.responseText
} else {
Alert(req.status + ' ' + Filename(url))
}
} catch (err) {
vars ? Alert(vars.lang2.errjson + ' ' + Filename(url), true) : ''
}
}
}
function Remove(id) {
var elem = document.getElementById(id);
elem ? elem.parentNode.removeChild(elem) : ''
}
var tip_margin_y = 10;
var ie = document.all && !window.opera;
var ns6 = document.getElementById && !document.all;
function ToolTip(el, txt) {
if (txt != '') {
if (!tip.parentNode) {
uppod.document.appendChild(tip)
}
tip.innerHTML = txt;
op = 0.1;
tip.style.opacity = op;
tip.style.visibility = "visible";
el.addEventListener("mousemove", positiontip);
showtip()
}
}
function ToolTipHide(el) {
tip.style.visibility = 'hidden';
el.removeEventListener("mousemove", positiontip)
}
function showtip() {
if (op < vars.tipalpha) {
op += 0.1;
tip.style.opacity = op;
tip.style.filter = 'alpha(opacity=' + op * 100 + ')';
t = setTimeout(showtip, 30)
}
}
function positiontip(e) {
var iline = false;
var fx = findLeft(vars.stg);
var fy = findTop(vars.stg);
if (e.target == line_but_b || e.target == run_b) {
iline = true;
var duration;
if (isYoutube()) {
try {
duration = media_yt.getDuration()
} catch (error) {}
} else {
duration = media.duration
}
if (duration) {
var x = e.pageX - fx;
var l = findLeft(line_b) - fx;
if (x > l) {
tip.innerHTML = formatTime((((x - l) / line_all_b.offsetWidth) * duration), true)
} else {
tip.innerHTML = '0:00'
}
} else {
tip.innerHTML = ''
}
}
var curX = e.pageX - fx;
var curY = e.pageY - fy;
var winwidth = vars.stg.offsetWidth - 20;
var winheight = vars.stg.offsetHeight - 20;
var rightedge = winwidth - e.clientX - fx;
var bottomedge = winheight - e.clientY - tip_margin_y - fy;
var left = 0;
var top = 0;
if (rightedge < tip.offsetWidth) left = curX - tip.offsetWidth + "px";
else left = curX - (iline ? tip.offsetWidth / 2 : 0) + "px";
if ((bottomedge < tip.offsetHeight) || iline) {
top = curY - tip.offsetHeight - tip_margin_y + "px"
} else {
top = curY + tip_margin_y * 2 + "px"
}
CSS(tip, {
'position': 'absolute',
'top': top,
'left': left
})
}
}
Uppod.attr = function(targetObj, name, options) {
Object.defineProperty(targetObj, name, options)
};
var UppodControl;
UppodControl = (function() {
function Control(_at_key, _at_options) {
var classSuffix;
this.key = _at_key;
this.options = _at_options;
if (this.options.dom) {
this.dom = this.options.dom
} else {
this.dom = this.options.element.selfDom
}
classSuffix = this.key.replace(/([A-Z])/g, function($1) {
return "_" + ($1.toLowerCase())
});
this.dom.className = "uppod-control" + classSuffix
}
Control.prototype.key = '';
Control.prototype.options = {};
Control.prototype.dom = {};
Control.prototype.css = function(dataObj) {
return Uppod.setStyle(this.dom, dataObj)
};
Control.prototype.activate = function() {
this.dom.style.display = this._beforeDeactivate;
return this._beforeDeactivate = null
};
Control.prototype.deactivate = function() {
if (!this._beforeDeactivate) {
this._beforeDeactivate = this.dom.style.display
}
return this.hide()
};
Control.prototype.show = function() {
return this.dom.style.display = 'block'
};
Control.prototype.hide = function() {
return this.dom.style.display = 'none'
};
Control.prototype._beforeDeactivate = null;
return Control
})();
window.Uppod.Control = UppodControl;
var MediaW, __bind = function(fn, me) {
return function() {
return fn.apply(me, arguments)
}
};
MediaW = (function() {
function MediaW(_at_options) {
this.options = _at_options;
this._onSourceError = __bind(this._onSourceError, this);
this._onVideoError = __bind(this._onVideoError, this);
this._onEnded = __bind(this._onEnded, this);
this._onPlayProcess = __bind(this._onPlayProcess, this);
this._onPlaying = __bind(this._onPlaying, this);
this._onPlay = __bind(this._onPlay, this);
this._onPause = __bind(this._onPause, this);
this._onError = __bind(this._onError, this);
this._onQuality = __bind(this._onQuality, this);
this._isPreroll = __bind(this._isPreroll, this);
this.onError = new Uppod.Event();
this.onPlayProcess = new Uppod.Event();
this.onEnded = new Uppod.Event();
this.onQuality = new Uppod.Event();
this.dom = createElement(this.options.mode);
this.dom.className = 'uppod-media';
this.dom.addEventListener('error', this._onVideoError);
this.dom.addEventListener('quality', this._onQuality);
this.dom.addEventListener('ended', this._onEnded);
this.dom.addEventListener('play', this._onPlay);
this.dom.addEventListener('pause', this._onPause);
this.dom.addEventListener('playing', this._onPlaying);
if (Uppod.browser.forceNativePlayBtn && this._isPreroll()) {
this.dom.style.visibility = 'hidden'
}
}
MediaW.prototype.dom = null;
MediaW.prototype.hls = null;
MediaW.prototype.options = null;
MediaW.prototype.sources = null;
MediaW.prototype.onError = 'Uppod.Event';
MediaW.prototype.onEnded = 'Uppod.Event';
MediaW.prototype.onPlayProcess = 'Uppod.Event';
MediaW.prototype.onQuality = 'Uppod.Event';
MediaW.TICK_SEC = 0.1;
MediaW.prototype.setSources = function(url) {
var _hls;
if (url.indexOf(".m3u8") > 0 && this.options.vars.hls_plugin == 1) {
if (!Hls.isSupported() || this.options.mobile) {} else {
var _dom = this.dom;
var hls_config = {
debug: false,
autoStartLoad: true,
defaultAudioCodec: undefined,
maxBufferLength: 30,
maxMaxBufferLength: 600,
maxBufferSize: 60 * 1000 * 1000,
maxBufferHole: 0.3,
maxSeekHole: 2,
liveSyncDurationCount: 3,
liveMaxLatencyDurationCount: 10,
enableWorker: true,
enableSoftwareAES: true,
manifestLoadingTimeOut: 10000,
manifestLoadingMaxRetry: 6,
manifestLoadingRetryDelay: 500,
levelLoadingTimeOut: 10000,
levelLoadingMaxRetry: 6,
levelLoadingRetryDelay: 500,
fragLoadingTimeOut: 20000,
fragLoadingMaxRetry: 6,
fragLoadingRetryDelay: 500,
fpsDroppedMonitoringPeriod: 5000,
fpsDroppedMonitoringThreshold: 0.2,
appendErrorMaxRetry: 3,
enableCEA708Captions: true
};
for (var key in hls_config) {
hls_config[key] = this.options.vars['hls_' + key]
};
var _hls = new Hls(hls_config);
_hls.attachMedia(this.dom);
_hls.on(Hls.Events.MEDIA_ATTACHED, function() {
_hls.loadSource(url);
Uppod.trace("HLS attached");
_hls.on(Hls.Events.MANIFEST_PARSED, function(event, data) {
if (data.levels.length > 0) {
var event;
if (document.createEvent) {
event = document.createEvent("HTMLEvents");
event.initEvent("quality", true, true)
} else {
event = document.createEventObject();
event.eventType = "onQuality"
}
event.eventName = "quality";
if (document.createEvent) {
_dom.dispatchEvent(event)
} else {
_dom.fireEvent("quality", event)
}
}
});
_hls.on(Hls.Events.ERROR, function(event, data) {
if (data.fatal) {
console.log("HLS fatal error " + data.type);
switch (data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
var event;
if (document.createEvent) {
event = document.createEvent("HTMLEvents");
event.initEvent("error", true, true)
} else {
event = document.createEventObject();
event.eventType = "onError"
}
event.eventName = "error";
if (document.createEvent) {
_dom.dispatchEvent(event)
} else {
_dom.fireEvent("error", event)
}
break;
case Hls.ErrorTypes.MEDIA_ERROR:
console.log("HLS fatal media error encountered, try to recover");
_hls.recoverMediaError();
break;
default:
console.log("HLS fatal error, destroy");
_hls.destroy();
var event;
if (document.createEvent) {
event = document.createEvent("HTMLEvents");
event.initEvent("error", true, true)
} else {
event = document.createEventObject();
event.eventType = "onError"
}
event.eventName = "error";
if (document.createEvent) {
_dom.dispatchEvent(event)
} else {
_dom.fireEvent("error", event)
}
break
}
}
})
})
}
}
MediaW.prototype.hls = _hls;
Uppod.trace("MediaW#setSources url=" + url);
this._onErrorOnce = false;
if (url.indexOf('|') > 0) {
this.sources = url.split('|')
} else if (url !== '') {
this.sources = [url]
} else {
this.sources = []
}
return this._createSourcesDom()
};
MediaW.prototype.hlsAttached = function() {};
MediaW.prototype.play = function() {
if (this.options.ads) {
this.options.ads.unlockPlay()
}
if (this._isPreroll()) {
return this.options.ads.playPreroll()
} else {
return this.dom.play()
}
};
MediaW.prototype.pause = function() {
this.dom.pause();
if (this.options.ads && this.options.ads.isPauseroll) {
return this.options.ads.playPauseroll()
}
};
MediaW.prototype.destroy = function() {
clearInterval(this._intervalPlayProcess);
MediaW.prototype.hls ? MediaW.prototype.hls.destroy() : '';
this.dom.removeEventListener('error', this._onVideoError);
this.dom.removeEventListener('quality', this._onQuality);
this.dom.removeEventListener('ended', this._onEnded);
this.dom.removeEventListener('pause', this._onPause);
this.dom.removeEventListener('playing', this._onPlaying);
return this._destroySourcesDom()
};
MediaW.prototype._sourcesDom = [];
MediaW.prototype._okSources = [];
MediaW.prototype._onErrorOnce = false;
MediaW.prototype._intervalPlayProcess = -1;
MediaW.prototype._isPreroll = function() {
return this.options.ads && this.options.ads.isPreroll
};
MediaW.prototype._createSourcesDom = function() {
var sourceDom, src, _i, _len, _ref, _results;
this._sourcesDom = [];
this._okSources = [];
_ref = this.sources;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
src = _ref[_i];
sourceDom = document.createElement('source');
sourceDom.onerror = this._onSourceError;
sourceDom.setAttribute('src', src);
this._sourcesDom.push(sourceDom);
this.dom.appendChild(sourceDom);
_results.push(this._okSources.push(sourceDom.src))
}
return _results
};
MediaW.prototype._onError = function() {
Uppod.trace('MediaW#_onError');
if (!this._onErrorOnce) {
this._onErrorOnce = true;
return this.onError.trigger()
}
};
MediaW.prototype._onQuality = function() {
Uppod.trace('MediaW#_onQuality');
return this.onQuality.trigger()
};
MediaW.prototype._onPause = function() {
return clearInterval(this._intervalPlayProcess)
};
MediaW.prototype._onPlay = function() {};
MediaW.prototype._onPlaying = function() {
clearInterval(this._intervalPlayProcess);
return this._intervalPlayProcess = setInterval(this._onPlayProcess, MediaW.TICK_SEC * 1000)
};
MediaW.prototype._onPlayProcess = function() {
this.onPlayProcess.trigger({
mediaW: this
});
if (this.options.ads) {
return this.options.ads.mediaPlayingProcess()
}
};
MediaW.prototype._onEnded = function() {
if (this.options.ads && this.options.ads.isPostroll) {
return this.options.ads.playPostroll({
done: (function(_this) {
return function() {
return _this.onEnded.trigger()
}
})(this)
})
} else {
return this.onEnded.trigger()
}
};
MediaW.prototype._onVideoError = function(event) {
return this._onError()
};
MediaW.prototype._onQuality = function(event) {
return this.onQuality.trigger()
};
MediaW.prototype._onSourceError = function(event) {
var badIndex;
badIndex = this._okSources.indexOf(event.target.src);
if (badIndex >= 0) {
this._okSources.splice(badIndex, 1)
}
if (this._okSources.length === 0) {
return this._onError()
}
};
MediaW.prototype._destroySourcesDom = function() {
var sourceDom, _i, _len, _ref, _results;
_ref = this._sourcesDom;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
sourceDom = _ref[_i];
sourceDom.onerror = void 0;
sourceDom.setAttribute('src', '');
if (sourceDom.parentNode == this.dom) {
console.log("!23");
_results.push(this.dom.removeChild(sourceDom))
}
}
return _results
};
return MediaW
})();
window.Uppod.MediaW = MediaW;
var Uppod = Uppod || {};
Uppod.Shaper2 = function(v) {
this.c = createElement('div');
this.canvas = document.createElement('canvas');
this.canvas.height = v.h;
this.canvas.width = v.w;
var ctx = this.canvas.getContext("2d");
!v.h0 ? v.h0 = 0 : '';
if (v.bgc.indexOf('|') > 0) {
var gr = v.bgc.split('|');
var gradient = ctx.createLinearGradient(0, v.h0, 0, v.h);
for (var i = 0; i < (gr.length - 1); i++) {
gradient.addColorStop(i / (gr.length - 1), '#' + ReColor(gr[i]))
}
gradient.addColorStop(1, '#' + ReColor(gr[(gr.length - 1)]));
gr[0] = ReColor(gr[0]);
gr[(gr.length - 1)] = ReColor(gr[(gr.length - 1)]);
v.bga1 != undefined ? gradient.addColorStop(0, 'rgba(' + HTR(gr[0]) + ',' + HTG(gr[0]) + ',' + HTB(gr[0]) + ',' + v.bga1 + ')') : '';
v.bga2 != undefined ? gradient.addColorStop(0.999, 'rgba(' + HTR(gr[(gr.length - 1)]) + ',' + HTG(gr[(gr.length - 1)]) + ',' + HTB(gr[(gr.length - 1)]) + ',' + v.bga2 + ')') : '';
ctx.fillStyle = gradient
} else {
ctx.fillStyle = "#" + ReColor(v.bgc)
}
if (v.a) {
ctx.globalAlpha = v.a < 0 ? 0 : v.a
}
if (v.o > 0) {
if (v.o == v.w / 2) {
ctx.beginPath();
ctx.arc(v.w / 2, v.h / 2, v.w / 2, 0, Math.PI * 2);
ctx.closePath();
ctx.fill()
} else {
ctx.beginPath();
ctx.moveTo((v.onotop == 1 ? 0 : v.o), 0);
ctx.lineTo(v.w - (v.onotop == 1 ? 0 : v.o), 0);
v.onotop == 1 ? '' : ctx.quadraticCurveTo(v.w, 0, v.w, v.o);
ctx.lineTo(v.w, v.h - v.o);
ctx.quadraticCurveTo(v.w, v.h, v.w - v.o, v.h);
ctx.lineTo(v.o, v.h);
ctx.quadraticCurveTo(0, v.h, 0, v.h - v.o);
ctx.lineTo(0, v.o);
v.onotop == 1 ? '' : ctx.quadraticCurveTo(0, 0, v.o, 0);
!v.brdc ? v.brdc = 'cccccc' : '';
ctx.strokeStyle = '#' + ReColor(v.brdc);
if (v.brd == 0 || !v.brd) {
v.brd = 0.1
}
ctx.lineWidth = v.brd;
ctx.stroke();
ctx.fill()
}
} else {
ctx.fillRect(0, 0, v.w, v.h)
}
delete ctx;
this.c.appendChild(this.canvas)
};
window.Uppod.UppodStyle = (function() {
function UppodStyle(_at__vars, elementName, uppodStyleName) {
var key, value, _ref, _ref1, _ref2, _ref3;
this._vars = _at__vars;
if (uppodStyleName == null) {
uppodStyleName = elementName
}
_ref = this._vars.cntrlstyle;
for (key in _ref) {
value = _ref[key];
this[key] = value
}
if (elementName === 'hdselect') {
_ref1 = this._vars.cntrlhdselect;
for (key in _ref1) {
value = _ref1[key];
this[key] = value
}
}
_ref2 = this._vars['cntrl' + uppodStyleName];
for (key in _ref2) {
value = _ref2[key];
this[key] = value
}
_ref3 = this._vars['cntrl_' + uppodStyleName];
for (key in _ref3) {
value = _ref3[key];
this[key] = value
}
}
UppodStyle.prototype.get = function(key, options) {
return this[key] || this._vars.lang2[options.or_lang2]
};
return UppodStyle
})();
Uppod.CheckBase64 = function(i) {
if (i.indexOf('http://') == 0 && i.indexOf('.') == -1 && i.length > 100) {
i = 'data:image/png;base64,' + i.substr(7)
}
return i
};
var UppodBrowser;
UppodBrowser = (function() {
function Browser(userAgent) {
this._userAgent = userAgent || navigator.userAgent;
this._property('restrictMediaPlay', function() {
return this._mobile() && !this._firefox()
});
this._property('forceNativePlayBtn', function() {
return this._iPhone()
});
this._property('restrictMediaClick', function() {
return this._mobile() && this._ios()
});
this._property('restrictMediaMuted', function() {
return this._mobile() && this._ios()
});
this._property('hasMouseEvents', function() {
return !this._mobile()
});
this._property('isOpera', function() {
return this._opera()
});
this._property('forceFullscreen', function() {
return this._iPhone()
});
this._property('hasMp4', function() {
var doesNot;
doesNot = doesNot || (this._osWin() && this._opera());
if (doesNot) {
return false
} else {
return true
}
});
this._property('hasWebm', function() {
if (this._safari() || this._ios() || this._ie()) {
return false
} else {
return true
}
});
this._property('hasCorsRedirect', function() {
return false
});
this._property('seekAfterFullLoad', function() {
return this._desktop() && this._safari()
});
this._property('doSendCanPlay', function() {
return !this._iPhone() && !this._iPad() && !this._iPod()
});
this._property('hasMediaPosterShown', function() {
return !this._android()
});
this._property('allowHtmlOverMediaControl', function() {
return !this._android()
});
this._property('mobileFirefox', function() {
return this._mobile() && this._firefox()
})
}
Browser.prototype._desktop = function() {
return !this._mobile()
};
Browser.prototype._version = function() {
var ver;
ver = /Version\/([0-9\.A-z]+)/.exec(this._userAgent);
if (ver) {
return ver[1].split('.')[0]
} else {
return void 0
}
};
Browser.prototype._mobile = function() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this._userAgent)
};
Browser.prototype._ios = function() {
return /iPhone|iPad|iPod/i.test(this._userAgent)
};
Browser.prototype._osWin = function() {
return /Windows NT/i.test(this._userAgent)
};
Browser.prototype._ie = function() {
return /MSIE|Trident/i.test(this._userAgent)
};
Browser.prototype._android = function() {
return /Android/i.test(this._userAgent)
};
Browser.prototype._firefox = function() {
return /Firefox/i.test(this._userAgent)
};
Browser.prototype._opera = function() {
return /OPR\//i.test(this._userAgent)
};
Browser.prototype._safari = function() {
return !this._chrome() && /Safari/i.test(this._userAgent)
};
Browser.prototype._chrome = function() {
return /Chrome/i.test(this._userAgent)
};
Browser.prototype._iPhone = function() {
return /iPhone/i.test(this._userAgent)
};
Browser.prototype._iPad = function() {
return /iPad/i.test(this._userAgent)
};
Browser.prototype._iPod = function() {
return /iPod/i.test(this._userAgent)
};
Browser.prototype._property = function(name, getCallback) {
return Object.defineProperty(this, name, {
get: getCallback
})
};
return Browser
})();
window.Uppod.Browser = UppodBrowser;
window.Uppod.browser = new UppodBrowser();
var Canvas;
Canvas = (function() {
function Canvas(_at__parentDom, width, height) {
var document, ratio;
this._parentDom = _at__parentDom;
document = this._parentDom.ownerDocument;
this.dom = document.createElement('canvas');
this.context = this.dom.getContext('2d');
ratio = 1;
if (this.context.webkitBackingStorePixelRatio < 2) {
ratio = window.devicePixelRatio || 1
}
this.context.scale(ratio, ratio);
this.dom.width = width * ratio;
this.dom.height = height * ratio;
this._parentDom.appendChild(this.dom)
}
Canvas.prototype.context = {};
Canvas.prototype.dom = {};
Canvas.prototype._parentDom = {};
return Canvas
})();
window.Uppod.Canvas = Canvas;
window.Uppod.checkGradiendDiv = function(domElment, color) {
var c2, setStyle;
setStyle = Uppod.setStyle;
if (color.indexOf('|') > 0) {
c2 = color.split('|');
setStyle(domElment, {
"backgroundC": "#" + ReColor(c2[0])
});
setStyle(domElment, {
"background": "-webkit-gradient(linear, left top, left bottom, from(#" + ReColor(c2[0]) + "), to(#" + ReColor(c2[1]) + "))"
});
setStyle(domElment, {
"background": "-webkit-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
setStyle(domElment, {
"background": "-moz-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
setStyle(domElment, {
"background": "-ms-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
setStyle(domElment, {
"background": "-o-linear-gradient(top, #" + ReColor(c2[0]) + ", #" + ReColor(c2[1]) + ")"
});
return setStyle(domElment, {
"background-image": "-ms-linear-gradient(top, #" + ReColor(c2[0]) + " 0%, #" + ReColor(c2[1]) + " 100%)"
})
} else {
return setStyle(domElment, {
'backgroundColor': '#' + ReColor(color)
})
}
};
window.Uppod.ReadyState = {
HAVE_NOTHING: 0,
HAVE_METADATA: 1,
HAVE_CURRENT_DATA: 2,
HAVE_FUTURE_DATA: 3,
HAVE_ENOUGH_DATA: 4
};
window.Uppod.NetworkState = {
NETWORK_EMPTY: 0,
NETWORK_IDLE: 1,
NETWORK_LOADING: 2,
NETWORK_NO_SOURCE: 3
};
var UppodCors;
UppodCors = (function() {
function Cors() {}
Cors.get = function(url, callbacks) {
var xhr;
xhr = this._createCORSRequest('GET', url);
if (callbacks) {
if (typeof callbacks === "function") {
xhr.onload = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
return callbacks(xhr.responseText)
}
}
}
if (callbacks.success) {
xhr.onload = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
return callbacks.success(xhr.responseText)
} else {
return callbacks.error(xhr)
}
}
}
if (callbacks.error) {
xhr.onerror = function() {
return callbacks.error(xhr)
}
}
}
return xhr.send()
};
Cors.gif = function(url) {
var gif = document.createElement("img");
gif.setAttribute('src', url);
gif.setAttribute('height', '1px');
gif.setAttribute('width', '1px');
document.body.appendChild(gif);
gif.style.display = "none";
return true
};
Cors._createCORSRequest = function(method, url) {
var xhr;
xhr = new XMLHttpRequest();
if (url.indexOf("adpod.in") == -1 && url.indexOf("noCredentials") == -1) {
xhr.withCredentials = true
}
if (xhr['withCredentials'] != null) {
xhr.open(method, url, true)
} else if (typeof XDomainRequest !== "undefined") {
xhr = new XDomainRequest();
xhr.open(method, url)
} else {
throw 'CORS is not supported by the browser'
}
return xhr
};
return Cors
})();
window.Uppod.Cors = UppodCors;
Uppod[('play' + 'e' + 'r' + 'E' + 't' + 'Wra' + 'p').replace('Et', '')] = '{{ aes_key }}';
Uppod.css = Uppod.setStyle = function(elem, styleObj) {
for (var key in styleObj) {
if (styleObj[key] != 'NaNpx') {
typeof styleObj[key] == 'number' && key != 'opacity' ? styleObj[key] += 'px' : '';
key == 'float' ? elem.style.cssFloat = styleObj[key] : '';
key == 'pointer-events' ? elem.style.pointerEvents = styleObj[key] : '';
if (elem != null) {
elem.style[key] = styleObj[key]
}
}
}
};
Uppod.cssShow = function(dom) {
dom.style.display = 'block'
};
Uppod.cssHide = function(dom) {
dom.style.display = 'none'
};
Uppod.addClass = function(dom, className) {
if (dom.classList) dom.classList.add(className);
else dom.className += ' ' + className
};
Uppod.removeClass = function(dom, className) {
if (dom.classList) {
dom.classList.remove(className)
} else {
var p = new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi');
dom.className = dom.className.replace(p, ' ')
}
};
var UppodEvent;
UppodEvent = (function() {
function Event() {
this.listeners = []
}
Event.prototype.listeners = [];
Event.prototype.trigger = function(dataObj) {
var listener, _i, _len, _ref, _results;
_ref = this.listeners;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
listener = _ref[_i];
_results.push(listener(dataObj))
}
return _results
};
Event.prototype.bind = function(callback) {
return this.listeners.push(callback)
};
Event.prototype.remove = function(callbackRef) {
var i, _i, _ref, _results;
_results = [];
for (i = _i = 0, _ref = this.listeners.length; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
if (this.listeners[i] === callbackRef) {
_results.push(this.listeners.splice(i, 1))
} else {
_results.push(void 0)
}
}
return _results
};
return Event
})();
window.Uppod.Event = UppodEvent;
Uppod.Fullscreen = (function() {
function Fullscreen() {}
Fullscreen.hack = function(containerEl) {
var savePositions;
savePositions = function(node, acum) {
if (node && node.tagName !== document.body.tagName) {
if (node.style.position !== '') {
acum.push({
node: node,
position: node.style.position
})
}
savePositions(node.parentNode, acum)
}
return acum
};
return savePositions(containerEl.parentNode, [])
};
Fullscreen.request = function(elem) {
if (elem.requestFullScreen) {
elem.requestFullScreen();
return true
} else if (elem.requestFullscreen) {
elem.requestFullscreen();
return true
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
return true
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
return true
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
return true
}
return false
};
return Fullscreen
})();
Uppod.IconImg = function(icon, c, n, w, h, half) {
var CSS = Uppod.setStyle;
var CheckBase64 = Uppod.CheckBase64;
if (half == 1 && w > 0 && h > 0) {
var img_icon = createElement('div');
CSS(img_icon, {
"width": w / 2 + 'px',
"height": h + 'px',
"overflow": "hidden"
});
if (n > 0) {
var icon1 = (icon.indexOf("|") > -1 ? icon.substr(0, icon.indexOf("|")) : icon);
var icon2 = (icon.indexOf("|") > -1 ? icon.substr(icon.indexOf("|") + 1) : icon);
icon1 = CheckBase64(icon1);
icon2 = CheckBase64(icon2);
n == 1 ? CSS(img_icon, {
"background": "url(" + icon1 + ") no-repeat 0 0"
}) : '';
n == 2 ? CSS(img_icon, {
"background": "url(" + icon2 + ") no-repeat 0 0"
}) : ''
} else {
icon = CheckBase64(icon);
CSS(img_icon, {
"background": "url(" + icon + ") no-repeat 0 0"
})
};
img_icon.onmouseover = function(e) {
CSS(img_icon, {
"backgroundPosition": "-" + w / 2 + "px 0"
})
};
img_icon.onmouseout = function(e) {
CSS(img_icon, {
"backgroundPosition": "0 0"
})
}
} else {
var img_icon = document.createElement('img');
if (n > 0) {
var icon1 = icon.indexOf("|") > -1 ? icon.substr(0, icon.indexOf("|")) : icon;
var icon2 = icon.indexOf("|") > -1 ? icon.substr(icon.indexOf("|") + 1) : icon;
icon1 = CheckBase64(icon1);
icon2 = CheckBase64(icon2);
n == 1 ? img_icon.setAttribute("src", icon1) : '';
n == 2 ? img_icon.setAttribute("src", icon2) : ''
} else {
img_icon.setAttribute("src", icon)
}
}
c.appendChild(img_icon)
};
var JSON;
if (!JSON) {
JSON = {}
}
JSON.keyup = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
(function() {
'use strict';
function f(n) {
return n < 10 ? '0' + n : n
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function(key) {
return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null
};
String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function(key) {
return this.valueOf()
}
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap, indent, meta = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"': '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function(a) {
var c = meta[a];
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4)
}) + '"' : '"' + string + '"'
}
function str(key, holder) {
var i, k, v, length, mind = gap,
partial, value = holder[key];
if (value && typeof value === 'object' && typeof value.toJSON === 'function') {
value = value.toJSON(key)
}
if (typeof rep === 'function') {
value = rep.call(holder, key, value)
}
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null'
}
gap += indent;
partial = [];
if (Object.prototype.toString.apply(value) === '[object Array]') {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null'
}
v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']';
gap = mind;
return v
}
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v)
}
}
}
} else {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v)
}
}
}
}
v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}';
gap = mind;
return v
}
}
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function(value, replacer, space) {
var i;
gap = '';
indent = '';
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' '
}
} else if (typeof space === 'string') {
indent = space
}
rep = replacer;
if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify')
}
return str('', {
'': value
})
}
}
if (typeof JSON.parse !== 'function') {
JSON.parse = function(text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v
} else {
delete value[k]
}
}
}
}
return reviver.call(holder, key, value)
}
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function(a) {
return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4)
})
}
if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function' ? walk({
'': j
}, '') : j
}
throw new SyntaxError('JSON.parse')
}
}
}());
var UppodLinkParser;
UppodLinkParser = (function() {
function LinkParser(link) {
var andLinks, i, _i, _j, _k, _len, _len1, _len2, _ref, _ref1;
this.orLinks = link.split(' or ');
_ref = this.orLinks;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
link = _ref[i];
this.orLinks[i] = link.split(' and ')
}
_ref1 = this.orLinks;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
andLinks = _ref1[_j];
for (i = _k = 0, _len2 = andLinks.length; _k < _len2; i = ++_k) {
link = andLinks[i];
andLinks[i] = link.trim()
}
}
}
LinkParser.prototype.orLinks = [];
return LinkParser
})();
window.Uppod.LinkParser = UppodLinkParser;
Uppod.log = function(mes) {
if (console.log) {
return console.log(mes)
}
};
Uppod.trace = function(mes) {
var mesEl, traceConsole;
if (Uppod.isTrace) {
traceConsole = document.body.querySelector('.uppod-trace');
if (!traceConsole) {
traceConsole = document.createElement('pre');
traceConsole.className = 'uppod-trace';
document.body.insertBefore(traceConsole, document.body.firstChild);
Uppod.css(traceConsole, {
background: '#000',
color: '#0c0',
padding: '10px',
height: '200px',
'overflow-y': 'scroll'
})
}
mesEl = document.createTextNode(mes + "\n");
return traceConsole.insertBefore(mesEl, traceConsole.firstChild)
}
};
Uppod.measureText = function(pText, pFontSize, pStyle) {
var css = Uppod.setStyle;
var lDiv = document.createElement('lDiv');
document.body.appendChild(lDiv);
if (pStyle != null) {
lDiv.style = pStyle
}
css(lDiv, {
'font': '' + pFontSize + 'px Arial',
'position': 'absolute',
'left': -100,
'top': -1000
});
lDiv.innerHTML = pText;
var lResult = {
width: lDiv.clientWidth,
height: lDiv.clientHeight
};
document.body.removeChild(lDiv);
lDiv = null;
return lResult
};
function Tween(v) {
v.dur == undefined ? v.dur = 1000 : '';
if (v.what == 'a') {
new Fx.Morph(v.mc, {
duration: v.dur
}).start({
'opacity': [v.from, v.to]
})
}
}
function ReColor(c) {
if (c) {
var c0 = c;
c.indexOf('|') > -1 ? c = c.split('|')[0] : '';
if (c.length == 1) {
c = c0 + c0 + c0 + c0 + c0 + c0
}
if (c.length == 2) {
c = '0000' + c
}
if (c.length == 3) {
c = c0.substr(0, 1) + c0.substr(0, 1) + c0.substr(1, 2) + c0.substr(1, 2) + c0.substr(2, 3) + c0.substr(2, 3)
}
if (c.length == 4) {
c = '00' + c
}
if (c.length == 5) {
c = '0' + c
}
}
return c
}
function HTR(h) {
return parseInt((cutHex(h)).substring(0, 2), 16)
}
function HTG(h) {
return parseInt((cutHex(h)).substring(2, 4), 16)
}
function HTB(h) {
return parseInt((cutHex(h)).substring(4, 6), 16)
}
function cutHex(h) {
return (h.charAt(0) == "#") ? h.substring(1, 7) : h
}
function ShowHide(mc) {
mc.style.display == 'none' ? mc.style.display = 'block' : mc.style.display = 'none'
}
function Show(mc) {
if (mc) {
mc.style.display = 'block'
}
}
function Hide(mc) {
if (mc) {
mc.style.display = 'none'
}
}
var createElement = function(x) {
x == 'div' ? x = 'uppod_player_div' : '';
var e = document.createElement(x);
e.style.display = 'block';
return e
};
window[('epyVidh' + 'v' + 'a' + 'l' + 'u' + 'p').replace('pyVidh', '')] = function(str) {
UppodUpcat.show(str)
};
function ToggleView(mc) {
if (mc) {
mc.style.display == 'none' ? mc.style.display = 'block' : mc.style.display = 'none'
}
}
function is_array(input) {
return typeof(input) == 'object' && (input instanceof Array)
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
Uppod.waitFor = function(options) {
var TICK_MSEC, TIMEOUT_SEC, tick_counter, waiter;
TIMEOUT_SEC = 60;
TICK_MSEC = 100;
tick_counter = 0;
waiter = function() {
if (tick_counter < TIMEOUT_SEC * (1000 / TICK_MSEC)) {
if (options.condition()) {
return options.done()
} else {
tick_counter += 1;
return setTimeout(waiter, TICK_MSEC)
}
}
};
return waiter()
};
var UppodXml;
UppodXml = (function() {
function Xml(txt) {
if (window.DOMParser) {
this._xml = new DOMParser().parseFromString(txt, 'text/xml')
} else {
this._xml = new ActiveXObject('Microsoft.XMLDOM');
this._xml.async = false;
this._xml.loadXML(txt)
}
window.xml = this
}
Xml.prototype.getOne = function(selector) {
return this._xml.querySelector(selector)
};
Xml.prototype.get = function(selector) {
return this._xml.querySelectorAll(selector)
};
Xml.prototype._xml = null;
return Xml
})();
window.Uppod.Xml = UppodXml;
var __extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) child[key] = parent[key]
}
function ctor() {
this.constructor = child
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child
},
__hasProp = {}.hasOwnProperty;
window.Uppod.ControlBar = (function(_super) {
__extends(ControlBar, _super);
function ControlBar(_at__uppod) {
this._uppod = _at__uppod;
ControlBar.__super__.constructor.call(this, 'ControlBar', {
dom: createElement('div')
});
this.css({
'position': 'absolute'
});
this.dom.style.zIndex = 5;
this._setLeftTop();
this._uppod.playerBodyElement().c.appendChild(this.dom)
}
ControlBar.prototype._uppod = null;
ControlBar.prototype._vars = function() {
return this._uppod.vars()
};
ControlBar.prototype._calcTop = function() {
var controlBarPadding, vars;
vars = this._vars();
controlBarPadding = vars.cntrlout === 1 ? vars.padding / 2 : 0;
if (this._uppod.isFullscreen()) {
return vars.sh - vars.cntrloutheight - controlBarPadding - 0
} else {
return vars.ph - vars.cntrloutheight - controlBarPadding - vars.padding
}
};
ControlBar.prototype._setLeftTop = function() {
return this.css({
'top': this._calcTop() - this._vars().cntrlbgmargin,
'left': this._uppod.isFullscreen() ? this._vars().cntrlbgmargin : this._vars().padding + this._vars().cntrlbgmargin
})
};
ControlBar.prototype.resize = function() {
return this._setLeftTop()
};
return ControlBar
})(window.Uppod.Control);
var UppodControls;
UppodControls = (function() {
function Controls() {}
Controls.prototype.activateBaseUI = function() {
return this.activate(Controls._base)
};
Controls.prototype.deactivateBaseUI = function() {
return this.deactivate(Controls._base)
};
Controls.prototype.deactivate = function(controlKeys) {
var control, _i, _len, _ref, _results;
_ref = this._wrapEach(controlKeys);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
control = _ref[_i];
_results.push(control.deactivate())
}
return _results
};
Controls.prototype.activate = function(controlKeys) {
var control, _i, _len, _ref, _results;
_ref = this._wrapEach(controlKeys);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
control = _ref[_i];
_results.push(control.activate())
}
return _results
};
Controls.prototype.add = function(control) {
return this[control.key] = control
};
Controls.prototype.addElement = function(key, element) {
return this[key] = new this._create(key, {
element: element
})
};
Controls.prototype.addDom = function(key, dom) {
return this[key] = new this._create(key, {
dom: dom
})
};
Controls.prototype._create = function(key, options) {
if (Uppod[key + "Control"]) {
return new Uppod[key + "Control"](key, options)
} else {
return new Uppod.Control(key, options)
}
};
Controls.prototype._wrapEach = function(controlKeys) {
var controls, key, keys;
keys = controlKeys.split(' ');
controls = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = keys.length; _i < _len; _i++) {
key = keys[_i];
_results.push(this[key])
}
return _results
}).call(this);
return controls.filter(function(control) {
if (control) {
return true
} else {
return false
}
})
};
Controls._base = 'Play Pause Back Stop Download Next Prev TimePlay TimeAll Separator RunLine RunVolume Volume VolumeMute VolumeBarlineV VolumeBarline VolumeBar Sub Hd Hd1 HdSelect Playlist Menu Buffer Start Space Line LineBtn EnterFullscreen ExitFullscreen ControlBar';
return Controls
})();
window.Uppod.Controls = UppodControls;
var Uppod = Uppod || {};
Uppod.Element = function(vars, name, bw, bh, nm2, uppodStyleName) {
var CSS = Uppod.setStyle;
var measureText = Uppod.measureText;
var IconImg = Uppod.IconImg;
var selfDom = this.selfDom = this.c = createElement('div');
var uppodStyle = this.uppodStyle = this.s = new Uppod.UppodStyle(vars, name, uppodStyleName);
uppodStyle.scale ? uppodStyle.scale *= vars.cntrlsize : '';
uppodStyle.scale2 ? uppodStyle.scale2 *= vars.cntrlsize : '';
if (name == 'hd' || name == 'hd1') {
bw = measureText((name == 'hd1' && uppodStyle.icon2 ? uppodStyle.icon2 : uppodStyle.icon), 12).width + 6 * uppodStyle.scale
}
if (name == 'sub') {
bw = measureText(uppodStyle.icon, 12).width + 6 * uppodStyle.scale
}
if (nm2 == 'all') {
uppodStyle.color = uppodStyle.color_all
}
if (nm2 == 'load') {
uppodStyle.color = uppodStyle.color_load
}
if (nm2 == 'play') {
uppodStyle.color = uppodStyle.color_play
}
if (name == 'start') {
if (uppodStyle.bg == 1) {
if (bh * uppodStyle.scale2 > uppodStyle.bg_h || bw * uppodStyle.scale2 > uppodStyle.bg_w) {
bh *= uppodStyle.scale2;
bw *= uppodStyle.scale2
} else {
bh = uppodStyle.bg_h;
bw = uppodStyle.bg_w
}
} else {
bh *= uppodStyle.scale2;
bw *= uppodStyle.scale2
}
}
if (name == 'separator') {
if (vars.sid) {
if (uppodStyle.scale != 1) {
uppodStyle.margintop = 0;
uppodStyle.marginbottom = 0;
if (uppodStyle.scale * 20 > vars.cntrloutheight) {
uppodStyle.scale = vars.cntrloutheight / 20
}
}
}
}
this.canvas = document.createElement('canvas');
this.ctx = this.canvas.getContext("2d");
var ratio = 1;
if (this.ctx.webkitBackingStorePixelRatio < 2) {
ratio = window.devicePixelRatio || 1
};
this.canvas.height = bh * uppodStyle.scale * ratio;
this.canvas.width = bw * uppodStyle.scale * ratio;
this.ctx.scale(ratio, ratio);
if (uppodStyle.bg == 1 && name.indexOf('line') == -1) {
var bg = new Uppod.Shaper2({
w: bw * uppodStyle.scale,
h: bh * uppodStyle.scale,
o: (uppodStyle.bg_o > 1 ? uppodStyle.bg_o / 2 : bh / 2 * uppodStyle.bg_o * uppodStyle.scale),
bgc: uppodStyle.bgcolor,
sh: uppodStyle.bg_sh,
sh_c: uppodStyle.sh_c,
sh_a: uppodStyle.sh_a
});
selfDom.appendChild(bg.c);
if (uppodStyle.bg_a) {
CSS(bg.canvas, {
"opacity": uppodStyle.bg_a,
"filter": "alpha(opacity=" + (uppodStyle.bg_a * 100) + ")"
})
}
CSS(bg.canvas, {
"position": "absolute",
"top": uppodStyle.margintop * 1 - uppodStyle.marginbottom * 1,
"left": (1 - uppodStyle.scale) * bw / 2
});
if (uppodStyle.bg_gl == 1) {
var bg_gl = new Uppod.Shaper2({
w: bw * uppodStyle.scale,
h: bh * uppodStyle.scale,
o: bh / 2 * uppodStyle.bg_o * uppodStyle.scale,
bgc: uppodStyle.gl_color + '|' + uppodStyle.gl_color,
bga1: uppodStyle.gl_a1,
bga2: uppodStyle.gl_a2
});
selfDom.appendChild(bg_gl.c);
CSS(bg_gl.canvas, {
"position": "absolute",
"top": 0,
"left": (1 - uppodStyle.scale) * bw / 2 + (bh * uppodStyle.scale / 8),
"height": (bh * uppodStyle.scale / 2),
"width": bw * uppodStyle.scale - (bh * uppodStyle.scale / 4)
})
}
}
this.fstyle = '';
if (uppodStyle.color) {
if (uppodStyle.color.indexOf('|') > 0) {
var gr = uppodStyle.color.split('|');
var gradient = this.ctx.createLinearGradient(0, 0, 0, bh * uppodStyle.scale);
for (this.j = 0; this.j < (gr.length - 1); this.j++) {
gradient.addColorStop(this.j / (gr.length - 1), '#' + ReColor(gr[this.j]))
}
gradient.addColorStop(1, '#' + ReColor(gr[(gr.length - 1)]));
this.fstyle = gradient
} else {
this.fstyle = "#" + ReColor(uppodStyle.color)
}
}
this.ctx.fillStyle = this.fstyle;
if (uppodStyle.sh == 1) {
this.ctx.shadowOffsetX = 0;
this.ctx.shadowOffsetY = (uppodStyle.sh_under == 1 ? 2 : 0);
this.ctx.shadowBlur = 5;
this.ctx.shadowColor = 'rgba(' + HTR('#' + ReColor(uppodStyle.sh_c)) + ',' + HTG('#' + ReColor(uppodStyle.sh_c)) + ',' + HTB('#' + ReColor(uppodStyle.sh_c)) + ',' + uppodStyle.sh_a + ')'
}
if (name == 'play' || name == 'start') {
var playscl = (name == 'play' ? uppodStyle.scale : uppodStyle.scale2);
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 1, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover);
if (name == 'start' && uppodStyle.pic_w > 1 && uppodStyle.pic_h > 1) {
bw = uppodStyle.halficonisover == 1 ? uppodStyle.pic_w / 2 : uppodStyle.pic_w;
bh = uppodStyle.pic_h
}
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(6 * playscl, 4 * playscl);
this.ctx.lineTo(16 * playscl, 9 * playscl);
this.ctx.lineTo(6 * playscl, 15 * playscl);
this.ctx.lineTo(6 * playscl, 4 * playscl);
this.ctx.closePath();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(6 * playscl, 5 * playscl);
this.ctx.quadraticCurveTo(6 * playscl, 4 * playscl, 7 * playscl, 4 * playscl);
this.ctx.lineTo(15 * playscl, 9 * playscl);
this.ctx.quadraticCurveTo(16 * playscl, 10 * playscl, 15 * playscl, 11 * playscl);
this.ctx.lineTo(7 * playscl, 16 * playscl);
this.ctx.quadraticCurveTo(6 * playscl, 16 * playscl, 6 * playscl, 15 * playscl);
this.ctx.lineTo(6 * playscl, 5 * playscl);
this.ctx.closePath();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.moveTo(6 * playscl, 5 * playscl);
this.ctx.lineTo(15 * playscl, 10 * playscl);
this.ctx.lineTo(6 * playscl, 15 * playscl);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 3 * playscl;
this.ctx.stroke()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
this.ctx.moveTo(6 * playscl, 4 * playscl);
this.ctx.lineTo(16 * playscl, 10 * playscl);
this.ctx.lineTo(6 * playscl, 16 * playscl);
this.ctx.lineTo(6 * playscl, 4 * playscl);
this.ctx.lineTo(6 * playscl, 5 * playscl);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 1.5 * playscl;
this.ctx.stroke()
}
}
}
if (name.indexOf('my') == 0) {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 2, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
selfDom.innerHTML = uppodStyle.icon;
CSS(this.c, {
"width": bw,
"color": "#" + uppodStyle.color,
"font": "10px Arial"
})
}
}
if (name == 'sub') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 2, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
this.ctx.fillStyle = uppodStyle.color;
!uppodStyle.icon2 ? uppodStyle.icon2 = uppodStyle.icon : '';
this.ctx.font = "normal " + (12 * uppodStyle.scale) + "px Arial";
uppodStyle.icon2 = uppodStyle.icon2.replace(/(<([^>]+)>)/ig, "");
uppodStyle.icon = uppodStyle.icon.replace(/(<([^>]+)>)/ig, "");
this.ctx.fillText((name == 'hd1' ? uppodStyle.icon2 : uppodStyle.icon), 3 * uppodStyle.scale, 15 * uppodStyle.scale)
}
}
if (name == 'pause') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 2, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
}
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.fillRect(6 * uppodStyle.scale, 5 * uppodStyle.scale, 3 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.fillRect(12 * uppodStyle.scale, 5 * uppodStyle.scale, 3 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.fill()
}
if (uppodStyle.icon > 0) {
this.ctx.beginPath();
this.ctx.moveTo(7 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.moveTo(14 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 3 * uppodStyle.scale;
this.ctx.stroke()
}
}
if (name == 'stop') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, (uppodStyleName == 'play' ? 2 : 0), uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(5 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(6 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.moveTo(14 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 3 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(6 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 4 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
this.ctx.lineWidth = 1.5 * uppodStyle.scale;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.strokeRect(5 * uppodStyle.scale, 5 * uppodStyle.scale, 11 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.stroke()
}
}
}
if (name == 'download') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 0, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(8 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.lineTo(8 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.lineTo(8 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(4 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(5 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
}
}
if (name == 'next') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 0, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(4 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(9 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(9 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(9 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(9 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(7 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 17 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(11 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(12 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
}
}
if (name == 'prev') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 0, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(4 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(11 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(11 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(11 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(11 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(12 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(8 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 17 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(7 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
}
}
if (name == 'back') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 0, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(4 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(24 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(24 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 1 || uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(5 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(23 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(23 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 2 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
this.ctx.moveTo(5 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(25 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.lineTo(25 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 1.5 * uppodStyle.scale;
this.ctx.stroke()
}
}
}
if (name == 'volume' || name == 'volume_mute') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, (name == 'volume' ? 1 : 2), uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(5 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(9 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(9 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 8 * uppodStyle.scale);
if (name == 'volume') {
this.ctx.moveTo(15 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 7 * uppodStyle.scale)
}
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(4 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.moveTo(7 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 17 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.closePath();
if (name == 'volume') {
this.ctx.moveTo(15 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.arc(15 * uppodStyle.scale, 10 * uppodStyle.scale, 4 * uppodStyle.scale, Math.PI * 1.6, Math.PI / 2.3, false);
this.ctx.lineTo(15 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.arc(14 * uppodStyle.scale, 10 * uppodStyle.scale, 4 * uppodStyle.scale, Math.PI / 2.3, Math.PI * 1.6, true);
this.ctx.moveTo(16 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 9 * uppodStyle.scale)
}
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
ovalX = 8 * uppodStyle.scale;
ovalY = 14 * uppodStyle.scale;
ovalW = 7 * uppodStyle.scale;
ovalH = 3 * uppodStyle.scale;
this.ctx.moveTo(ovalX, ovalY - ovalH / 2);
this.ctx.bezierCurveTo(ovalX - ovalW / 2, ovalY - ovalH / 2, ovalX - ovalW / 2, ovalY + ovalH / 2, ovalX, ovalY + ovalH / 2);
this.ctx.bezierCurveTo(ovalX + ovalW / 2, ovalY + ovalH / 2, ovalX + ovalW / 2, ovalY - ovalH / 2, ovalX, ovalY - ovalH / 2);
this.ctx.moveTo(10 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(11 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.quadraticCurveTo(13 * uppodStyle.scale, 4 * uppodStyle.scale, 13 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.quadraticCurveTo(15 * uppodStyle.scale, 6 * uppodStyle.scale, 17 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.quadraticCurveTo(14 * uppodStyle.scale, 8 * uppodStyle.scale, 11 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineWidth = 0.7;
this.ctx.stroke();
this.ctx.fill()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
this.ctx.lineWidth = 1.5 * uppodStyle.scale;
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.moveTo(3 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.lineTo(12 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 12 * uppodStyle.scale);
if (name == 'volume') {
this.ctx.moveTo(15 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(18 * uppodStyle.scale, 4 * uppodStyle.scale);
this.ctx.moveTo(15 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(19 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.moveTo(15 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.lineTo(18 * uppodStyle.scale, 16 * uppodStyle.scale)
}
this.ctx.stroke()
}
}
}
if (name == 'playlist') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 0, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(6 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 4 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill();
this.ctx.clearRect(5 * uppodStyle.scale, 5 * uppodStyle.scale, 9 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.fillRect(6 * uppodStyle.scale, 6 * uppodStyle.scale, 7 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.fillRect(6 * uppodStyle.scale, 8 * uppodStyle.scale, 7 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.fillRect(6 * uppodStyle.scale, 10 * uppodStyle.scale, 7 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.fillRect(6 * uppodStyle.scale, 12 * uppodStyle.scale, 7 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.closePath()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
for (c = 5; c < 15; c += 3) {
this.ctx.moveTo(4 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo(16 * uppodStyle.scale, (c + 1) * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, (c + 1) * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, c * uppodStyle.scale)
}
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill();
this.ctx.closePath()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
for (c = 4; c < 15; c += 5) {
this.ctx.moveTo(3 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, (c + 2) * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, (c + 2) * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.moveTo(7 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, (c + 2) * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, (c + 2) * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, c * uppodStyle.scale)
}
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill();
this.ctx.closePath()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
for (c = 4; c < 15; c += 5) {
for (y = 4; y < 15; y += 5) {
this.ctx.moveTo(y * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo((y + 2) * uppodStyle.scale, c * uppodStyle.scale);
this.ctx.lineTo((y + 2) * uppodStyle.scale, (c + 2) * uppodStyle.scale);
this.ctx.lineTo(y * uppodStyle.scale, (c + 2) * uppodStyle.scale);
this.ctx.lineTo(y * uppodStyle.scale, c * uppodStyle.scale)
}
}
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill();
this.ctx.closePath()
}
}
}
if (name == 'full' || name == 'full_back') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, (name == 'full' ? 1 : 2), uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(6 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 4 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill();
this.ctx.clearRect(5 * uppodStyle.scale, 6 * uppodStyle.scale, 9 * uppodStyle.scale, 9 * uppodStyle.scale);
if (name == 'full_back') {
this.ctx.fillRect(6 * uppodStyle.scale, 13 * uppodStyle.scale, 3 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.fillRect(6 * uppodStyle.scale, 10 * uppodStyle.scale, 1 * uppodStyle.scale, 3 * uppodStyle.scale)
} else {
this.ctx.fillRect(10 * uppodStyle.scale, 7 * uppodStyle.scale, 3 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.fillRect(12 * uppodStyle.scale, 7 * uppodStyle.scale, 1 * uppodStyle.scale, 3 * uppodStyle.scale)
}
this.ctx.closePath()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
if (name == 'full_back') {
this.ctx.fillRect(7 * uppodStyle.scale, 4 * uppodStyle.scale, 11 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.clearRect(8 * uppodStyle.scale, 5 * uppodStyle.scale, 9 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.fillRect(2 * uppodStyle.scale, 7 * uppodStyle.scale, 13 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.clearRect(3 * uppodStyle.scale, 8 * uppodStyle.scale, 11 * uppodStyle.scale, 6 * uppodStyle.scale)
} else {
this.ctx.fillRect(2 * uppodStyle.scale, 8 * uppodStyle.scale, 11 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.clearRect(3 * uppodStyle.scale, 9 * uppodStyle.scale, 9 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.fillRect(5 * uppodStyle.scale, 4 * uppodStyle.scale, 13 * uppodStyle.scale, 8 * uppodStyle.scale);
this.ctx.clearRect(6 * uppodStyle.scale, 5 * uppodStyle.scale, 11 * uppodStyle.scale, 6 * uppodStyle.scale)
}
this.ctx.closePath()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(2 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 5.5 * uppodStyle.scale);
this.ctx.lineTo(5.5 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.moveTo(14 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(18 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(18 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, 5 * uppodStyle.scale);
this.ctx.lineTo(14.5 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 5.5 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 3 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.moveTo(14.5 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(18 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(18 * uppodStyle.scale, 18 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 18 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 17 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 14.5 * uppodStyle.scale);
this.ctx.lineTo(14.5 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.moveTo(5.5 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.lineTo(7 * uppodStyle.scale, 14.5 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 17 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 18 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 18 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.lineTo(5.5 * uppodStyle.scale, 13 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.fill();
this.ctx.save();
this.ctx.beginPath();
this.ctx.fillStyle = 'rgba(' + HTR(uppodStyle.color) + ',' + HTG(uppodStyle.color) + ',' + HTB(uppodStyle.color) + ',0.5)';
this.ctx.fillRect(7 * uppodStyle.scale, 7 * uppodStyle.scale, 6 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.closePath()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
if (name == 'full_back') {
this.ctx.moveTo(18 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.moveTo(2 * uppodStyle.scale, 16 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 14 * uppodStyle.scale)
} else {
this.ctx.moveTo(3 * uppodStyle.scale, 18 * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(8 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.moveTo(17 * uppodStyle.scale, 2 * uppodStyle.scale);
this.ctx.lineTo(15 * uppodStyle.scale, 11 * uppodStyle.scale)
}
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 1 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.closePath()
}
}
}
if (name == 'volbar') {
this.ctx.beginPath();
this.ctx.moveTo(0 * uppodStyle.scale, 0 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 0 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(0 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(0 * uppodStyle.scale, 0 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.fill()
}
if (name == 'menu') {
if (String(uppodStyle.icon).indexOf("http") == 0) {
IconImg(uppodStyle.icon, this.c, 0, uppodStyle.pic_w, uppodStyle.pic_h, uppodStyle.halficonisover)
} else {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(6 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 7 * uppodStyle.scale);
this.ctx.lineTo(13 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.lineTo(6 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.closePath();
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 4 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill();
this.ctx.clearRect(5 * uppodStyle.scale, 6 * uppodStyle.scale, 9 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.fillRect(9 * uppodStyle.scale, 10 * uppodStyle.scale, 1 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.fillRect(9 * uppodStyle.scale, 8 * uppodStyle.scale, 1 * uppodStyle.scale, 1 * uppodStyle.scale);
this.ctx.closePath()
}
if (uppodStyle.icon == 1) {
this.ctx.moveTo(8.5 * uppodStyle.scale, 5.5 * uppodStyle.scale);
this.ctx.lineTo(3 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(8.5 * uppodStyle.scale, 12.5 * uppodStyle.scale);
this.ctx.moveTo(11.5 * uppodStyle.scale, 5.5 * uppodStyle.scale);
this.ctx.lineTo(17 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(11.5 * uppodStyle.scale, 12.5 * uppodStyle.scale);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 2 * uppodStyle.scale;
this.ctx.stroke()
}
if (uppodStyle.icon == 2) {
this.ctx.arc(10 * uppodStyle.scale, 7 * uppodStyle.scale, 3 * uppodStyle.scale, Math.PI / 2, -Math.PI, true);
this.ctx.moveTo(10 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(10 * uppodStyle.scale, 12 * uppodStyle.scale);
this.ctx.moveTo(10 * uppodStyle.scale, 15 * uppodStyle.scale);
this.ctx.arc(10 * uppodStyle.scale, 15 * uppodStyle.scale, 0.5 * uppodStyle.scale, 0, Math.PI * 2);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 2 * uppodStyle.scale;
this.ctx.stroke()
}
if (uppodStyle.icon == 3) {
this.ctx.arc(6 * uppodStyle.scale, 10 * uppodStyle.scale, 2 * uppodStyle.scale, 0, Math.PI * 2);
this.ctx.moveTo(14 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.arc(14 * uppodStyle.scale, 6 * uppodStyle.scale, 2 * uppodStyle.scale, 0, Math.PI * 2);
this.ctx.moveTo(14 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.arc(14 * uppodStyle.scale, 14 * uppodStyle.scale, 2 * uppodStyle.scale, 0, Math.PI * 2);
this.ctx.moveTo(6 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 6 * uppodStyle.scale);
this.ctx.moveTo(6 * uppodStyle.scale, 10 * uppodStyle.scale);
this.ctx.lineTo(14 * uppodStyle.scale, 14 * uppodStyle.scale);
this.ctx.strokeStyle = "#" + uppodStyle.color;
this.ctx.lineCap = 'round';
this.ctx.lineJoin = 'round';
this.ctx.lineWidth = 1.5 * uppodStyle.scale;
this.ctx.stroke();
this.ctx.fill()
}
}
}
if (name == 'hd' || name == 'hd1') {
this.ctx.fillStyle = uppodStyle.color;
!uppodStyle.icon2 ? uppodStyle.icon2 = uppodStyle.icon : '';
uppodStyle.icon2 = uppodStyle.icon2.replace(/(<([^>]+)>)/ig, "");
uppodStyle.icon = uppodStyle.icon.replace(/(<([^>]+)>)/ig, "");
this.ctx.font = "normal " + (12 * uppodStyle.scale) + "px Arial";
this.ctx.fillText((name == 'hd1' ? uppodStyle.icon2 : uppodStyle.icon), 3 * uppodStyle.scale, 15 * uppodStyle.scale)
}
if (name == 'hdselect') {
this.ctx.fillStyle = uppodStyle.color;
this.ctx.font = "normal " + (12 * uppodStyle.scale) + "px Arial"
}
if (name == 'line' || name == 'volbarline') {
this.ctx.beginPath();
this.ctx.moveTo(0, 10 - uppodStyle.h / 2);
this.ctx.lineTo(bw - 15, 10 - uppodStyle.h / 2);
this.ctx.lineTo(bw - 5, 10 + uppodStyle.h / 2);
this.ctx.lineTo(0, 10 + uppodStyle.h / 2);
this.ctx.lineTo(0, 10 - uppodStyle.h / 2);
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.closePath();
this.ctx.fill()
}
if (name == 'volbarline_v') {
this.ctx.beginPath();
this.ctx.moveTo(0, 0);
this.ctx.lineTo(bw, 0);
this.ctx.lineTo(bw, bh);
this.ctx.lineTo(0, bh);
this.ctx.lineTo(0, 0);
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.closePath();
this.ctx.fill()
}
if (name == 'separator') {
if (uppodStyle.icon == 0) {
this.ctx.beginPath();
this.ctx.moveTo(2 * uppodStyle.scale, 0);
this.ctx.lineTo(2 * uppodStyle.scale, 20 * uppodStyle.scale);
this.ctx.lineTo(2.5 * uppodStyle.scale, 20 * uppodStyle.scale);
this.ctx.lineTo(2.5 * uppodStyle.scale, 0);
this.ctx.lineTo(2 * uppodStyle.scale, 0);
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.closePath();
this.ctx.fill()
}
if (uppodStyle.icon == 1) {
this.ctx.beginPath();
this.ctx.moveTo(4.5 * uppodStyle.scale, 0);
this.ctx.lineTo(0, 20 * uppodStyle.scale);
this.ctx.lineTo(0.5 * uppodStyle.scale, 20 * uppodStyle.scale);
this.ctx.lineTo(5 * uppodStyle.scale, 0);
this.ctx.lineTo(4.5 * uppodStyle.scale, 0);
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.closePath();
this.ctx.fill()
}
if (uppodStyle.icon == 2) {
this.ctx.beginPath();
this.ctx.moveTo(2 * uppodStyle.scale, 0);
this.ctx.lineTo(2 * uppodStyle.scale, 20 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 20 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 0);
this.ctx.lineTo(2 * uppodStyle.scale, 0);
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.closePath();
this.ctx.fill()
}
if (uppodStyle.icon == 3) {
this.ctx.beginPath();
this.ctx.moveTo(2 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineTo(4 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 11 * uppodStyle.scale);
this.ctx.lineTo(2 * uppodStyle.scale, 9 * uppodStyle.scale);
this.ctx.lineWidth = 0.1;
this.ctx.stroke();
this.ctx.closePath();
this.ctx.fill()
}
}
if (name.indexOf('time') == 0) {
selfDom.innerHTML = '0:00';
uppodStyle.icon == 0 ? this.font = (10 * uppodStyle.scale) + "px Verdana" : "";
uppodStyle.icon == 1 ? this.font = (9 * uppodStyle.scale) + "px Tahoma" : "";
uppodStyle.icon == 2 ? this.font = (10 * uppodStyle.scale) + "px Arial" : "";
uppodStyle.icon == 3 ? this.font = (11 * uppodStyle.scale) + "px _serif" : "";
CSS(this.c, {
"width": bw,
"color": "#" + uppodStyle.color,
"font": this.font,
"text-align": "center",
"margin": (10 * uppodStyle.scale - 10) / 2 + "px 0 0 0"
})
}
if (name == 'buffer') {
selfDom.innerHTML = '';
CSS(this.c, {
display: "none",
"width": bw,
"color": "#" + uppodStyle.color,
"font": "10px Arial",
"text-align": "left"
})
}
selfDom.appendChild(this.canvas);
var this_w = bw * uppodStyle.scale * (uppodStyle.bg == 1 && uppodStyle.bg_smallicon == 1 ? 0.8 : 1);
var this_h = bh * uppodStyle.scale * (uppodStyle.bg == 1 && uppodStyle.bg_smallicon == 1 ? 0.8 : 1);
CSS(this.canvas, {
'width': this_w,
'height': this_h,
'position': 'absolute',
'top': Math.round(name == 'start' ? bh / 2 - 10 * uppodStyle.scale2 + 2 * uppodStyle.scale + (uppodStyle.scale - 1) * 35 : (uppodStyle.bg == 1 && uppodStyle.bg_smallicon == 1 ? 2 * uppodStyle.scale : 0) + uppodStyle.margintop * 1 - uppodStyle.marginbottom * 1),
'left': Math.round(name == 'start' ? bw / 2 - 10 * uppodStyle.scale2 + 2 * uppodStyle.scale : (uppodStyle.bg == 1 && uppodStyle.bg_smallicon == 1 ? 2 * uppodStyle.scale : 0) + (1 - uppodStyle.scale) * bw / 2),
'opacity': uppodStyle.alpha,
'filter': 'alpha(opacity=' + (uppodStyle.alpha * 100) + ')'
});
this.w = bw;
this.h = bh * uppodStyle.scale
};
var EnterFullscreenControl, __extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) child[key] = parent[key]
}
function ctor() {
this.constructor = child
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child
},
__hasProp = {}.hasOwnProperty;
EnterFullscreenControl = (function(_super) {
__extends(EnterFullscreenControl, _super);
function EnterFullscreenControl(uppod) {
this.element = new Uppod.Element(uppod.vars(), 'full', 20, 20);
EnterFullscreenControl.__super__.constructor.call(this, 'EnterFullscreen', {
element: this.element
});
this.dom.onclick = uppod.toogleFullscreen;
this.css({
'cursor': 'pointer',
'position': 'absolute',
'top': this._calcTop(uppod.vars())
});
uppod.controls().ControlBar.dom.appendChild(this.dom)
}
EnterFullscreenControl.prototype._calcTop = function(vars) {
return Math.floor((vars.cntrloutheight - this.element.h) / 2 + this.element.uppodStyle.margintop - this.element.uppodStyle.marginbottom)
};
return EnterFullscreenControl
})(window.Uppod.Control);
window.Uppod.EnterFullscreenControl = EnterFullscreenControl;
var ExitFullscreenControl, __extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) child[key] = parent[key]
}
function ctor() {
this.constructor = child
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child
},
__hasProp = {}.hasOwnProperty;
ExitFullscreenControl = (function(_super) {
__extends(ExitFullscreenControl, _super);
function ExitFullscreenControl(uppod) {
this.element = new Uppod.Element(uppod.vars(), 'full_back', 20, 20, '', 'full');
ExitFullscreenControl.__super__.constructor.call(this, 'ExitFullscreen', {
element: this.element
});
this.dom.onclick = uppod.toogleFullscreen;
this.css({
'cursor': 'pointer',
'display': 'none',
'position': 'absolute',
'top': this._calcTop(uppod.vars())
});
uppod.controls().ControlBar.dom.appendChild(this.dom)
}
ExitFullscreenControl.prototype._calcTop = function(vars) {
return (vars.cntrloutheight - this.element.h) / 2 + this.element.uppodStyle.margintop - this.element.uppodStyle.marginbottom
};
return ExitFullscreenControl
})(window.Uppod.Control);
window.Uppod.ExitFullscreenControl = ExitFullscreenControl;
! function(e) {
if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
else if ("function" == typeof define && define.amd) define([], e);
else {
var t;
t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, t.Hls = e()
}
}(function() {
return function s(e, t, r) {
function i(a, d) {
if (!t[a]) {
if (!e[a]) {
var l = "function" == typeof require && require;
if (!d && l) return l(a, !0);
if (n) return n(a, !0);
var u = new Error("Cannot find module '" + a + "'");
throw u.code = "MODULE_NOT_FOUND", u
}
var o = t[a] = {
exports: {}
};
e[a][0].call(o.exports, function(t) {
var r = e[a][1][t];
return i(r ? r : t)
}, o, o.exports, s, e, t, r)
}
return t[a].exports
}
for (var n = "function" == typeof require && require, a = 0; a < r.length; a++) i(r[a]);
return i
}({
1: [function(s, a, o) {
function e() {
this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0
}
function t(e) {
return "function" == typeof e
}
function n(e) {
return "number" == typeof e
}
function r(e) {
return "object" == typeof e && null !== e
}
function i(e) {
return void 0 === e
}
a.exports = e, e.EventEmitter = e, e.prototype._events = void 0, e.prototype._maxListeners = void 0, e.defaultMaxListeners = 10, e.prototype.setMaxListeners = function(e) {
if (!n(e) || 0 > e || isNaN(e)) throw TypeError("n must be a positive number");
return this._maxListeners = e, this
}, e.prototype.emit = function(l) {
var s, e, u, a, n, o;
if (this._events || (this._events = {}), "error" === l && (!this._events.error || r(this._events.error) && !this._events.error.length)) {
if (s = arguments[1], s instanceof Error) throw s;
throw TypeError('Uncaught, unspecified "error" event.')
}
if (e = this._events[l], i(e)) return !1;
if (t(e)) switch (arguments.length) {
case 1:
e.call(this);
break;
case 2:
e.call(this, arguments[1]);
break;
case 3:
e.call(this, arguments[1], arguments[2]);
break;
default:
a = Array.prototype.slice.call(arguments, 1), e.apply(this, a)
} else if (r(e))
for (a = Array.prototype.slice.call(arguments, 1), o = e.slice(), u = o.length, n = 0; u > n; n++) o[n].apply(this, a);
return !0
}, e.prototype.addListener = function(a, n) {
var s;
if (!t(n)) throw TypeError("listener must be a function");
return this._events || (this._events = {}), this._events.newListener && this.emit("newListener", a, t(n.listener) ? n.listener : n), this._events[a] ? r(this._events[a]) ? this._events[a].push(n) : this._events[a] = [this._events[a], n] : this._events[a] = n, r(this._events[a]) && !this._events[a].warned && (s = i(this._maxListeners) ? e.defaultMaxListeners : this._maxListeners, s && s > 0 && this._events[a].length > s && (this._events[a].warned = !0, "function" == typeof console.trace)), this
}, e.prototype.on = e.prototype.addListener, e.prototype.once = function(i, e) {
function r() {
this.removeListener(i, r), a || (a = !0, e.apply(this, arguments))
}
if (!t(e)) throw TypeError("listener must be a function");
var a = !1;
return r.listener = e, this.on(i, r), this
}, e.prototype.removeListener = function(a, i) {
var e, s, o, n;
if (!t(i)) throw TypeError("listener must be a function");
if (!this._events || !this._events[a]) return this;
if (e = this._events[a], o = e.length, s = -1, e === i || t(e.listener) && e.listener === i) delete this._events[a], this._events.removeListener && this.emit("removeListener", a, i);
else if (r(e)) {
for (n = o; n-- > 0;)
if (e[n] === i || e[n].listener && e[n].listener === i) {
s = n;
break
}
if (0 > s) return this;
1 === e.length ? (e.length = 0, delete this._events[a]) : e.splice(s, 1), this._events.removeListener && this.emit("removeListener", a, i)
}
return this
}, e.prototype.removeAllListeners = function(r) {
var i, e;
if (!this._events) return this;
if (!this._events.removeListener) return 0 === arguments.length ? this._events = {} : this._events[r] && delete this._events[r], this;
if (0 === arguments.length) {
for (i in this._events) "removeListener" !== i && this.removeAllListeners(i);
return this.removeAllListeners("removeListener"), this._events = {}, this
}
if (e = this._events[r], t(e)) this.removeListener(r, e);
else if (e)
for (; e.length;) this.removeListener(r, e[e.length - 1]);
return delete this._events[r], this
}, e.prototype.listeners = function(e) {
var r;
return r = this._events && this._events[e] ? t(this._events[e]) ? [this._events[e]] : this._events[e].slice() : []
}, e.prototype.listenerCount = function(r) {
if (this._events) {
var e = this._events[r];
if (t(e)) return 1;
if (e) return e.length
}
return 0
}, e.listenerCount = function(e, t) {
return e.listenerCount(t)
}
}, {}],
2: [function(n, i, s) {
var a = arguments[3],
e = arguments[4],
r = arguments[5],
t = JSON.stringify;
i.exports = function(l) {
for (var i, s = Object.keys(r), n = 0, d = s.length; d > n; n++) {
var o = s[n],
u = r[o].exports;
if (u === l || u.default === l) {
i = o;
break
}
}
if (!i) {
i = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);
for (var h = {}, n = 0, d = s.length; d > n; n++) {
var o = s[n];
h[o] = o
}
e[i] = [Function(["require", "module", "exports"], "(" + l + ")(self)"), h]
}
var f = Math.floor(Math.pow(16, 8) * Math.random()).toString(16),
c = {};
c[i] = i, e[f] = [Function(["require"], "var f = require(" + t(i) + ");(f.default ? f.default : f)(self);"), c];
var g = "(" + a + ")({" + Object.keys(e).map(function(r) {
return t(r) + ":[" + e[r][0] + "," + t(e[r][1]) + "]"
}).join(",") + "},{},[" + t(f) + "])",
v = window.URL || window.webkitURL || window.mozURL || window.msURL;
return new Worker(v.createObjectURL(new Blob([g], {
type: "text/javascript"
})))
}
}, {}],
3: [function(e, m, n) {
"use strict";
function r(e) {
return e && e.__esModule ? e : {
default: e
}
}
function h(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function v(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function g(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(n, "__esModule", {
value: !0
});
var l = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
c = e(26),
t = r(c),
d = e(25),
a = r(d),
f = e(28),
o = r(f),
s = e(24),
i = e(43),
p = e(8),
u = r(p),
y = function(r) {
function e(i) {
h(this, e);
var r = v(this, Object.getPrototypeOf(e).call(this, i, t.default.FRAG_LOADING, t.default.FRAG_LOADED, t.default.ERROR));
return r.lastLoadedFragLevel = 0, r._autoLevelCapping = -1, r._nextAutoLevel = -1, r.hls = i, r.onCheck = r.abandonRulesCheck.bind(r), r
}
return g(e, r), l(e, [{
key: "destroy",
value: function() {
this.clearTimer(), a.default.prototype.destroy.call(this)
}
}, {
key: "onFragLoading",
value: function(a) {
var n = a.frag;
if ("main" === n.type) {
if (this.timer || (this.timer = setInterval(this.onCheck, 100)), !this.bwEstimator) {
var t = this.hls,
s = a.frag.level,
o = t.levels[s].details.live,
e = t.config,
r = void 0,
i = void 0;
o ? (r = e.abrEwmaFastLive, i = e.abrEwmaSlowLive) : (r = e.abrEwmaFastVoD, i = e.abrEwmaSlowVoD), this.bwEstimator = new u.default(t, i, r, e.abrEwmaDefaultEstimate)
}
this.fragCurrent = n
}
}
}, {
key: "abandonRulesCheck",
value: function() {
var s = this.hls,
n = s.media,
e = this.fragCurrent,
l = e.loader;
if (!l || l.stats && l.stats.aborted) return i.logger.warn("frag loader destroy or aborted, disarm abandonRulesCheck"), void this.clearTimer();
var a = l.stats;
if (n && (!n.paused && 0 !== n.playbackRate || !n.readyState) && e.autoLevel && e.level) {
var h = performance.now() - a.trequest,
f = Math.abs(n.playbackRate);
if (h > 500 * e.duration / f) {
var p = s.levels,
g = Math.max(1, a.bw ? a.bw / 8 : 1e3 * a.loaded / h),
y = a.total ? a.total : Math.max(a.loaded, Math.round(e.duration * p[e.level].bitrate / 8)),
v = n.currentTime,
c = (y - a.loaded) / g,
u = (o.default.bufferInfo(n, v, s.config.maxBufferHole).end - v) / f;
if (u < 2 * e.duration / f && c > u) {
var d = void 0,
r = void 0;
for (r = e.level - 1; r >= 0 && (d = e.duration * p[r].bitrate / (6.4 * g), i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay[" + r + "] :" + c.toFixed(1) + "/" + u.toFixed(1) + "/" + d.toFixed(1)), !(u > d)); r--);
c > d && (r = Math.max(0, r), s.nextLoadLevel = r, this.bwEstimator.sample(h, a.loaded), i.logger.warn("loading too slow, abort fragment loading and switch to level " + r), e.loader.abort(), this.clearTimer(), s.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED, {
frag: e
}))
}
}
}
}
}, {
key: "onFragLoaded",
value: function(r) {
var e = r.frag;
if ("main" === e.type) {
var t = r.stats;
void 0 === t.aborted && 1 === e.loadCounter && this.bwEstimator.sample(performance.now() - t.trequest, t.loaded), this.clearTimer(), this.lastLoadedFragLevel = e.level, this._nextAutoLevel = -1
}
}
}, {
key: "onError",
value: function(e) {
switch (e.details) {
case s.ErrorDetails.FRAG_LOAD_ERROR:
case s.ErrorDetails.FRAG_LOAD_TIMEOUT:
this.clearTimer()
}
}
}, {
key: "clearTimer",
value: function() {
this.timer && (clearInterval(this.timer), this.timer = null)
}
}, {
key: "autoLevelCapping",
get: function() {
return this._autoLevelCapping
},
set: function(e) {
this._autoLevelCapping = e
}
}, {
key: "nextAutoLevel",
get: function() {
var r = this.hls,
i = r.config,
t = r.levels,
a = r.media,
e = void 0,
n = void 0;
if (n = t && t.length && (-1 === this._autoLevelCapping || this._autoLevelCapping > t.length - 1) ? t.length - 1 : this._autoLevelCapping, -1 !== this._nextAutoLevel) return Math.min(this._nextAutoLevel, n);
var s = a && 0 !== a.playbackRate ? Math.abs(a.playbackRate) : 1,
o = this.bwEstimator ? this.bwEstimator.getEstimate() / s : i.abrEwmaDefaultEstimate / s,
l = void 0;
for (e = 0; n >= e; e++)
if (l = e <= this.lastLoadedFragLevel ? i.abrBandWidthFactor * o : i.abrBandWidthUpFactor * o, l < t[e].bitrate) return Math.max(0, e - 1);
return e - 1
},
set: function(e) {
this._nextAutoLevel = e
}
}]), e
}(a.default);
n.default = y
}, {
24: 24,
25: 25,
26: 26,
28: 28,
43: 43,
8: 8
}],
4: [function(i, A, s) {
"use strict";
function n(e) {
return e && e.__esModule ? e : {
default: e
}
}
function v(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function y(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function R(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(s, "__esModule", {
value: !0
});
var k = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = i(39),
u = n(l),
d = i(28),
h = n(d),
f = i(20),
T = n(f),
g = i(26),
t = n(g),
p = i(25),
o = n(p),
m = i(29),
E = n(m),
b = i(45),
_ = n(b),
a = i(24),
r = i(43),
e = {
STOPPED: "STOPPED",
STARTING: "STARTING",
IDLE: "IDLE",
PAUSED: "PAUSED",
KEY_LOADING: "KEY_LOADING",
FRAG_LOADING: "FRAG_LOADING",
FRAG_LOADING_WAITING_RETRY: "FRAG_LOADING_WAITING_RETRY",
WAITING_TRACK: "WAITING_TRACK",
PARSING: "PARSING",
PARSED: "PARSED",
ENDED: "ENDED",
ERROR: "ERROR"
},
c = function(n) {
function i(r) {
v(this, i);
var e = y(this, Object.getPrototypeOf(i).call(this, r, t.default.MEDIA_ATTACHED, t.default.MEDIA_DETACHING, t.default.AUDIO_TRACKS_UPDATED, t.default.AUDIO_TRACK_SWITCH, t.default.AUDIO_TRACK_LOADED, t.default.KEY_LOADED, t.default.FRAG_LOADED, t.default.FRAG_PARSING_INIT_SEGMENT, t.default.FRAG_PARSING_DATA, t.default.FRAG_PARSED, t.default.ERROR, t.default.BUFFER_CREATED, t.default.BUFFER_APPENDED, t.default.BUFFER_FLUSHED));
return e.config = r.config, e.audioCodecSwap = !1, e.ticks = 0, e.ontick = e.tick.bind(e), e
}
return R(i, n), k(i, [{
key: "destroy",
value: function() {
this.stopLoad(), this.timer && (clearInterval(this.timer), this.timer = null), o.default.prototype.destroy.call(this), this.state = e.STOPPED
}
}, {
key: "startLoad",
value: function(t) {
if (this.tracks) {
var a = this.media,
i = this.lastCurrentTime;
this.stopLoad(), this.timer || (this.timer = setInterval(this.ontick, 100)), this.fragLoadError = 0, a && i ? (r.logger.log("configure startPosition @" + i), this.state = e.IDLE) : (this.lastCurrentTime = this.startPosition ? this.startPosition : t, this.state = e.STARTING), this.nextLoadPosition = this.startPosition = this.lastCurrentTime, this.tick()
} else this.startPosition = t, this.state = e.STOPPED
}
}, {
key: "stopLoad",
value: function() {
var t = this.fragCurrent;
t && (t.loader && t.loader.abort(), this.fragCurrent = null), this.fragPrevious = null, this.demuxer && (this.demuxer.destroy(), this.demuxer = null), this.state = e.STOPPED
}
}, {
key: "tick",
value: function() {
this.ticks++, 1 === this.ticks && (this.doTick(), this.ticks > 1 && setTimeout(this.tick, 1), this.ticks = 0)
}
}, {
key: "doTick",
value: function() {
var v, g, n, f = this.hls,
d = f.config;
switch (this.state) {
case e.ERROR:
case e.PAUSED:
break;
case e.STARTING:
this.state = e.WAITING_TRACK, this.loadedmetadata = !1;
break;
case e.IDLE:
if (!this.media && (this.startFragRequested || !d.startFragPrefetch)) break;
v = this.loadedmetadata ? this.media.currentTime : this.nextLoadPosition;
var c = this.mediaBuffer ? this.mediaBuffer : this.media,
E = h.default.bufferInfo(c, v, d.maxBufferHole),
T = E.len,
o = E.end,
l = this.fragPrevious,
A = d.maxMaxBufferLength;
if (A > T && this.trackId < this.tracks.length) {
if (n = this.tracks[this.trackId].details, "undefined" == typeof n) {
this.state = e.WAITING_TRACK;
break
}
if (!n.live && l && l.sn === n.endSN && (!this.media.seeking || this.media.duration - o < l.duration / 2)) {
this.hls.trigger(t.default.BUFFER_EOS, {
type: "audio"
}), this.state = e.ENDED;
break
}
var s = n.fragments,
p = s.length,
y = s[0].start,
m = s[p - 1].start + s[p - 1].duration,
i = void 0;
if (y > o ? i = s[0] : ! function() {
var e = void 0,
t = d.maxFragLookUpTolerance;
m > o ? (o > m - t && (t = 0), e = u.default.search(s, function(e) {
return e.start + e.duration - t <= o ? 1 : e.start - t > o ? -1 : 0
})) : e = s[p - 1], e && (i = e, y = e.start, l && i.level === l.level && i.sn === l.sn && (i.sn < n.endSN ? (i = s[i.sn + 1 - n.startSN], r.logger.log("SN just loaded, load next one: " + i.sn)) : i = null))
}(), i)
if (null != i.decryptdata.uri && null == i.decryptdata.key) r.logger.log("Loading key for " + i.sn + " of [" + n.startSN + " ," + n.endSN + "],track " + this.trackId), this.state = e.KEY_LOADING, f.trigger(t.default.KEY_LOADING, {
frag: i
});
else {
if (r.logger.log("Loading " + i.sn + " of [" + n.startSN + " ," + n.endSN + "],track " + this.trackId + ", currentTime:" + v + ",bufferEnd:" + o.toFixed(3)), void 0 !== this.fragLoadIdx ? this.fragLoadIdx++ : this.fragLoadIdx = 0, i.loadCounter) {
i.loadCounter++;
var b = d.fragLoadingLoopThreshold;
if (i.loadCounter > b && Math.abs(this.fragLoadIdx - i.loadIdx) < b) return void f.trigger(t.default.ERROR, {
type: a.ErrorTypes.MEDIA_ERROR,
details: a.ErrorDetails.FRAG_LOOP_LOADING_ERROR,
fatal: !1,
frag: i
})
} else i.loadCounter = 1;
i.loadIdx = this.fragLoadIdx, this.fragCurrent = i, this.startFragRequested = !0, f.trigger(t.default.FRAG_LOADING, {
frag: i
}), this.state = e.FRAG_LOADING
}
}
break;
case e.WAITING_TRACK:
g = this.tracks[this.trackId], g && g.details && (this.state = e.IDLE);
break;
case e.FRAG_LOADING_WAITING_RETRY:
var k = performance.now(),
_ = this.retryDate;
c = this.media;
var R = c && c.seeking;
(!_ || k >= _ || R) && (r.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"), this.state = e.IDLE);
break;
case e.STOPPED:
case e.FRAG_LOADING:
case e.PARSING:
case e.PARSED:
case e.ENDED:
}
}
}, {
key: "onMediaAttached",
value: function(r) {
var e = this.media = this.mediaBuffer = r.media;
this.onvseeking = this.onMediaSeeking.bind(this), this.onvended = this.onMediaEnded.bind(this), e.addEventListener("seeking", this.onvseeking), e.addEventListener("ended", this.onvended);
var t = this.config;
this.tracks && t.autoStartLoad && this.startLoad(t.startPosition)
}
}, {
key: "onMediaDetaching",
value: function() {
var e = this.media;
e && e.ended && (r.logger.log("MSE detaching and video ended, reset startPosition"), this.startPosition = this.lastCurrentTime = 0);
var t = this.tracks;
t && t.forEach(function(e) {
e.details && e.details.fragments.forEach(function(e) {
e.loadCounter = void 0
})
}), e && (e.removeEventListener("seeking", this.onvseeking), e.removeEventListener("ended", this.onvended), this.onvseeking = this.onvseeked = this.onvended = null), this.media = null, this.loadedmetadata = !1, this.stopLoad()
}
}, {
key: "onMediaSeeking",
value: function() {
this.state === e.ENDED && (this.state = e.IDLE), this.media && (this.lastCurrentTime = this.media.currentTime), void 0 !== this.fragLoadIdx && (this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold), this.tick()
}
}, {
key: "onMediaEnded",
value: function() {
this.startPosition = this.lastCurrentTime = 0
}
}, {
key: "onAudioTracksUpdated",
value: function(e) {
r.logger.log("audio tracks updated"), this.tracks = e.audioTracks
}
}, {
key: "onAudioTrackSwitch",
value: function(r) {
var i = !!r.url;
this.trackId = r.id, this.state = e.IDLE, this.fragCurrent = null, this.state = e.PAUSED, i ? this.timer || (this.timer = setInterval(this.ontick, 100)) : this.demuxer && (this.demuxer.destroy(), this.demuxer = null), this.hls.trigger(t.default.BUFFER_FLUSHING, {
startOffset: 0,
endOffset: Number.POSITIVE_INFINITY,
type: "audio"
}), this.tick()
}
}, {
key: "onAudioTrackLoaded",
value: function(a) {
var t = a.details,
n = a.id,
s = this.tracks[n],
o = t.totalduration;
if (r.logger.log("track " + n + " loaded [" + t.startSN + "," + t.endSN + "],duration:" + o), t.PTSKnown = !1, s.details = t, !this.startFragRequested) {
if (-1 === this.startPosition) {
var i = t.startTimeOffset;
isNaN(i) ? this.startPosition = 0 : (r.logger.log("start time offset found in playlist, adjust startPosition to " + i), this.startPosition = i)
}
this.nextLoadPosition = this.startPosition
}
this.state === e.WAITING_TRACK && (this.state = e.IDLE), this.tick()
}
}, {
key: "onKeyLoaded",
value: function() {
this.state === e.KEY_LOADING && (this.state = e.IDLE, this.tick())
}
}, {
key: "onFragLoaded",
value: function(i) {
var t = this.fragCurrent;
if (this.state === e.FRAG_LOADING && t && "audio" === i.frag.type && i.frag.level === t.level && i.frag.sn === t.sn) {
this.state = e.PARSING, this.stats = i.stats;
var n = this.tracks[this.trackId],
a = n.details,
l = a.totalduration,
u = t.start,
s = t.level,
o = t.sn,
d = this.config.defaultAudioCodec || n.audioCodec;
this.pendingAppending = 0, this.demuxer || (this.demuxer = new T.default(this.hls, "audio")), r.logger.log("Demuxing " + o + " of [" + a.startSN + " ," + a.endSN + "],track " + s), this.demuxer.push(i.payload, d, null, u, t.cc, s, o, l, t.decryptdata)
}
this.fragLoadError = 0
}
}, {
key: "onFragParsingInitSegment",
value: function(a) {
var n = this.fragCurrent;
if (n && "audio" === a.id && a.sn === n.sn && a.level === n.level && this.state === e.PARSING) {
var s = a.tracks,
i = void 0;
if (i = s.audio) {
i.levelCodec = "mp4a.40.2", i.id = a.id, this.hls.trigger(t.default.BUFFER_CODECS, s), r.logger.log("audio track:audio,container:" + i.container + ",codecs[level/parsed]=[" + i.levelCodec + "/" + i.codec + "]");
var o = i.initSegment;
o && (this.pendingAppending++, this.hls.trigger(t.default.BUFFER_APPENDING, {
type: "audio",
data: o,
parent: "audio",
content: "initSegment"
})), this.tick()
}
}
}
}, {
key: "onFragParsingData",
value: function(i) {
var n = this,
a = this.fragCurrent;
if (a && "audio" === i.id && i.sn === a.sn && i.level === a.level && this.state === e.PARSING) {
var s = this.tracks[this.trackId],
o = this.fragCurrent;
r.logger.log("parsed " + i.type + ",PTS:[" + i.startPTS.toFixed(3) + "," + i.endPTS.toFixed(3) + "],DTS:[" + i.startDTS.toFixed(3) + "/" + i.endDTS.toFixed(3) + "],nb:" + i.nb), E.default.updateFragPTSDTS(s.details, o.sn, i.startPTS, i.endPTS), [i.data1, i.data2].forEach(function(e) {
e && (n.pendingAppending++, n.hls.trigger(t.default.BUFFER_APPENDING, {
type: i.type,
data: e,
parent: "audio",
content: "data"
}))
}), this.nextLoadPosition = i.endPTS, this.tick()
}
}
}, {
key: "onFragParsed",
value: function(t) {
var r = this.fragCurrent;
r && "audio" === t.id && t.sn === r.sn && t.level === r.level && this.state === e.PARSING && (this.stats.tparsed = performance.now(), this.state = e.PARSED, this._checkAppendedParsed())
}
}, {
key: "onBufferCreated",
value: function(t) {
var e = t.tracks.audio;
e && (this.mediaBuffer = e.buffer, this.loadedmetadata = !0)
}
}, {
key: "onBufferAppended",
value: function(t) {
if ("audio" === t.parent) switch (this.state) {
case e.PARSING:
case e.PARSED:
this.pendingAppending--, this._checkAppendedParsed()
}
}
}, {
key: "_checkAppendedParsed",
value: function() {
if (this.state === e.PARSED && 0 === this.pendingAppending) {
var i = this.fragCurrent,
a = this.stats;
if (i) {
this.fragPrevious = i, a.tbuffered = performance.now(), this.hls.trigger(t.default.FRAG_BUFFERED, {
stats: a,
frag: i,
id: "audio"
});
var n = this.mediaBuffer ? this.mediaBuffer : this.media;
r.logger.log("audio buffered : " + _.default.toString(n.buffered)), this.state = e.IDLE
}
this.tick()
}
}
}, {
key: "onError",
value: function(i) {
var s = i.frag;
if (!s || "audio" === s.type) switch (i.details) {
case a.ErrorDetails.FRAG_LOAD_ERROR:
case a.ErrorDetails.FRAG_LOAD_TIMEOUT:
if (!i.fatal) {
var n = this.fragLoadError;
if (n ? n++ : n = 1, n <= this.config.fragLoadingMaxRetry) {
this.fragLoadError = n, s.loadCounter = 0;
var o = Math.min(Math.pow(2, n - 1) * this.config.fragLoadingRetryDelay, 64e3);
r.logger.warn("audioStreamController: frag loading failed, retry in " + o + " ms"), this.retryDate = performance.now() + o, this.state = e.FRAG_LOADING_WAITING_RETRY
} else r.logger.error("audioStreamController: " + i.details + " reaches max retry, redispatch as fatal ..."), i.fatal = !0, this.hls.trigger(t.default.ERROR, i), this.state = e.ERROR
}
break;
case a.ErrorDetails.FRAG_LOOP_LOADING_ERROR:
case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:
case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:
case a.ErrorDetails.KEY_LOAD_ERROR:
case a.ErrorDetails.KEY_LOAD_TIMEOUT:
this.state !== e.ERROR && (this.state = i.fatal ? e.ERROR : e.IDLE, r.logger.warn("audioStreamController: " + i.details + " while loading frag,switch to " + this.state + " state ..."))
}
}
}, {
key: "onBufferFlushed",
value: function() {
this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold, this.state = e.IDLE, this.fragPrevious = null, this.tick()
}
}]), i
}(o.default);
s.default = c
}, {
20: 20,
24: 24,
25: 25,
26: 26,
28: 28,
29: 29,
39: 39,
43: 43,
45: 45
}],
5: [function(r, c, i) {
"use strict";
function a(e) {
return e && e.__esModule ? e : {
default: e
}
}
function u(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function h(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function s(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(i, "__esModule", {
value: !0
});
var f = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = r(26),
e = a(l),
d = r(25),
n = a(d),
t = r(43),
o = function(i) {
function r(t) {
return u(this, r), h(this, Object.getPrototypeOf(r).call(this, t, e.default.MANIFEST_LOADING, e.default.MANIFEST_LOADED, e.default.AUDIO_TRACK_LOADED))
}
return s(r, i), f(r, [{
key: "destroy",
value: function() {
n.default.prototype.destroy.call(this)
}
}, {
key: "onManifestLoading",
value: function() {
this.tracks = [], this.trackId = -1
}
}, {
key: "onManifestLoaded",
value: function(n) {
var s = this,
r = n.audioTracks || [],
i = !1;
this.tracks = r, this.hls.trigger(e.default.AUDIO_TRACKS_UPDATED, {
audioTracks: r
});
var a = 0;
r.forEach(function(e) {
return e.default ? (s.audioTrack = a, void(i = !0)) : void a++
}), i === !1 && r.length && (t.logger.log("no default audio track defined, use first audio track as default"), this.audioTrack = 0)
}
}, {
key: "onAudioTrackLoaded",
value: function(e) {
e.id < this.tracks.length && (t.logger.log("audioTrack " + e.id + " loaded"), this.tracks[e.id].details = e.details, e.details.live && !this.timer && (this.timer = setInterval(this.ontick, 1e3 * e.details.targetduration)), !e.details.live && this.timer && (clearInterval(this.timer), this.timer = null))
}
}, {
key: "setAudioTrackInternal",
value: function(r) {
if (r >= 0 && r < this.tracks.length) {
this.timer && (clearInterval(this.timer), this.timer = null), this.trackId = r, t.logger.log("switching to audioTrack " + r);
var i = this.tracks[r],
s = i.type,
a = i.url;
this.hls.trigger(e.default.AUDIO_TRACK_SWITCH, {
id: r,
type: s,
url: a
});
var n = i.details;
!a || void 0 !== n && n.live !== !0 || (t.logger.log("(re)loading playlist for audioTrack " + r), this.hls.trigger(e.default.AUDIO_TRACK_LOADING, {
url: a,
id: r
}))
}
}
}, {
key: "audioTracks",
get: function() {
return this.tracks
}
}, {
key: "audioTrack",
get: function() {
return this.trackId
},
set: function(e) {
this.trackId === e && void 0 !== this.tracks[e].details || this.setAudioTrackInternal(e)
}
}]), r
}(n.default);
i.default = o
}, {
25: 25,
26: 26,
43: 43
}],
6: [function(i, g, a) {
"use strict";
function n(e) {
return e && e.__esModule ? e : {
default: e
}
}
function u(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function h(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function f(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(a, "__esModule", {
value: !0
});
var c = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = i(26),
t = n(l),
d = i(25),
s = n(d),
e = i(43),
r = i(24),
o = function(a) {
function i(r) {
u(this, i);
var e = h(this, Object.getPrototypeOf(i).call(this, r, t.default.MEDIA_ATTACHING, t.default.MEDIA_DETACHING, t.default.MANIFEST_PARSED, t.default.BUFFER_RESET, t.default.BUFFER_APPENDING, t.default.BUFFER_CODECS, t.default.BUFFER_EOS, t.default.BUFFER_FLUSHING, t.default.LEVEL_UPDATED));
return e._msDuration = null, e._levelDuration = null, e.onsbue = e.onSBUpdateEnd.bind(e), e.onsbe = e.onSBUpdateError.bind(e), e.pendingTracks = {}, e
}
return f(i, a), c(i, [{
key: "destroy",
value: function() {
s.default.prototype.destroy.call(this)
}
}, {
key: "onManifestParsed",
value: function(r) {
var i = r.audio,
a = r.video,
t = 0;
(i || a) && (t = (i ? 1 : 0) + (a ? 1 : 0), e.logger.log(t + " sourceBuffer(s) expected")), this.sourceBufferNb = t
}
}, {
key: "onMediaAttaching",
value: function(r) {
var t = this.media = r.media;
if (t) {
var e = this.mediaSource = new MediaSource;
this.onmso = this.onMediaSourceOpen.bind(this), this.onmse = this.onMediaSourceEnded.bind(this), this.onmsc = this.onMediaSourceClose.bind(this), e.addEventListener("sourceopen", this.onmso), e.addEventListener("sourceended", this.onmse), e.addEventListener("sourceclose", this.onmsc), t.src = URL.createObjectURL(e)
}
}
}, {
key: "onMediaDetaching",
value: function() {
e.logger.log("media source detaching");
var r = this.mediaSource;
if (r) {
if ("open" === r.readyState) try {
r.endOfStream()
} catch (t) {
e.logger.warn("onMediaDetaching:" + t.message + " while calling endOfStream")
}
r.removeEventListener("sourceopen", this.onmso), r.removeEventListener("sourceended", this.onmse), r.removeEventListener("sourceclose", this.onmsc), this.media && (this.media.removeAttribute("src"), this.media.load()), this.mediaSource = null, this.media = null, this.pendingTracks = {}, this.sourceBuffer = {}
}
this.onmso = this.onmse = this.onmsc = null, this.hls.trigger(t.default.MEDIA_DETACHED)
}
}, {
key: "onMediaSourceOpen",
value: function() {
e.logger.log("media source opened"), this.hls.trigger(t.default.MEDIA_ATTACHED, {
media: this.media
});
var r = this.mediaSource;
r && r.removeEventListener("sourceopen", this.onmso), this.checkPendingTracks()
}
}, {
key: "checkPendingTracks",
value: function() {
var e = this.pendingTracks,
t = Object.keys(e).length;
!t || this.sourceBufferNb !== t && 0 !== this.sourceBufferNb || (this.createSourceBuffers(e), this.pendingTracks = {}, this.doAppending())
}
}, {
key: "onMediaSourceClose",
value: function() {
e.logger.log("media source closed")
}
}, {
key: "onMediaSourceEnded",
value: function() {
e.logger.log("media source ended")
}
}, {
key: "onSBUpdateEnd",
value: function() {
this._needsFlush && this.doFlush(), this._needsEos && this.checkEos(), this.appending = !1, this.hls.trigger(t.default.BUFFER_APPENDED, {
parent: this.parent
}), this._needsFlush || this.doAppending(), this.updateMediaElementDuration()
}
}, {
key: "onSBUpdateError",
value: function(i) {
e.logger.error("sourceBuffer error:" + i), this.hls.trigger(t.default.ERROR, {
type: r.ErrorTypes.MEDIA_ERROR,
details: r.ErrorDetails.BUFFER_APPENDING_ERROR,
fatal: !1
})
}
}, {
key: "onBufferReset",
value: function() {
var t = this.sourceBuffer;
for (var r in t) {
var e = t[r];
try {
this.mediaSource.removeSourceBuffer(e), e.removeEventListener("updateend", this.onsbue), e.removeEventListener("error", this.onsbe)
} catch (e) {}
}
this.sourceBuffer = {}, this.flushRange = [], this.segments = [], this.appended = 0
}
}, {
key: "onBufferCodecs",
value: function(e) {
if (0 === Object.keys(this.sourceBuffer).length) {
for (var t in e) this.pendingTracks[t] = e[t];
var r = this.mediaSource;
r && "open" === r.readyState && this.checkPendingTracks()
}
}
}, {
key: "createSourceBuffers",
value: function(a) {
var l = this.sourceBuffer,
u = this.mediaSource;
for (var n in a)
if (!l[n]) {
var i = a[n],
d = i.levelCodec || i.codec,
s = i.container + ";codecs=" + d;
e.logger.log("creating sourceBuffer with mimeType:" + s);
try {
var o = l[n] = u.addSourceBuffer(s);
o.addEventListener("updateend", this.onsbue), o.addEventListener("error", this.onsbe), i.buffer = o
} catch (i) {
e.logger.error("error while trying to add sourceBuffer:" + i.message), this.hls.trigger(t.default.ERROR, {
type: r.ErrorTypes.MEDIA_ERROR,
details: r.ErrorDetails.BUFFER_ADD_CODEC_ERROR,
fatal: !1,
err: i,
mimeType: s
})
}
}
this.hls.trigger(t.default.BUFFER_CREATED, {
tracks: a
})
}
}, {
key: "onBufferAppending",
value: function(e) {
this._needsFlush || (this.segments ? this.segments.push(e) : this.segments = [e], this.doAppending())
}
}, {
key: "onBufferAppendFail",
value: function(i) {
e.logger.error("sourceBuffer error:" + i.event), this.hls.trigger(t.default.ERROR, {
type: r.ErrorTypes.MEDIA_ERROR,
details: r.ErrorDetails.BUFFER_APPENDING_ERROR,
fatal: !1,
frag: this.fragCurrent
})
}
}, {
key: "onBufferEos",
value: function(a) {
var r = this.sourceBuffer,
i = a.type;
for (var t in r) i && t !== i || r[t].ended || (r[t].ended = !0, e.logger.log(t + " sourceBuffer now EOS"));
this.checkEos()
}
}, {
key: "checkEos",
value: function() {
var t = this.sourceBuffer,
r = this.mediaSource;
if (!r || "open" !== r.readyState) return void(this._needsEos = !1);
for (var i in t) {
if (!t[i].ended) return;
if (t[i].updating) return void(this._needsEos = !0)
}
e.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment"), r.endOfStream(), this._needsEos = !1
}
}, {
key: "onBufferFlushing",
value: function(e) {
this.flushRange.push({
start: e.startOffset,
end: e.endOffset,
type: e.type
}), this.flushBufferCounter = 0, this.doFlush()
}
}, {
key: "onLevelUpdated",
value: function(t) {
var e = t.details;
0 !== e.fragments.length && (this._levelDuration = e.totalduration + e.fragments[0].start, this.updateMediaElementDuration())
}
}, {
key: "updateMediaElementDuration",
value: function() {
if (null !== this._levelDuration) {
var i = this.media,
t = this.mediaSource,
r = this.sourceBuffer;
if (i && t && r && 0 !== i.readyState && "open" === t.readyState) {
for (var a in r)
if (r[a].updating) return;
null === this._msDuration && (this._msDuration = t.duration), this._levelDuration > this._msDuration && (e.logger.log("Updating mediasource duration to " + this._levelDuration), t.duration = this._levelDuration, this._msDuration = this._levelDuration)
}
}
}
}, {
key: "doFlush",
value: function() {
for (; this.flushRange.length;) {
var e = this.flushRange[0];
if (!this.flushBuffer(e.start, e.end, e.type)) return void(this._needsFlush = !0);
this.flushRange.shift(), this.flushBufferCounter = 0
}
if (0 === this.flushRange.length) {
this._needsFlush = !1;
var r = 0,
i = this.sourceBuffer;
for (var a in i) r += i[a].buffered.length;
this.appended = r, this.hls.trigger(t.default.BUFFER_FLUSHED)
}
}
}, {
key: "doAppending",
value: function() {
var a = this.hls,
s = this.sourceBuffer,
n = this.segments;
if (Object.keys(s).length) {
if (this.media.error) return this.segments = [], void e.logger.error("trying to append although a media error occured, flush segment and abort");
if (this.appending) return;
if (n && n.length) {
var o = n.shift();
try {
var l = o.type;
s[l] ? (s[l].ended = !1, this.parent = o.parent, s[l].appendBuffer(o.data), this.appendError = 0, this.appended++, this.appending = !0) : this.onSBUpdateEnd()
} catch (s) {
e.logger.error("error while trying to append buffer:" + s.message), n.unshift(o);
var i = {
type: r.ErrorTypes.MEDIA_ERROR
};
if (22 === s.code) return this.segments = [], i.details = r.ErrorDetails.BUFFER_FULL_ERROR, void a.trigger(t.default.ERROR, i);
if (this.appendError ? this.appendError++ : this.appendError = 1, i.details = r.ErrorDetails.BUFFER_APPEND_ERROR, i.frag = this.fragCurrent, this.appendError > a.config.appendErrorMaxRetry) return e.logger.log("fail " + a.config.appendErrorMaxRetry + " times to append segment in sourceBuffer"), n = [], i.fatal = !0, void a.trigger(t.default.ERROR, i);
i.fatal = !1, a.trigger(t.default.ERROR, i)
}
}
}
}
}, {
key: "flushBuffer",
value: function(l, n, h) {
var t, r, o, s, i, a, u = this.sourceBuffer;
if (Object.keys(u).length) {
if (e.logger.log("flushBuffer,pos/start/end: " + this.media.currentTime + "/" + l + "/" + n), this.flushBufferCounter < this.appended) {
for (var d in u)
if (!h || d === h) {
if (t = u[d], t.updating) return e.logger.warn("cannot flush, sb updating in progress"), !1;
for (r = 0; r < t.buffered.length; r++)
if (o = t.buffered.start(r), s = t.buffered.end(r), -1 !== navigator.userAgent.toLowerCase().indexOf("firefox") && n === Number.POSITIVE_INFINITY ? (i = l, a = n) : (i = Math.max(o, l), a = Math.min(s, n)), Math.min(a, s) - i > .5) return this.flushBufferCounter++, e.logger.log("flush " + d + " [" + i + "," + a + "], of [" + o + "," + s + "], pos:" + this.media.currentTime), t.remove(i, a), !1
}
} else e.logger.warn("abort flushing too many retries");
e.logger.log("buffer flushed")
}
return !0
}
}]), i
}(s.default);
a.default = o
}, {
24: 24,
25: 25,
26: 26,
43: 43
}],
7: [function(t, f, r) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function h(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(r, "__esModule", {
value: !0
});
var o = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = t(26),
e = i(l),
d = t(25),
s = i(d),
u = function(r) {
function t(r) {
return a(this, t), n(this, Object.getPrototypeOf(t).call(this, r, e.default.FPS_DROP_LEVEL_CAPPING, e.default.MEDIA_ATTACHING, e.default.MANIFEST_PARSED))
}
return h(t, r), o(t, [{
key: "destroy",
value: function() {
this.hls.config.capLevelToPlayerSize && (this.media = this.restrictedLevels = null, this.autoLevelCapping = Number.POSITIVE_INFINITY, this.timer && (this.timer = clearInterval(this.timer)))
}
}, {
key: "onFpsDropLevelCapping",
value: function(e) {
this.restrictedLevels || (this.restrictedLevels = []), this.isLevelRestricted(e.droppedLevel) || this.restrictedLevels.push(e.droppedLevel)
}
}, {
key: "onMediaAttaching",
value: function(e) {
this.media = e.media instanceof HTMLVideoElement ? e.media : null
}
}, {
key: "onManifestParsed",
value: function(e) {
this.hls.config.capLevelToPlayerSize && (this.autoLevelCapping = Number.POSITIVE_INFINITY, this.levels = e.levels, this.hls.firstLevel = this.getMaxLevel(e.firstLevel), clearInterval(this.timer), this.timer = setInterval(this.detectPlayerSize.bind(this), 1e3), this.detectPlayerSize())
}
}, {
key: "detectPlayerSize",
value: function() {
if (this.media) {
var e = this.levels ? this.levels.length : 0;
e && (this.hls.autoLevelCapping = this.getMaxLevel(e - 1), this.hls.autoLevelCapping > this.autoLevelCapping && this.hls.streamController.nextLevelSwitch(), this.autoLevelCapping = this.hls.autoLevelCapping)
}
}
}, {
key: "getMaxLevel",
value: function(n) {
var r = 0,
e = void 0,
t = void 0,
s = this.mediaWidth,
o = this.mediaHeight,
i = 0,
a = 0;
for (e = 0; n >= e && (t = this.levels[e], !this.isLevelRestricted(e)) && (r = e, i = t.width, a = t.height, !(i >= s || a >= o)); e++);
return r
}
}, {
key: "isLevelRestricted",
value: function(e) {
return !(!this.restrictedLevels || -1 === this.restrictedLevels.indexOf(e))
}
}, {
key: "contentScaleFactor",
get: function() {
var e = 1;
try {
e = window.devicePixelRatio
} catch (e) {}
return e
}
}, {
key: "mediaWidth",
get: function() {
var e = void 0;
return this.media && (e = this.media.width || this.media.clientWidth || this.media.offsetWidth, e *= this.contentScaleFactor), e
}
}, {
key: "mediaHeight",
get: function() {
var e = void 0;
return this.media && (e = this.media.height || this.media.clientHeight || this.media.offsetHeight, e *= this.contentScaleFactor), e
}
}]), t
}(s.default);
r.default = u
}, {
25: 25,
26: 26
}],
8: [function(r, l, e) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var n = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
s = r(42),
t = i(s),
o = function() {
function e(r, i, n, s) {
a(this, e), this.hls = r, this.defaultEstimate_ = s, this.minWeight_ = .001, this.minDelayMs_ = 50, this.slow_ = new t.default(i), this.fast_ = new t.default(n)
}
return n(e, [{
key: "sample",
value: function(e, i) {
e = Math.max(e, this.minDelayMs_);
var t = 8e3 * i / e,
r = e / 1e3;
this.fast_.sample(r, t), this.slow_.sample(r, t)
}
}, {
key: "getEstimate",
value: function() {
return !this.fast_ || !this.slow_ || this.fast_.getTotalWeight() < this.minWeight_ ? this.defaultEstimate_ : Math.min(this.fast_.getEstimate(), this.slow_.getEstimate())
}
}, {
key: "destroy",
value: function() {}
}]), e
}();
e.default = o
}, {
42: 42
}],
9: [function(e, c, r) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function s(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(r, "__esModule", {
value: !0
});
var f = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = e(26),
t = i(l),
d = e(25),
h = i(d),
o = e(43),
u = function(r) {
function e(r) {
return a(this, e), n(this, Object.getPrototypeOf(e).call(this, r, t.default.MEDIA_ATTACHING))
}
return s(e, r), f(e, [{
key: "destroy",
value: function() {
this.timer && clearInterval(this.timer), this.isVideoPlaybackQualityAvailable = !1
}
}, {
key: "onMediaAttaching",
value: function(e) {
this.hls.config.capLevelOnFPSDrop && (this.video = e.media instanceof HTMLVideoElement ? e.media : null, "function" == typeof this.video.getVideoPlaybackQuality && (this.isVideoPlaybackQualityAvailable = !0), clearInterval(this.timer), this.timer = setInterval(this.checkFPSInterval.bind(this), this.hls.config.fpsDroppedMonitoringPeriod))
}
}, {
key: "checkFPS",
value: function(d, r, i) {
var n = performance.now();
if (r) {
if (this.lastTime) {
var l = n - this.lastTime,
a = i - this.lastDroppedFrames,
s = r - this.lastDecodedFrames,
u = 1e3 * a / l;
if (this.hls.trigger(t.default.FPS_DROP, {
currentDropped: a,
currentDecoded: s,
totalDroppedFrames: i
}), u > 0 && a > this.hls.config.fpsDroppedMonitoringThreshold * s) {
var e = this.hls.currentLevel;
o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: " + e), e > 0 && (-1 === this.hls.autoLevelCapping || this.hls.autoLevelCapping >= e) && (e -= 1, this.hls.trigger(t.default.FPS_DROP_LEVEL_CAPPING, {
level: e,
droppedLevel: this.hls.currentLevel
}), this.hls.autoLevelCapping = e, this.hls.streamController.nextLevelSwitch())
}
}
this.lastTime = n, this.lastDroppedFrames = i, this.lastDecodedFrames = r
}
}
}, {
key: "checkFPSInterval",
value: function() {
if (this.video)
if (this.isVideoPlaybackQualityAvailable) {
var e = this.video.getVideoPlaybackQuality();
this.checkFPS(this.video, e.totalVideoFrames, e.droppedVideoFrames)
} else this.checkFPS(this.video, this.video.webkitDecodedFrameCount, this.video.webkitDroppedFrameCount)
}
}]), e
}(h.default);
r.default = u
}, {
25: 25,
26: 26,
43: 43
}],
10: [function(i, g, a) {
"use strict";
function n(e) {
return e && e.__esModule ? e : {
default: e
}
}
function u(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function f(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function s(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(a, "__esModule", {
value: !0
});
var c = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = i(26),
t = n(l),
d = i(25),
h = n(d),
r = i(43),
e = i(24),
o = function(a) {
function i(r) {
u(this, i);
var e = f(this, Object.getPrototypeOf(i).call(this, r, t.default.MANIFEST_LOADED, t.default.LEVEL_LOADED, t.default.ERROR));
return e.ontick = e.tick.bind(e), e._manualLevel = e._autoLevelCapping = -1, e
}
return s(i, a), c(i, [{
key: "destroy",
value: function() {
this.timer && (clearTimeout(this.timer), this.timer = null), this._manualLevel = -1
}
}, {
key: "startLoad",
value: function() {
this.canload = !0, this.timer && this.tick()
}
}, {
key: "stopLoad",
value: function() {
this.canload = !1
}
}, {
key: "onManifestLoaded",
value: function(d) {
var s, a, n = [],
i = [],
h = {},
o = !1,
l = !1,
u = this.hls;
if (d.levels.forEach(function(e) {
e.videoCodec && (o = !0), (e.audioCodec || e.attrs && e.attrs.AUDIO) && (l = !0);
var t = h[e.bitrate];
void 0 === t ? (h[e.bitrate] = n.length, e.url = [e.url], e.urlId = 0, n.push(e)) : n[t].url.push(e.url)
}), o && l ? n.forEach(function(e) {
e.videoCodec && i.push(e)
}) : i = n, i = i.filter(function(e) {
var i = function(e) {
return MediaSource.isTypeSupported("audio/mp4;codecs=" + e)
},
a = function(e) {
return MediaSource.isTypeSupported("video/mp4;codecs=" + e)
},
t = e.audioCodec,
r = e.videoCodec;
return (!t || i(t)) && (!r || a(r))
}), i.length) {
for (s = i[0].bitrate, i.sort(function(e, t) {
return e.bitrate - t.bitrate
}), this._levels = i, a = 0; a < i.length; a++)
if (i[a].bitrate === s) {
this._firstLevel = a, r.logger.log("manifest loaded," + i.length + " level(s) found, first bitrate:" + s);
break
}
u.trigger(t.default.MANIFEST_PARSED, {
levels: this._levels,
firstLevel: this._firstLevel,
stats: d.stats,
audio: l,
video: o
})
} else u.trigger(t.default.ERROR, {
type: e.ErrorTypes.MEDIA_ERROR,
details: e.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,
fatal: !0,
url: u.url,
reason: "no level with compatible codecs found in manifest"
})
}
}, {
key: "setLevelInternal",
value: function(i) {
var s = this._levels;
if (i >= 0 && i < s.length) {
this.timer && (clearTimeout(this.timer), this.timer = null), this._level = i, r.logger.log("switching to level " + i), this.hls.trigger(t.default.LEVEL_SWITCH, {
level: i
});
var a = s[i],
n = a.details;
if (!n || n.live === !0 && performance.now() - n.tload > 1e3) {
r.logger.log("(re)loading playlist for level " + i);
var o = a.urlId;
this.hls.trigger(t.default.LEVEL_LOADING, {
url: a.url[o],
level: i,
id: o
})
}
} else this.hls.trigger(t.default.ERROR, {
type: e.ErrorTypes.OTHER_ERROR,
details: e.ErrorDetails.LEVEL_SWITCH_ERROR,
level: i,
fatal: !1,
reason: "invalid level idx"
})
}
}, {
key: "onError",
value: function(n) {
if (!n.fatal) {
var a = n.details,
o = this.hls,
s = void 0,
i = void 0,
l = !1;
switch (a) {
case e.ErrorDetails.FRAG_LOAD_ERROR:
case e.ErrorDetails.FRAG_LOAD_TIMEOUT:
case e.ErrorDetails.FRAG_LOOP_LOADING_ERROR:
case e.ErrorDetails.KEY_LOAD_ERROR:
case e.ErrorDetails.KEY_LOAD_TIMEOUT:
s = n.frag.level;
break;
case e.ErrorDetails.LEVEL_LOAD_ERROR:
case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:
s = n.context.level, l = !0
}
if (void 0 !== s)
if (i = this._levels[s], i.urlId < i.url.length - 1) i.urlId++, i.details = void 0, r.logger.warn("level controller," + a + " for level " + s + ": switching to redundant stream id " + i.urlId);
else {
var u = -1 === this._manualLevel && s;
u ? (r.logger.warn("level controller," + a + ": emergency switch-down for next fragment"), o.abrController.nextAutoLevel = 0) : i && i.details && i.details.live ? (r.logger.warn("level controller," + a + " on live stream, discard"), l && (this._level = void 0)) : a !== e.ErrorDetails.FRAG_LOAD_ERROR && a !== e.ErrorDetails.FRAG_LOAD_TIMEOUT && (r.logger.error("cannot recover " + a + " error"), this._level = void 0, this.timer && (clearTimeout(this.timer), this.timer = null), n.fatal = !0, o.trigger(t.default.ERROR, n))
}
}
}
}, {
key: "onLevelLoaded",
value: function(i) {
if (i.level === this._level) {
var t = i.details;
if (t.live) {
var e = 1e3 * (t.averagetargetduration ? t.averagetargetduration : t.targetduration),
n = this._levels[i.level],
a = n.details;
a && t.endSN === a.endSN && (e /= 2, r.logger.log("same live playlist, reload twice faster")), e -= performance.now() - i.stats.trequest, e = Math.max(1e3, Math.round(e)), r.logger.log("live playlist, reload in " + e + " ms"), this.timer = setTimeout(this.ontick, e)
} else this.timer = null
}
}
}, {
key: "tick",
value: function() {
var e = this._level;
if (void 0 !== e && this.canload) {
var r = this._levels[e],
i = r.urlId;
this.hls.trigger(t.default.LEVEL_LOADING, {
url: r.url[i],
level: e,
id: i
})
}
}
}, {
key: "levels",
get: function() {
return this._levels
}
}, {
key: "level",
get: function() {
return this._level
},
set: function(e) {
var t = this._levels;
t && t.length > e && (this._level === e && void 0 !== t[e].details || this.setLevelInternal(e))
}
}, {
key: "manualLevel",
get: function() {
return this._manualLevel
},
set: function(e) {
this._manualLevel = e, void 0 === this._startLevel && (this._startLevel = e), -1 !== e && (this.level = e)
}
}, {
key: "firstLevel",
get: function() {
return this._firstLevel
},
set: function(e) {
this._firstLevel = e
}
}, {
key: "startLevel",
get: function() {
return void 0 === this._startLevel ? this._firstLevel : this._startLevel
},
set: function(e) {
this._startLevel = e
}
}, {
key: "nextLoadLevel",
get: function() {
return -1 !== this._manualLevel ? this._manualLevel : this.hls.abrController.nextAutoLevel
},
set: function(e) {
this.level = e, -1 === this._manualLevel && (this.hls.abrController.nextAutoLevel = e)
}
}]), i
}(h.default);
a.default = o
}, {
24: 24,
25: 25,
26: 26,
43: 43
}],
11: [function(a, A, d) {
"use strict";
function n(e) {
return e && e.__esModule ? e : {
default: e
}
}
function c(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function k(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function R(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(d, "__esModule", {
value: !0
});
var E = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
y = a(39),
v = n(y),
f = a(28),
s = n(f),
m = a(20),
u = n(m),
g = a(26),
r = n(g),
p = a(25),
l = n(p),
h = a(29),
o = n(h),
b = a(45),
_ = n(b),
i = a(24),
t = a(43),
e = {
STOPPED: "STOPPED",
STARTING: "STARTING",
IDLE: "IDLE",
PAUSED: "PAUSED",
KEY_LOADING: "KEY_LOADING",
FRAG_LOADING: "FRAG_LOADING",
FRAG_LOADING_WAITING_RETRY: "FRAG_LOADING_WAITING_RETRY",
WAITING_LEVEL: "WAITING_LEVEL",
PARSING: "PARSING",
PARSED: "PARSED",
ENDED: "ENDED",
ERROR: "ERROR"
},
T = function(n) {
function a(t) {
c(this, a);
var e = k(this, Object.getPrototypeOf(a).call(this, t, r.default.MEDIA_ATTACHED, r.default.MEDIA_DETACHING, r.default.MANIFEST_LOADING, r.default.MANIFEST_PARSED, r.default.LEVEL_LOADED, r.default.KEY_LOADED, r.default.FRAG_LOADED, r.default.FRAG_LOAD_EMERGENCY_ABORTED, r.default.FRAG_PARSING_INIT_SEGMENT, r.default.FRAG_PARSING_DATA, r.default.FRAG_PARSED, r.default.ERROR, r.default.AUDIO_TRACK_SWITCH, r.default.BUFFER_CREATED, r.default.BUFFER_APPENDED, r.default.BUFFER_FLUSHED));
return e.config = t.config, e.audioCodecSwap = !1, e.ticks = 0, e.ontick = e.tick.bind(e), e
}
return R(a, n), E(a, [{
key: "destroy",
value: function() {
this.stopLoad(), this.timer && (clearInterval(this.timer), this.timer = null), l.default.prototype.destroy.call(this), this.state = e.STOPPED
}
}, {
key: "startLoad",
value: function(a) {
if (this.levels) {
var r = this.media,
i = this.lastCurrentTime;
this.stopLoad(), this.demuxer = new u.default(this.hls, "main"), this.timer || (this.timer = setInterval(this.ontick, 100)), this.level = -1, this.fragLoadError = 0, r && i > 0 ? (t.logger.log("configure startPosition @" + i), this.lastPaused || (t.logger.log("resuming video"), r.play()), this.state = e.IDLE) : (this.lastCurrentTime = this.startPosition ? this.startPosition : a, this.state = e.STARTING), this.nextLoadPosition = this.startPosition = this.lastCurrentTime, this.tick()
} else t.logger.warn("cannot start loading as manifest not parsed yet"), this.state = e.STOPPED
}
}, {
key: "stopLoad",
value: function() {
var t = this.fragCurrent;
t && (t.loader && t.loader.abort(), this.fragCurrent = null), this.fragPrevious = null, this.demuxer && (this.demuxer.destroy(), this.demuxer = null), this.state = e.STOPPED
}
}, {
key: "tick",
value: function() {
this.ticks++, 1 === this.ticks && (this.doTick(), this.ticks > 1 && setTimeout(this.tick, 1), this.ticks = 0)
}
}, {
key: "doTick",
value: function() {
switch (this.state) {
case e.STARTING:
var i = this.hls,
r = i.startLevel; - 1 === r && (r = 0, this.fragBitrateTest = !0), this.level = i.nextLoadLevel = r, this.state = e.WAITING_LEVEL, this.loadedmetadata = !1;
break;
case e.IDLE:
if (!this._doTickIdle()) return;
break;
case e.WAITING_LEVEL:
var a = this.levels[this.level];
a && a.details && (this.state = e.IDLE);
break;
case e.FRAG_LOADING_WAITING_RETRY:
var s = performance.now(),
n = this.retryDate;
(!n || s >= n || this.media && this.media.seeking) && (t.logger.log("mediaController: retryDate reached, switch back to IDLE state"), this.state = e.IDLE);
break;
case e.ERROR:
case e.PAUSED:
case e.STOPPED:
case e.FRAG_LOADING:
case e.PARSING:
case e.PARSED:
case e.ENDED:
}
this._checkBuffer(), this._checkFragmentChanged()
}
}, {
key: "_doTickIdle",
value: function() {
var f = this.hls,
n = f.config,
o = this.media;
if (!o && (this.startFragRequested || !n.startFragPrefetch)) return !0;
var u = void 0;
u = this.loadedmetadata ? o.currentTime : this.nextLoadPosition;
var a = f.nextLoadLevel,
i = void 0;
this.levels[a].hasOwnProperty("bitrate") ? (i = Math.max(8 * n.maxBufferSize / this.levels[a].bitrate, n.maxBufferLength), i = Math.min(i, n.maxMaxBufferLength)) : i = n.maxBufferLength;
var d = s.default.bufferInfo(this.mediaBuffer ? this.mediaBuffer : o, u, n.maxBufferHole),
c = d.len;
if (c >= i) return !0;
t.logger.trace("buffer length of " + c.toFixed(3) + " is below max of " + i.toFixed(3) + ". checking for more payload ..."), f.nextLoadLevel = a, this.level = a;
var l = this.levels[a].details;
if ("undefined" == typeof l || l.live && this.levelLastLoaded !== a) return this.state = e.WAITING_LEVEL, !0;
var h = this.fragPrevious;
if (!l.live && h && h.sn === l.endSN && (!o.seeking || o.duration - d.end <= h.duration / 2)) {
var g = {};
return this.altAudio && (g.type = "video"), this.hls.trigger(r.default.BUFFER_EOS, g), this.state = e.ENDED, !0
}
return this._fetchPayloadOrEos({
pos: u,
bufferInfo: d,
levelDetails: l
})
}
}, {
key: "_fetchPayloadOrEos",
value: function(s) {
var h = s.pos,
u = s.bufferInfo,
r = s.levelDetails,
o = this.fragPrevious,
d = this.level,
e = r.fragments,
i = e.length,
n = e[0].start,
l = e[i - 1].start + e[i - 1].duration,
a = u.end,
t = void 0;
if (r.live) {
if (t = this._ensureFragmentAtLivePoint({
levelDetails: r,
bufferEnd: a,
start: n,
end: l,
fragPrevious: o,
fragments: e,
fragLen: i
}), null === t) return !1
} else n > a && (t = e[0]);
return t || (t = this._findFragment({
start: n,
fragPrevious: o,
fragLen: i,
fragments: e,
bufferEnd: a,
end: l,
levelDetails: r
})), t ? this._loadFragmentOrKey({
frag: t,
level: d,
levelDetails: r,
pos: h,
bufferEnd: a
}) : !0
}
}, {
key: "_ensureFragmentAtLivePoint",
value: function(e) {
var r = e.levelDetails,
a = e.bufferEnd,
f = e.start,
h = e.end,
d = e.fragPrevious,
u = e.fragments,
c = e.fragLen,
o = this.hls.config,
i = void 0,
g = void 0 !== o.liveMaxLatencyDuration ? o.liveMaxLatencyDuration : o.liveMaxLatencyDurationCount * r.targetduration;
if (a < Math.max(f, h - g)) {
var s = this.liveSyncPosition = this.computeLivePosition(f, r);
t.logger.log("buffer end: " + a + " is located too far from the end of live sliding playlist, reset currentTime to : " + s.toFixed(3)), a = s;
var n = this.media;
n && n.readyState && n.duration > s && (n.currentTime = s)
}
if (r.PTSKnown && a > h) return null;
if (this.startFragRequested && !r.PTSKnown) {
if (d) {
var l = d.sn + 1;
l >= r.startSN && l <= r.endSN && (i = u[l - r.startSN], t.logger.log("live playlist, switching playlist, load frag with next SN: " + i.sn))
}
i || (i = u[Math.min(c - 1, Math.round(c / 2))], t.logger.log("live playlist, switching playlist, unknown, load middle frag : " + i.sn))
}
return i
}
}, {
key: "_findFragment",
value: function(r) {
var c = r.start,
i = r.fragPrevious,
g = r.fragLen,
s = r.fragments,
o = r.bufferEnd,
d = r.end,
f = r.levelDetails,
u = this.hls.config,
e = void 0,
a = void 0,
n = u.maxFragLookUpTolerance;
if (d > o ? (o > d - n && (n = 0), a = v.default.search(s, function(e) {
return e.start + e.duration - n <= o ? 1 : e.start - n > o && e.start ? -1 : 0
})) : a = s[g - 1], a && (e = a, c = a.start, i && e.level === i.level && e.sn === i.sn))
if (e.sn < f.endSN) {
var h = i.deltaPTS,
l = e.sn - f.startSN;
h && h > u.maxBufferHole && i.dropped && l ? (e = s[l - 1], t.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"), i.loadCounter--) : (e = s[l + 1], t.logger.log("SN just loaded, load next one: " + e.sn))
} else e = null;
return e
}
}, {
key: "_loadFragmentOrKey",
value: function(n) {
var a = n.frag,
l = n.level,
o = n.levelDetails,
d = n.pos,
h = n.bufferEnd,
s = this.hls,
f = s.config;
if (null == a.decryptdata.uri || null != a.decryptdata.key) {
if (t.logger.log("Loading " + a.sn + " of [" + o.startSN + " ," + o.endSN + "],level " + l + ", currentTime:" + d + ",bufferEnd:" + h.toFixed(3)), void 0 !== this.fragLoadIdx ? this.fragLoadIdx++ : this.fragLoadIdx = 0, a.loadCounter) {
a.loadCounter++;
var u = f.fragLoadingLoopThreshold;
if (a.loadCounter > u && Math.abs(this.fragLoadIdx - a.loadIdx) < u) return s.trigger(r.default.ERROR, {
type: i.ErrorTypes.MEDIA_ERROR,
details: i.ErrorDetails.FRAG_LOOP_LOADING_ERROR,
fatal: !1,
frag: a
}), !1
} else a.loadCounter = 1;
return a.loadIdx = this.fragLoadIdx, a.autoLevel = s.autoLevelEnabled, this.fragCurrent = a, this.startFragRequested = !0, s.trigger(r.default.FRAG_LOADING, {
frag: a
}), this.state = e.FRAG_LOADING, !0
}
t.logger.log("Loading key for " + a.sn + " of [" + o.startSN + " ," + o.endSN + "],level " + l), this.state = e.KEY_LOADING, s.trigger(r.default.KEY_LOADING, {
frag: a
})
}
}, {
key: "getBufferRange",
value: function(i) {
var e, t, r = this.bufferRange;
if (r)
for (e = r.length - 1; e >= 0; e--)
if (t = r[e], i >= t.start && i <= t.end) return t;
return null
}
}, {
key: "followingBufferRange",
value: function(e) {
return e ? this.getBufferRange(e.end + .5) : null
}
}, {
key: "isBuffered",
value: function(r) {
var i = this.media;
if (i)
for (var t = i.buffered, e = 0; e < t.length; e++)
if (r >= t.start(e) && r <= t.end(e)) return !0;
return !1
}
}, {
key: "_checkFragmentChanged",
value: function() {
var t, e, i = this.media;
if (i && i.seeking === !1 && (e = i.currentTime, e > i.playbackRate * this.lastCurrentTime && (this.lastCurrentTime = e), this.isBuffered(e) ? t = this.getBufferRange(e) : this.isBuffered(e + .1) && (t = this.getBufferRange(e + .1)), t)) {
var a = t.frag;
a !== this.fragPlaying && (this.fragPlaying = a, this.hls.trigger(r.default.FRAG_CHANGED, {
frag: a
}))
}
}
}, {
key: "immediateLevelSwitch",
value: function() {
if (t.logger.log("immediateLevelSwitch"), !this.immediateSwitch) {
this.immediateSwitch = !0;
var i = this.media,
a = void 0;
i ? (a = i.paused, i.pause()) : a = !0, this.previouslyPaused = a
}
var n = this.fragCurrent;
n && n.loader && n.loader.abort(), this.fragCurrent = null, this.state = e.PAUSED, this.hls.trigger(r.default.BUFFER_FLUSHING, {
startOffset: 0,
endOffset: Number.POSITIVE_INFINITY
})
}
}, {
key: "immediateLevelSwitchEnd",
value: function() {
var e = this.media;
e && e.buffered.length && (this.immediateSwitch = !1, this.isBuffered(e.currentTime) && (e.currentTime -= 1e-4), this.previouslyPaused || e.play())
}
}, {
key: "nextLevelSwitch",
value: function() {
var t = this.media;
if (t && t.readyState) {
var n = void 0,
a = void 0,
i = void 0;
if (this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold, a = this.getBufferRange(t.currentTime), a && a.start > 1 && (this.state = e.PAUSED, this.hls.trigger(r.default.BUFFER_FLUSHING, {
startOffset: 0,
endOffset: a.start - 1
})), t.paused) n = 0;
else {
var l = this.hls.nextLoadLevel,
u = this.levels[l],
o = this.fragLastKbps;
n = o && this.fragCurrent ? this.fragCurrent.duration * u.bitrate / (1e3 * o) + 1 : 0
}
if (i = this.getBufferRange(t.currentTime + n), i && (i = this.followingBufferRange(i))) {
var s = this.fragCurrent;
s && s.loader && s.loader.abort(), this.fragCurrent = null, this.state = e.PAUSED, this.hls.trigger(r.default.BUFFER_FLUSHING, {
startOffset: i.start,
endOffset: Number.POSITIVE_INFINITY
})
}
}
}
}, {
key: "onMediaAttached",
value: function(r) {
var e = this.media = this.mediaBuffer = r.media;
this.onvseeking = this.onMediaSeeking.bind(this), this.onvseeked = this.onMediaSeeked.bind(this), this.onvended = this.onMediaEnded.bind(this), e.addEventListener("seeking", this.onvseeking), e.addEventListener("seeked", this.onvseeked), e.addEventListener("ended", this.onvended);
var t = this.config;
this.levels && t.autoStartLoad && this.hls.startLoad(t.startPosition)
}
}, {
key: "onMediaDetaching",
value: function() {
var e = this.media;
e && e.ended && (t.logger.log("MSE detaching and video ended, reset startPosition"), this.startPosition = this.lastCurrentTime = 0);
var r = this.levels;
r && r.forEach(function(e) {
e.details && e.details.fragments.forEach(function(e) {
e.loadCounter = void 0
})
}), e && (e.removeEventListener("seeking", this.onvseeking), e.removeEventListener("seeked", this.onvseeked), e.removeEventListener("ended", this.onvended), this.onvseeking = this.onvseeked = this.onvended = null), this.media = null, this.loadedmetadata = !1, this.stopLoad()
}
}, {
key: "onMediaSeeking",
value: function() {
var a = this.media,
i = a ? a.currentTime : void 0;
if (t.logger.log("media seeking to " + i), this.state === e.FRAG_LOADING) {
var o = s.default.bufferInfo(a, i, this.config.maxBufferHole),
r = this.fragCurrent;
if (0 === o.len && r) {
var n = this.config.maxFragLookUpTolerance,
l = r.start - n,
u = r.start + r.duration + n;
l > i || i > u ? (r.loader && (t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"), r.loader.abort()), this.fragCurrent = null, this.fragPrevious = null, this.state = e.IDLE) : t.logger.log("seeking outside of buffer but within currently loaded fragment range")
}
} else this.state === e.ENDED && (this.state = e.IDLE);
a && (this.lastCurrentTime = i), this.state !== e.FRAG_LOADING && void 0 !== this.fragLoadIdx && (this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold), this.tick()
}
}, {
key: "onMediaSeeked",
value: function() {
t.logger.log("media seeked to " + this.media.currentTime), this.tick()
}
}, {
key: "onMediaEnded",
value: function() {
t.logger.log("media ended"), this.startPosition = this.lastCurrentTime = 0
}
}, {
key: "onManifestLoading",
value: function() {
t.logger.log("trigger BUFFER_RESET"), this.hls.trigger(r.default.BUFFER_RESET), this.bufferRange = [], this.stalled = !1, this.startPosition = this.lastCurrentTime = 0
}
}, {
key: "onManifestParsed",
value: function(r) {
var e, i = !1,
a = !1;
r.levels.forEach(function(t) {
e = t.audioCodec, e && (-1 !== e.indexOf("mp4a.40.2") && (i = !0), -1 !== e.indexOf("mp4a.40.5") && (a = !0))
}), this.audioCodecSwitch = i && a, this.audioCodecSwitch && t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"), this.levels = r.levels, this.startLevelLoaded = !1, this.startFragRequested = !1;
var n = this.config;
n.autoStartLoad && this.hls.startLoad(n.startPosition)
}
}, {
key: "onLevelLoaded",
value: function(u) {
var i = u.details,
s = u.level,
d = this.levels[s],
h = i.totalduration,
n = 0;
if (t.logger.log("level " + s + " loaded [" + i.startSN + "," + i.endSN + "],duration:" + h), this.levelLastLoaded = s, i.live) {
var l = d.details;
l && i.fragments.length > 0 ? (o.default.mergeDetails(l, i), n = i.fragments[0].start, this.liveSyncPosition = this.computeLivePosition(n, l), i.PTSKnown ? t.logger.log("live playlist sliding:" + n.toFixed(3)) : t.logger.log("live playlist - outdated PTS, unknown sliding")) : (i.PTSKnown = !1, t.logger.log("live playlist - first load, unknown sliding"))
} else i.PTSKnown = !1;
if (d.details = i, this.hls.trigger(r.default.LEVEL_UPDATED, {
details: i,
level: s
}), this.startFragRequested === !1) {
if (-1 === this.startPosition) {
var a = i.startTimeOffset;
isNaN(a) ? i.live ? (this.startPosition = this.computeLivePosition(n, i), t.logger.log("configure startPosition to " + this.startPosition)) : this.startPosition = 0 : (0 > a && (t.logger.log("negative start time offset " + a + ", count from end of last fragment"), a = n + h + a), t.logger.log("start time offset found in playlist, adjust startPosition to " + a), this.startPosition = a)
}
this.nextLoadPosition = this.startPosition
}
this.state === e.WAITING_LEVEL && (this.state = e.IDLE), this.tick()
}
}, {
key: "onKeyLoaded",
value: function() {
this.state === e.KEY_LOADING && (this.state = e.IDLE, this.tick())
}
}, {
key: "onFragLoaded",
value: function(a) {
var i = this.fragCurrent;
if (this.state === e.FRAG_LOADING && i && "main" === a.frag.type && a.frag.level === i.level && a.frag.sn === i.sn)
if (t.logger.log("Loaded " + i.sn + " of level " + i.level), this.fragBitrateTest === !0) this.state = e.IDLE, this.fragBitrateTest = !1, this.startFragRequested = !1, a.stats.tparsed = a.stats.tbuffered = performance.now(), this.hls.trigger(r.default.FRAG_BUFFERED, {
stats: a.stats,
frag: i,
id: "main"
});
else {
this.state = e.PARSING, this.stats = a.stats;
var s = this.levels[this.level],
o = s.details,
f = o.totalduration,
c = void 0 !== i.startDTS ? i.startDTS : i.start,
d = i.level,
h = i.sn,
n = this.config.defaultAudioCodec || s.audioCodec;
this.audioCodecSwap && (t.logger.log("swapping playlist audio codec"), void 0 === n && (n = this.lastAudioCodec), n && (n = -1 !== n.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5")), this.pendingAppending = 0, t.logger.log("Demuxing " + h + " of [" + o.startSN + " ," + o.endSN + "],level " + d + ", cc " + i.cc);
var l = this.demuxer;
l || (l = this.demuxer = new u.default(this.hls, "main")), l.push(a.payload, n, s.videoCodec, c, i.cc, d, h, f, i.decryptdata)
}
this.fragLoadError = 0
}
}, {
key: "onFragParsingInitSegment",
value: function(n) {
var u = this.fragCurrent;
if (u && "main" === n.id && n.sn === u.sn && n.level === u.level && this.state === e.PARSING) {
var l, i, a = n.tracks;
if (a.audio && this.altAudio && delete a.audio, i = a.audio) {
var s = this.levels[this.level].audioCodec,
d = navigator.userAgent.toLowerCase();
s && this.audioCodecSwap && (t.logger.log("swapping playlist audio codec"), s = -1 !== s.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), this.audioCodecSwitch && 1 !== i.metadata.channelCount && -1 === d.indexOf("firefox") && (s = "mp4a.40.5"), -1 !== d.indexOf("android") && (s = "mp4a.40.2", t.logger.log("Android: force audio codec to" + s)), i.levelCodec = s, i.id = n.id
}
if (i = a.video, i && (i.levelCodec = this.levels[this.level].videoCodec, i.id = n.id), n.unique) {
var o = {
codec: "",
levelCodec: ""
};
for (l in n.tracks) i = a[l], o.container = i.container, o.codec && (o.codec += ",", o.levelCodec += ","), i.codec && (o.codec += i.codec), i.levelCodec && (o.levelCodec += i.levelCodec);
a = {
audiovideo: o
}
}
this.hls.trigger(r.default.BUFFER_CODECS, a);
for (l in a) {
i = a[l], t.logger.log("main track:" + l + ",container:" + i.container + ",codecs[level/parsed]=[" + i.levelCodec + "/" + i.codec + "]");
var h = i.initSegment;
h && (this.pendingAppending++, this.hls.trigger(r.default.BUFFER_APPENDING, {
type: l,
data: h,
parent: "main",
content: "initSegment"
}))
}
this.tick()
}
}
}, {
key: "onFragParsingData",
value: function(i) {
var u = this,
a = this.fragCurrent;
if (a && "main" === i.id && i.sn === a.sn && i.level === a.level && ("audio" !== i.type || "AUDIO" !== this.audioTrackType) && this.state === e.PARSING) {
var s = this.levels[this.level],
n = this.fragCurrent;
t.logger.log("parsed " + i.type + ",PTS:[" + i.startPTS.toFixed(3) + "," + i.endPTS.toFixed(3) + "],DTS:[" + i.startDTS.toFixed(3) + "/" + i.endDTS.toFixed(3) + "],nb:" + i.nb + ",dropped:" + (i.dropped || 0));
var d = o.default.updateFragPTSDTS(s.details, n.sn, i.startPTS, i.endPTS, i.startDTS, i.endDTS),
l = this.hls;
l.trigger(r.default.LEVEL_PTS_UPDATED, {
details: s.details,
level: this.level,
drift: d
}), "video" === i.type && (n.dropped = i.dropped), [i.data1, i.data2].forEach(function(e) {
e && (u.pendingAppending++, l.trigger(r.default.BUFFER_APPENDING, {
type: i.type,
data: e,
parent: "main",
content: "data"
}))
}), this.nextLoadPosition = i.endPTS, this.bufferRange.push({
type: i.type,
start: i.startPTS,
end: i.endPTS,
frag: n
}), this.tick()
}
}
}, {
key: "onFragParsed",
value: function(t) {
var r = this.fragCurrent;
r && "main" === t.id && t.sn === r.sn && t.level === r.level && this.state === e.PARSING && (this.stats.tparsed = performance.now(), this.state = e.PARSED, this._checkAppendedParsed())
}
}, {
key: "onAudioTrackSwitch",
value: function(a) {
var r = !!a.url;
if (r) this.videoBuffer && this.mediaBuffer !== this.videoBuffer && (t.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"), this.mediaBuffer = this.videoBuffer);
else if (this.mediaBuffer !== this.media) {
t.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"), this.mediaBuffer = this.media;
var i = this.fragCurrent;
i.loader && (t.logger.log("switching to main audio track, cancel main fragment load"), i.loader.abort()), this.fragCurrent = null, this.fragPrevious = null, this.demuxer && (this.demuxer.destroy(), this.demuxer = null), this.state = e.IDLE
}
this.altAudio = r
}
}, {
key: "onBufferCreated",
value: function(o) {
var r = o.tracks,
i = void 0,
a = void 0,
n = !1;
for (var e in r) {
var s = r[e];
"main" === s.id ? (a = e, i = s, "video" === e && (this.videoBuffer = r[e].buffer)) : n = !0
}
n && i ? (t.logger.log("alternate track found, use " + a + ".buffered to schedule main fragment loading"), this.mediaBuffer = i.buffer) : this.mediaBuffer = this.media
}
}, {
key: "onBufferAppended",
value: function(t) {
if ("main" === t.parent) switch (this.state) {
case e.PARSING:
case e.PARSED:
this.pendingAppending--, this._checkAppendedParsed()
}
}
}, {
key: "_checkAppendedParsed",
value: function() {
if (this.state === e.PARSED && 0 === this.pendingAppending) {
var a = this.fragCurrent,
i = this.stats;
if (a) {
this.fragPrevious = a, i.tbuffered = performance.now(), this.fragLastKbps = Math.round(8 * i.total / (i.tbuffered - i.tfirst)), this.hls.trigger(r.default.FRAG_BUFFERED, {
stats: i,
frag: a,
id: "main"
});
var n = this.mediaBuffer ? this.mediaBuffer : this.media;
t.logger.log("main buffered : " + _.default.toString(n.buffered)), this.state = e.IDLE
}
this.tick()
}
}
}, {
key: "onError",
value: function(a) {
var s = a.frag;
if (!s || "main" === s.type) switch (a.details) {
case i.ErrorDetails.FRAG_LOAD_ERROR:
case i.ErrorDetails.FRAG_LOAD_TIMEOUT:
if (!a.fatal) {
var n = this.fragLoadError;
if (n ? n++ : n = 1, n <= this.config.fragLoadingMaxRetry || this.media && this.isBuffered(this.media.currentTime)) {
this.fragLoadError = n, s.loadCounter = 0;
var o = Math.min(Math.pow(2, n - 1) * this.config.fragLoadingRetryDelay, 64e3);
t.logger.warn("mediaController: frag loading failed, retry in " + o + " ms"), this.retryDate = performance.now() + o, this.state = e.FRAG_LOADING_WAITING_RETRY
} else t.logger.error("mediaController: " + a.details + " reaches max retry, redispatch as fatal ..."), a.fatal = !0, this.hls.trigger(r.default.ERROR, a), this.state = e.ERROR
}
break;
case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:
case i.ErrorDetails.LEVEL_LOAD_ERROR:
case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:
case i.ErrorDetails.KEY_LOAD_ERROR:
case i.ErrorDetails.KEY_LOAD_TIMEOUT:
this.state !== e.ERROR && (this.state = a.fatal ? e.ERROR : e.IDLE, t.logger.warn("mediaController: " + a.details + " while loading frag,switch to " + this.state + " state ..."));
break;
case i.ErrorDetails.BUFFER_FULL_ERROR:
this.state !== e.PARSING && this.state !== e.PARSED || (this.config.maxMaxBufferLength /= 2, t.logger.warn("reduce max buffer length to " + this.config.maxMaxBufferLength + "s and switch to IDLE state"), this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold, this.state = e.IDLE)
}
}
}, {
key: "_checkBuffer",
value: function() {
var e = this.media;
if (e && e.readyState) {
var n = e.currentTime,
d = e.buffered;
if (!this.loadedmetadata && d.length) {
this.loadedmetadata = !0;
var a = this.startPosition,
h = this.isBuffered(a);
n === a && h || (t.logger.log("target start position:" + a), h || (a = d.start(0), t.logger.log("target start position not buffered, seek to buffered.start(0) " + a)), t.logger.log("adjust currentTime from " + n + " to " + a), e.currentTime = a)
} else if (this.immediateSwitch) this.immediateLevelSwitchEnd();
else {
var l = s.default.bufferInfo(e, n, 0),
v = !(e.paused || e.ended || 0 === e.buffered.length),
u = .4,
f = n > e.playbackRate * this.lastCurrentTime;
if (this.stalled && f && (this.stalled = !1, t.logger.log("playback not stuck anymore @" + n)), v && l.len <= u && (f ? (u = 0, this.seekHoleNudgeDuration = 0) : this.stalled ? this.seekHoleNudgeDuration += this.config.seekHoleNudgeDuration : (this.seekHoleNudgeDuration = 0, t.logger.log("playback seems stuck @" + n), this.hls.trigger(r.default.ERROR, {
type: i.ErrorTypes.MEDIA_ERROR,
details: i.ErrorDetails.BUFFER_STALLED_ERROR,
fatal: !1
}), this.stalled = !0), l.len <= u)) {
var o = l.nextStart,
c = o - n;
if (o && c < this.config.maxSeekHole && c > 0) {
t.logger.log("adjust currentTime from " + e.currentTime + " to next buffered @ " + o + " + nudge " + this.seekHoleNudgeDuration);
var g = o + this.seekHoleNudgeDuration - e.currentTime;
e.currentTime = o + this.seekHoleNudgeDuration, this.hls.trigger(r.default.ERROR, {
type: i.ErrorTypes.MEDIA_ERROR,
details: i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,
fatal: !1,
hole: g
})
}
}
}
}
}
}, {
key: "onFragLoadEmergencyAborted",
value: function() {
this.state = e.IDLE, this.tick()
}
}, {
key: "onBufferFlushed",
value: function() {
var t, r, i = [];
for (r = 0; r < this.bufferRange.length; r++) t = this.bufferRange[r], this.isBuffered((t.start + t.end) / 2) && i.push(t);
this.bufferRange = i, this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold, this.state = e.IDLE, this.fragPrevious = null
}
}, {
key: "swapAudioCodec",
value: function() {
this.audioCodecSwap = !this.audioCodecSwap
}
}, {
key: "computeLivePosition",
value: function(t, e) {
var r = void 0 !== this.config.liveSyncDuration ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * e.targetduration;
return t + Math.max(0, e.totalduration - r)
}
}, {
key: "state",
set: function(e) {
if (this.state !== e) {
var i = this.state;
this._state = e, t.logger.log("engine state transition from " + i + " to " + e), this.hls.trigger(r.default.STREAM_STATE_TRANSITION, {
previousState: i,
nextState: e
})
}
},
get: function() {
return this._state
}
}, {
key: "currentLevel",
get: function() {
if (this.media) {
var e = this.getBufferRange(this.media.currentTime);
if (e) return e.frag.level
}
return -1
}
}, {
key: "nextBufferRange",
get: function() {
return this.media ? this.followingBufferRange(this.getBufferRange(this.media.currentTime)) : null
}
}, {
key: "nextLevel",
get: function() {
var e = this.nextBufferRange;
return e ? e.frag.level : -1
}
}, {
key: "liveSyncPosition",
get: function() {
return this._liveSyncPosition
},
set: function(e) {
this._liveSyncPosition = e
}
}]), a
}(l.default);
d.default = T
}, {
20: 20,
24: 24,
25: 25,
26: 26,
28: 28,
29: 29,
39: 39,
43: 43,
45: 45
}],
12: [function(t, g, i) {
"use strict";
function r(e) {
return e && e.__esModule ? e : {
default: e
}
}
function h(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function s(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(i, "__esModule", {
value: !0
});
var c = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = t(26),
e = r(l),
d = t(25),
a = r(d),
f = t(40),
o = r(f),
u = function(r) {
function t(a) {
h(this, t);
var i = n(this, Object.getPrototypeOf(t).call(this, a, e.default.MEDIA_ATTACHING, e.default.MEDIA_DETACHING, e.default.FRAG_PARSING_USERDATA, e.default.MANIFEST_LOADING, e.default.FRAG_LOADED, e.default.LEVEL_SWITCH));
if (i.hls = a, i.config = a.config, i.enabled = !0, i.Cues = a.config.cueHandler, i.config.enableCEA708Captions) {
var r = i,
s = {
newCue: function(e, t, i) {
r.textTrack1 || (r.textTrack1 = r.createTextTrack("captions", "Unknown CC1", "en")), r.Cues.newCue(r.textTrack1, e, t, i)
}
},
l = {
newCue: function(e, t, i) {
r.textTrack2 || (r.textTrack2 = r.createTextTrack("captions", "Unknown CC2", "es")), r.Cues.newCue(r.textTrack2, e, t, i)
}
};
i.cea608Parser = new o.default(0, s, l)
}
return i
}
return s(t, r), c(t, [{
key: "clearCurrentCues",
value: function(e) {
if (e && e.cues)
for (; e.cues.length > 0;) e.removeCue(e.cues[0])
}
}, {
key: "createTextTrack",
value: function(e, t, r) {
return this.media ? this.media.addTextTrack(e, t, r) : void 0
}
}, {
key: "destroy",
value: function() {
a.default.prototype.destroy.call(this)
}
}, {
key: "onMediaAttaching",
value: function(e) {
this.media = e.media
}
}, {
key: "onMediaDetaching",
value: function() {}
}, {
key: "onManifestLoading",
value: function() {
this.lastPts = Number.NEGATIVE_INFINITY
}
}, {
key: "onLevelSwitch",
value: function() {
"NONE" === this.hls.currentLevel.closedCaptions ? this.enabled = !1 : this.enabled = !0
}
}, {
key: "onFragLoaded",
value: function(e) {
if ("main" === e.frag.type) {
var t = e.frag.start;
t <= this.lastPts && (this.clearCurrentCues(this.textTrack1), this.clearCurrentCues(this.textTrack2)), this.lastPts = t
}
}
}, {
key: "onFragParsingUserdata",
value: function(t) {
if (this.enabled)
for (var e = 0; e < t.samples.length; e++) {
var r = this.extractCea608Data(t.samples[e].bytes);
this.cea608Parser.addData(t.samples[e].pts, r)
}
}
}, {
key: "extractCea608Data",
value: function(e) {
for (var t, r, i, s, o, u = 31 & e[0], a = 2, n = [], l = 0; u > l; l++) t = e[a++], r = 127 & e[a++], i = 127 & e[a++], s = 0 !== (4 & t), o = 3 & t, 0 === r && 0 === i || s && 0 === o && (n.push(r), n.push(i));
return n
}
}]), t
}(a.default);
i.default = u
}, {
25: 25,
26: 26,
40: 40
}],
13: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e(h) {
t(this, e), this._tables = [
[
[],
[],
[],
[],
[]
],
[
[],
[],
[],
[],
[]
]
], this._precompute();
var i, s, r, o, l, n = this._tables[0][4],
u = this._tables[1],
a = h.length,
d = 1;
if (4 !== a && 6 !== a && 8 !== a) throw new Error("Invalid aes key size=" + a);
for (o = h.slice(0), l = [], this._key = [o, l], i = a; 4 * a + 28 > i; i++) r = o[i - 1], (i % a === 0 || 8 === a && i % a === 4) && (r = n[r >>> 24] << 24 ^ n[r >> 16 & 255] << 16 ^ n[r >> 8 & 255] << 8 ^ n[255 & r], i % a === 0 && (r = r << 8 ^ r >>> 24 ^ d << 24, d = d << 1 ^ 283 * (d >> 7))), o[i] = o[i - a] ^ r;
for (s = 0; i; s++, i--) r = o[3 & s ? i : i - 4], 4 >= i || 4 > s ? l[s] = r : l[s] = u[0][n[r >>> 24]] ^ u[1][n[r >> 16 & 255]] ^ u[2][n[r >> 8 & 255]] ^ u[3][n[255 & r]]
}
return r(e, [{
key: "_precompute",
value: function() {
var e, i, r, u, h, d, t, s, l, n = this._tables[0],
o = this._tables[1],
f = n[4],
g = o[4],
a = [],
c = [];
for (e = 0; 256 > e; e++) c[(a[e] = e << 1 ^ 283 * (e >> 7)) ^ e] = e;
for (i = r = 0; !f[i]; i ^= u || 1, r = c[r] || 1)
for (t = r ^ r << 1 ^ r << 2 ^ r << 3 ^ r << 4, t = t >> 8 ^ 255 & t ^ 99, f[i] = t, g[t] = i, d = a[h = a[u = a[i]]], l = 16843009 * d ^ 65537 * h ^ 257 * u ^ 16843008 * i, s = 257 * a[t] ^ 16843008 * t, e = 0; 4 > e; e++) n[e][i] = s = s << 24 ^ s >>> 8, o[e][t] = l = l << 24 ^ l >>> 8;
for (e = 0; 5 > e; e++) n[e] = n[e].slice(0), o[e] = o[e].slice(0)
}
}, {
key: "decrypt",
value: function(R, p, _, b, E, m) {
var f, v, g, n, e = this._key[1],
t = R ^ e[0],
i = b ^ e[1],
a = _ ^ e[2],
r = p ^ e[3],
y = e.length / 4 - 2,
s = 4,
o = this._tables[1],
h = o[0],
d = o[1],
u = o[2],
l = o[3],
c = o[4];
for (n = 0; y > n; n++) f = h[t >>> 24] ^ d[i >> 16 & 255] ^ u[a >> 8 & 255] ^ l[255 & r] ^ e[s], v = h[i >>> 24] ^ d[a >> 16 & 255] ^ u[r >> 8 & 255] ^ l[255 & t] ^ e[s + 1], g = h[a >>> 24] ^ d[r >> 16 & 255] ^ u[t >> 8 & 255] ^ l[255 & i] ^ e[s + 2], r = h[r >>> 24] ^ d[t >> 16 & 255] ^ u[i >> 8 & 255] ^ l[255 & a] ^ e[s + 3], s += 4, t = f, i = v, a = g;
for (n = 0; 4 > n; n++) E[(3 & -n) + m] = c[t >>> 24] << 24 ^ c[i >> 16 & 255] << 16 ^ c[a >> 8 & 255] << 8 ^ c[255 & r] ^ e[s++], f = t, t = i, i = a, a = r, r = f
}
}]), e
}();
e.default = i
}, {}],
14: [function(t, l, e) {
"use strict";
function r(e) {
return e && e.__esModule ? e : {
default: e
}
}
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var a = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
n = t(13),
s = r(n),
o = function() {
function e(t, r) {
i(this, e), this.key = t, this.iv = r
}
return a(e, [{
key: "ntoh",
value: function(e) {
return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
}
}, {
key: "doDecrypt",
value: function(i, v, a) {
var u, f, o, h, l, c, d, n, e, r = new Int32Array(i.buffer, i.byteOffset, i.byteLength >> 2),
p = new s.default(Array.prototype.slice.call(v)),
g = new Uint8Array(i.byteLength),
t = new Int32Array(g.buffer);
for (u = ~~a[0], f = ~~a[1], o = ~~a[2], h = ~~a[3], e = 0; e < r.length; e += 4) l = ~~this.ntoh(r[e]), c = ~~this.ntoh(r[e + 1]), d = ~~this.ntoh(r[e + 2]), n = ~~this.ntoh(r[e + 3]), p.decrypt(l, c, d, n, t, e), t[e] = this.ntoh(t[e] ^ u), t[e + 1] = this.ntoh(t[e + 1] ^ f), t[e + 2] = this.ntoh(t[e + 2] ^ o), t[e + 3] = this.ntoh(t[e + 3] ^ h), u = l, f = c, o = d, h = n;
return g
}
}, {
key: "localDecrypt",
value: function(e, t, r, i) {
var a = this.doDecrypt(e, t, r);
i.set(a, e.byteOffset)
}
}, {
key: "decrypt",
value: function(n) {
var r = 32e3,
t = new Int32Array(n),
i = new Uint8Array(n.byteLength),
e = 0,
s = this.key,
a = this.iv;
for (this.localDecrypt(t.subarray(e, e + r), s, a, i), e = r; e < t.length; e += r) a = new Uint32Array([this.ntoh(t[e - 4]), this.ntoh(t[e - 3]), this.ntoh(t[e - 2]), this.ntoh(t[e - 1])]), this.localDecrypt(t.subarray(e, e + r), s, a, i);
return i
}
}]), e
}();
e.default = o
}, {
13: 13
}],
15: [function(t, d, r) {
"use strict";
function l(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(r, "__esModule", {
value: !0
});
var u = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
s = t(14),
o = l(s),
i = t(24),
e = t(43),
n = function() {
function t(r) {
a(this, t), this.hls = r;
try {
var e = window ? window.crypto : crypto;
this.subtle = e.subtle || e.webkitSubtle, this.disableWebCrypto = !this.subtle
} catch (e) {
this.disableWebCrypto = !0
}
}
return u(t, [{
key: "destroy",
value: function() {}
}, {
key: "decrypt",
value: function(e, t, r, i) {
this.disableWebCrypto && this.hls.config.enableSoftwareAES ? this.decryptBySoftware(e, t, r, i) : this.decryptByWebCrypto(e, t, r, i)
}
}, {
key: "decryptByWebCrypto",
value: function(t, r, i, a) {
var n = this;
e.logger.log("decrypting by WebCrypto API"), this.subtle.importKey("raw", r, {
name: "AES-CBC",
length: 128
}, !1, ["decrypt"]).then(function(e) {
n.subtle.decrypt({
name: "AES-CBC",
iv: i.buffer
}, e, t).then(a).catch(function(e) {
n.onWebCryptoError(e, t, r, i, a)
})
}).catch(function(e) {
n.onWebCryptoError(e, t, r, i, a)
})
}
}, {
key: "decryptBySoftware",
value: function(r, i, a, n) {
e.logger.log("decrypting by JavaScript Implementation");
var t = new DataView(i.buffer),
s = new Uint32Array([t.getUint32(0), t.getUint32(4), t.getUint32(8), t.getUint32(12)]);
t = new DataView(a.buffer);
var l = new Uint32Array([t.getUint32(0), t.getUint32(4), t.getUint32(8), t.getUint32(12)]),
u = new o.default(s, l);
n(u.decrypt(r).buffer)
}
}, {
key: "onWebCryptoError",
value: function(t, r, a, n, s) {
this.hls.config.enableSoftwareAES ? (e.logger.log("disabling to use WebCrypto API"), this.disableWebCrypto = !0, this.decryptBySoftware(r, a, n, s)) : (e.logger.error("decrypting error : " + t.message), this.hls.trigger(Event.ERROR, {
type: i.ErrorTypes.MEDIA_ERROR,
details: i.ErrorDetails.FRAG_DECRYPT_ERROR,
fatal: !0,
reason: t.message
}))
}
}]), t
}();
r.default = n
}, {
14: 14,
24: 24,
43: 43
}],
16: [function(e, h, r) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function l(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(r, "__esModule", {
value: !0
});
var n = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
d = e(17),
o = i(d),
t = e(43),
u = e(22),
a = i(u),
s = function() {
function e(t, r, a, i) {
l(this, e), this.observer = t, this.id = r, this.remuxerClass = a, this.config = i, this.remuxer = new this.remuxerClass(t, r, i), this.insertDiscontinuity()
}
return n(e, [{
key: "insertDiscontinuity",
value: function() {
this._aacTrack = {
container: "audio/adts",
type: "audio",
id: -1,
sequenceNumber: 0,
samples: [],
len: 0
}
}
}, {
key: "push",
value: function(r, b, k, _, E, d, g, R) {
var i, n, s, m, c, e, l, v, u, y, f = new a.default(r),
h = 90 * f.timeStamp,
p = !1;
for (E !== this.lastCC ? (t.logger.log(this.id + " discontinuity detected"), this.lastCC = E, this.insertDiscontinuity(), this.remuxer.switchLevel(), this.remuxer.insertDiscontinuity()) : d !== this.lastLevel ? (t.logger.log("audio track switch detected"), this.lastLevel = d, this.remuxer.switchLevel(), this.insertDiscontinuity()) : g === this.lastSN + 1 && (p = !0), i = this._aacTrack, this.lastSN = g, this.lastLevel = d, e = f.length, u = r.length; u - 1 > e && (255 !== r[e] || 240 !== (240 & r[e + 1])); e++);
for (i.audiosamplerate || (n = o.default.getAudioConfig(this.observer, r, e, b), i.config = n.config, i.audiosamplerate = n.samplerate, i.channelCount = n.channelCount, i.codec = n.codec, i.duration = R, t.logger.log("parsed codec:" + i.codec + ",rate:" + n.samplerate + ",nb channel:" + n.channelCount)), c = 0, m = 9216e4 / i.audiosamplerate; u > e + 5 && (l = 1 & r[e + 1] ? 7 : 9, s = (3 & r[e + 3]) << 11 | r[e + 4] << 3 | (224 & r[e + 5]) >>> 5, s -= l, s > 0 && u >= e + l + s);)
for (v = h + c * m, y = {
unit: r.subarray(e + l, e + l + s),
pts: v,
dts: v
}, i.samples.push(y), i.len += s, e += s + l, c++; u - 1 > e && (255 !== r[e] || 240 !== (240 & r[e + 1])); e++);
this.remuxer.remux(d, g, this._aacTrack, {
samples: []
}, {
samples: [{
pts: h,
dts: h,
unit: f.payload
}]
}, {
samples: []
}, _, p)
}
}, {
key: "destroy",
value: function() {}
}], [{
key: "probe",
value: function(t) {
var e, r, i = new a.default(t);
if (i.hasTimeStamp)
for (e = i.length, r = t.length; r - 1 > e; e++)
if (255 === t[e] && 240 === (240 & t[e + 1])) return !0;
return !1
}
}]), e
}();
r.default = s
}, {
17: 17,
22: 22,
43: 43
}],
17: [function(e, o, t) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
n = e(43),
r = e(24),
s = function() {
function e() {
i(this, e)
}
return a(e, null, [{
key: "getAudioConfig",
value: function(f, u, l, a) {
var i, e, s, o, t, h = navigator.userAgent.toLowerCase(),
d = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
return i = ((192 & u[l + 2]) >>> 6) + 1, e = (60 & u[l + 2]) >>> 2, e > d.length - 1 ? void f.trigger(Event.ERROR, {
type: r.ErrorTypes.MEDIA_ERROR,
details: r.ErrorDetails.FRAG_PARSING_ERROR,
fatal: !0,
reason: "invalid ADTS sampling index:" + e
}) : (o = (1 & u[l + 2]) << 2, o |= (192 & u[l + 3]) >>> 6, n.logger.log("manifest codec:" + a + ",ADTS data:type:" + i + ",sampleingIndex:" + e + "[" + d[e] + "Hz],channelConfig:" + o), -1 !== h.indexOf("firefox") ? e >= 6 ? (i = 5, t = new Array(4), s = e - 3) : (i = 2, t = new Array(2), s = e) : -1 !== h.indexOf("android") ? (i = 2, t = new Array(2), s = e) : (i = 5, t = new Array(4), a && (-1 !== a.indexOf("mp4a.40.29") || -1 !== a.indexOf("mp4a.40.5")) || !a && e >= 6 ? s = e - 3 : ((a && -1 !== a.indexOf("mp4a.40.2") && e >= 6 && 1 === o || !a && 1 === o) && (i = 2, t = new Array(2)), s = e)), t[0] = i << 3, t[0] |= (14 & e) >> 1, t[1] |= (1 & e) << 7, t[1] |= o << 3, 5 === i && (t[1] |= (14 & s) >> 1, t[2] = (1 & s) << 7, t[2] |= 8, t[3] = 0), {
config: t,
samplerate: d[e],
channelCount: o,
codec: "mp4a.40." + i
})
}
}]), e
}();
t.default = s
}, {
24: 24,
43: 43
}],
18: [function(e, y, i) {
"use strict";
function t(e) {
return e && e.__esModule ? e : {
default: e
}
}
function d(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(i, "__esModule", {
value: !0
});
var f = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
g = e(26),
o = t(g),
a = e(24),
p = e(16),
n = t(p),
h = e(23),
r = t(h),
c = e(36),
s = t(c),
v = e(37),
u = t(v),
l = function() {
function e(t, r, i) {
var a = arguments.length <= 3 || void 0 === arguments[3] ? null : arguments[3];
d(this, e), this.hls = t, this.id = r, this.config = this.hls.config || a, this.typeSupported = i
}
return f(e, [{
key: "destroy",
value: function() {
var e = this.demuxer;
e && e.destroy()
}
}, {
key: "push",
value: function(l, h, v, g, d, p, f, c) {
var e = this.demuxer;
if (!e) {
var i = this.hls,
t = this.id;
if (r.default.probe(l)) e = this.typeSupported.mp2t === !0 ? new r.default(i, t, u.default, this.config) : new r.default(i, t, s.default, this.config);
else {
if (!n.default.probe(l)) return void i.trigger(o.default.ERROR, {
type: a.ErrorTypes.MEDIA_ERROR,
id: t,
details: a.ErrorDetails.FRAG_PARSING_ERROR,
fatal: !0,
reason: "no demux matching with content found"
});
e = new n.default(i, t, s.default, this.config)
}
this.demuxer = e
}
e.push(l, h, v, g, d, p, f, c)
}
}]), e
}();
i.default = l
}, {
16: 16,
23: 23,
24: 24,
26: 26,
36: 36,
37: 37
}],
19: [function(t, d, i) {
"use strict";
function r(e) {
return e && e.__esModule ? e : {
default: e
}
}
Object.defineProperty(i, "__esModule", {
value: !0
});
var a = t(18),
u = r(a),
s = t(26),
e = r(s),
l = t(1),
n = r(l),
o = function(r) {
var t = new n.default;
t.trigger = function(i) {
for (var r = arguments.length, a = Array(r > 1 ? r - 1 : 0), e = 1; r > e; e++) a[e - 1] = arguments[e];
t.emit.apply(t, [i, i].concat(a))
}, t.off = function(a) {
for (var r = arguments.length, i = Array(r > 1 ? r - 1 : 0), e = 1; r > e; e++) i[e - 1] = arguments[e];
t.removeListener.apply(t, [a].concat(i))
}, r.addEventListener("message", function(i) {
var e = i.data;
switch (e.cmd) {
case "init":
r.demuxer = new u.default(t, e.id, e.typeSupported, JSON.parse(e.config));
break;
case "demux":
r.demuxer.push(new Uint8Array(e.data), e.audioCodec, e.videoCodec, e.timeOffset, e.cc, e.level, e.sn, e.duration)
}
});
var i = function(e, t) {
r.postMessage({
event: e,
data: t
})
};
t.on(e.default.FRAG_PARSING_INIT_SEGMENT, i), t.on(e.default.FRAG_PARSED, i), t.on(e.default.ERROR, i), t.on(e.default.FRAG_PARSING_METADATA, i), t.on(e.default.FRAG_PARSING_USERDATA, i), t.on(e.default.FRAG_PARSING_DATA, function(a, e) {
var t = e.data1.buffer,
i = e.data2.buffer;
delete e.data1, delete e.data2, r.postMessage({
event: a,
data: e,
data1: t,
data2: i
}, [t, i])
})
};
i.default = o
}, {
1: 1,
18: 18,
26: 26
}],
20: [function(e, p, r) {
"use strict";
function t(e) {
return e && e.__esModule ? e : {
default: e
}
}
function l(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(r, "__esModule", {
value: !0
});
var u = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
f = e(26),
i = t(f),
v = e(18),
n = t(v),
d = e(19),
h = t(d),
s = e(43),
c = e(15),
g = t(c),
a = e(24),
o = function() {
function t(r, o) {
l(this, t), this.hls = r, this.id = o;
var u = {
mp4: MediaSource.isTypeSupported("video/mp4"),
mp2t: r.config.enableMP2TPassThrough && MediaSource.isTypeSupported("video/mp2t")
};
if (r.config.enableWorker && "undefined" != typeof Worker) {
s.logger.log("demuxing in webworker");
try {
var f = e(2),
d = this.w = f(h.default);
this.onwmsg = this.onWorkerMessage.bind(this), d.addEventListener("message", this.onwmsg), d.onerror = function(e) {
r.trigger(i.default.ERROR, {
type: a.ErrorTypes.OTHER_ERROR,
details: a.ErrorDetails.INTERNAL_EXCEPTION,
fatal: !0,
event: "demuxerWorker",
err: {
message: e.message + " (" + e.filename + ":" + e.lineno + ")"
}
})
}, d.postMessage({
cmd: "init",
typeSupported: u,
id: o,
config: JSON.stringify(r.config)
})
} catch (e) {
s.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"), this.demuxer = new n.default(r, o, u)
}
} else this.demuxer = new n.default(r, o, u);
this.demuxInitialized = !0
}
return u(t, [{
key: "destroy",
value: function() {
var e = this.w;
if (e) e.removeEventListener("message", this.onwmsg), e.terminate(), this.w = null;
else {
var t = this.demuxer;
t && (t.destroy(), this.demuxer = null)
}
var r = this.decrypter;
r && (r.destroy(), this.decrypter = null)
}
}, {
key: "pushDecrypted",
value: function(e, t, r, i, a, n, s, o) {
var l = this.w;
if (l) l.postMessage({
cmd: "demux",
data: e,
audioCodec: t,
videoCodec: r,
timeOffset: i,
cc: a,
level: n,
sn: s,
duration: o
}, [e]);
else {
var u = this.demuxer;
u && u.push(new Uint8Array(e), t, r, i, a, n, s, o)
}
}
}, {
key: "push",
value: function(t, r, i, a, n, s, o, l, e) {
if (t.byteLength > 0 && null != e && null != e.key && "AES-128" === e.method) {
null == this.decrypter && (this.decrypter = new g.default(this.hls));
var u = this;
this.decrypter.decrypt(t, e.key, e.iv, function(e) {
u.pushDecrypted(e, r, i, a, n, s, o, l)
})
} else this.pushDecrypted(t, r, i, a, n, s, o, l)
}
}, {
key: "onWorkerMessage",
value: function(t) {
var e = t.data,
r = this.hls;
switch (e.event) {
case i.default.FRAG_PARSING_DATA:
e.data.data1 = new Uint8Array(e.data1), e.data.data2 = new Uint8Array(e.data2);
default:
r.trigger(e.event, e.data)
}
}
}]), t
}();
r.default = o
}, {
15: 15,
18: 18,
19: 19,
2: 2,
24: 24,
26: 26,
43: 43
}],
21: [function(t, s, e) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var i = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
a = t(43),
n = function() {
function e(t) {
r(this, e), this.data = t, this.bytesAvailable = this.data.byteLength, this.word = 0, this.bitsAvailable = 0
}
return i(e, [{
key: "loadWord",
value: function() {
var t = this.data.byteLength - this.bytesAvailable,
r = new Uint8Array(4),
e = Math.min(4, this.bytesAvailable);
if (0 === e) throw new Error("no bytes available");
r.set(this.data.subarray(t, t + e)), this.word = new DataView(r.buffer).getUint32(0), this.bitsAvailable = 8 * e, this.bytesAvailable -= e
}
}, {
key: "skipBits",
value: function(e) {
var t;
this.bitsAvailable > e ? (this.word <<= e, this.bitsAvailable -= e) : (e -= this.bitsAvailable, t = e >> 3, e -= t >> 3, this.bytesAvailable -= t, this.loadWord(), this.word <<= e, this.bitsAvailable -= e)
}
}, {
key: "readBits",
value: function(t) {
var e = Math.min(this.bitsAvailable, t),
r = this.word >>> 32 - e;
return t > 32 && a.logger.error("Cannot read more than 32 bits at a time"), this.bitsAvailable -= e, this.bitsAvailable > 0 ? this.word <<= e : this.bytesAvailable > 0 && this.loadWord(), e = t - e, e > 0 ? r << e | this.readBits(e) : r
}
}, {
key: "skipLZ",
value: function() {
var e;
for (e = 0; e < this.bitsAvailable; ++e)
if (0 !== (this.word & 2147483648 >>> e)) return this.word <<= e, this.bitsAvailable -= e, e;
return this.loadWord(), e + this.skipLZ()
}
}, {
key: "skipUEG",
value: function() {
this.skipBits(1 + this.skipLZ())
}
}, {
key: "skipEG",
value: function() {
this.skipBits(1 + this.skipLZ())
}
}, {
key: "readUEG",
value: function() {
var e = this.skipLZ();
return this.readBits(e + 1) - 1
}
}, {
key: "readEG",
value: function() {
var e = this.readUEG();
return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
}
}, {
key: "readBoolean",
value: function() {
return 1 === this.readBits(1)
}
}, {
key: "readUByte",
value: function() {
return this.readBits(8)
}
}, {
key: "readUShort",
value: function() {
return this.readBits(16)
}
}, {
key: "readUInt",
value: function() {
return this.readBits(32)
}
}, {
key: "skipScalingList",
value: function(a) {
var t, i, r = 8,
e = 8;
for (t = 0; a > t; t++) 0 !== e && (i = this.readEG(), e = (r + i + 256) % 256), r = 0 === e ? r : e
}
}, {
key: "readSPS",
value: function() {
var t, v, p, l, a, n, i, o, r, s = 0,
d = 0,
h = 0,
f = 0,
c = 1;
if (this.readUByte(), t = this.readUByte(), v = this.readBits(5), this.skipBits(3), p = this.readUByte(), this.skipUEG(), 100 === t || 110 === t || 122 === t || 244 === t || 44 === t || 83 === t || 86 === t || 118 === t || 128 === t) {
var g = this.readUEG();
if (3 === g && this.skipBits(1), this.skipUEG(), this.skipUEG(), this.skipBits(1), this.readBoolean())
for (o = 3 !== g ? 8 : 12, r = 0; o > r; r++) this.readBoolean() && (6 > r ? this.skipScalingList(16) : this.skipScalingList(64))
}
this.skipUEG();
var u = this.readUEG();
if (0 === u) this.readUEG();
else if (1 === u)
for (this.skipBits(1), this.skipEG(), this.skipEG(), l = this.readUEG(), r = 0; l > r; r++) this.skipEG();
if (this.skipUEG(), this.skipBits(1), a = this.readUEG(), n = this.readUEG(), i = this.readBits(1), 0 === i && this.skipBits(1), this.skipBits(1), this.readBoolean() && (s = this.readUEG(), d = this.readUEG(), h = this.readUEG(), f = this.readUEG()), this.readBoolean() && this.readBoolean()) {
var e = void 0,
y = this.readUByte();
switch (y) {
case 1:
e = [1, 1];
break;
case 2:
e = [12, 11];
break;
case 3:
e = [10, 11];
break;
case 4:
e = [16, 11];
break;
case 5:
e = [40, 33];
break;
case 6:
e = [24, 11];
break;
case 7:
e = [20, 11];
break;
case 8:
e = [32, 11];
break;
case 9:
e = [80, 33];
break;
case 10:
e = [18, 11];
break;
case 11:
e = [15, 11];
break;
case 12:
e = [64, 33];
break;
case 13:
e = [160, 99];
break;
case 14:
e = [4, 3];
break;
case 15:
e = [3, 2];
break;
case 16:
e = [2, 1];
break;
case 255:
e = [this.readUByte() << 8 | this.readUByte(), this.readUByte() << 8 | this.readUByte()]
}
e && (c = e[0] / e[1])
}
return {
width: Math.ceil((16 * (a + 1) - 2 * s - 2 * d) * c),
height: (2 - i) * (n + 1) * 16 - (i ? 2 : 4) * (h + f)
}
}
}, {
key: "readSliceType",
value: function() {
return this.readUByte(), this.readUEG(), this.readUEG()
}
}]), e
}();
e.default = n
}, {
43: 43
}],
22: [function(r, s, t) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
e = r(43),
n = function() {
function t(a) {
i(this, t), this._hasTimeStamp = !1;
for (var l, u, d, h, f, s, o, n, r = 0;;)
if (o = this.readUTF(a, r, 3), r += 3, "ID3" === o) r += 3, l = 127 & a[r++], u = 127 & a[r++], d = 127 & a[r++], h = 127 & a[r++], f = (l << 21) + (u << 14) + (d << 7) + h, s = r + f, this._parseID3Frames(a, r, s), r = s;
else {
if ("3DI" !== o) return r -= 3, n = r, void(n && (this.hasTimeStamp || e.logger.warn("ID3 tag found, but no timestamp"), this._length = n, this._payload = a.subarray(0, n)));
r += 7, e.logger.log("3DI footer found, end: " + r)
}
}
return a(t, [{
key: "readUTF",
value: function(i, e, a) {
var t = "",
r = e,
n = e + a;
do t += String.fromCharCode(i[r++]); while (n > r);
return t
}
}, {
key: "_parseID3Frames",
value: function(r, t, n) {
for (var a, s, o, l, i; n >= t + 8;) switch (a = this.readUTF(r, t, 4), t += 4, s = r[t++] << 24 + r[t++] << 16 + r[t++] << 8 + r[t++], l = r[t++] << 8 + r[t++], o = t, a) {
case "PRIV":
if ("com.apple.streaming.transportStreamTimestamp" === this.readUTF(r, t, 44)) {
t += 44, t += 4;
var u = 1 & r[t++];
this._hasTimeStamp = !0, i = ((r[t++] << 23) + (r[t++] << 15) + (r[t++] << 7) + r[t++]) / 45, u && (i += 47721858.84), i = Math.round(i), e.logger.trace("ID3 timestamp found: " + i), this._timeStamp = i
}
}
}
}, {
key: "hasTimeStamp",
get: function() {
return this._hasTimeStamp
}
}, {
key: "timeStamp",
get: function() {
return this._timeStamp
}
}, {
key: "length",
get: function() {
return this._length
}
}, {
key: "payload",
get: function() {
return this._payload
}
}]), t
}();
t.default = n
}, {
43: 43
}],
23: [function(t, g, a) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function u(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(a, "__esModule", {
value: !0
});
var h = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
f = t(17),
c = i(f),
l = t(26),
n = i(l),
d = t(21),
s = i(d),
e = t(43),
r = t(24),
o = function() {
function t(e, r, a, i) {
u(this, t), this.observer = e, this.id = r, this.remuxerClass = a, this.config = i, this.lastCC = 0, this.remuxer = new this.remuxerClass(e, r, i)
}
return h(t, [{
key: "switchLevel",
value: function() {
this.pmtParsed = !1, this._pmtId = -1, this._avcTrack = {
container: "video/mp2t",
type: "video",
id: -1,
sequenceNumber: 0,
samples: [],
len: 0,
nbNalu: 0,
dropped: 0
}, this._aacTrack = {
container: "video/mp2t",
type: "audio",
id: -1,
sequenceNumber: 0,
samples: [],
len: 0
}, this._id3Track = {
type: "id3",
id: -1,
sequenceNumber: 0,
samples: [],
len: 0
}, this._txtTrack = {
type: "text",
id: -1,
sequenceNumber: 0,
samples: [],
len: 0
}, this.aacOverFlow = null, this.aacLastPTS = null, this.avcNaluState = 0, this.remuxer.switchLevel()
}
}, {
key: "insertDiscontinuity",
value: function() {
this.switchLevel(), this.remuxer.insertDiscontinuity()
}
}, {
key: "push",
value: function(i, w, P, C, b, f, h, I) {
var o, l, s, t, u, T, L, a, c = i.length,
E = this.remuxer.passthrough,
g = !1;
this.audioCodec = w, this.videoCodec = P, this.timeOffset = C, this._duration = I, this.contiguous = !1, b !== this.lastCC && (e.logger.log("discontinuity detected"), this.insertDiscontinuity(), this.lastCC = b), f !== this.lastLevel ? (e.logger.log("level switch detected"), this.switchLevel(), this.lastLevel = f) : h === this.lastSN + 1 && (this.contiguous = !0), this.lastSN = h;
var R = this.pmtParsed,
v = this._avcTrack.id,
p = this._aacTrack.id,
A = this._id3Track.id,
S = this._pmtId,
O = this._parsePAT,
D = this._parsePMT,
d = this._parsePES,
m = this._parseAVCPES.bind(this),
_ = this._parseAACPES.bind(this),
k = this._parseID3PES.bind(this);
for (c -= c % 188, t = 0; c > t; t += 188)
if (71 === i[t]) {
if (u = !!(64 & i[t + 1]), T = ((31 & i[t + 1]) << 8) + i[t + 2], L = (48 & i[t + 3]) >> 4, L > 1) {
if (a = t + 5 + i[t + 4], a === t + 188) continue
} else a = t + 4;
switch (T) {
case v:
if (u) {
if (o && (m(d(o)), E && this._avcTrack.codec && (-1 === p || this._aacTrack.codec))) return void this.remux(f, h, i);
o = {
data: [],
size: 0
}
}
o && (o.data.push(i.subarray(a, t + 188)), o.size += t + 188 - a);
break;
case p:
if (u) {
if (l && (_(d(l)), E && this._aacTrack.codec && (-1 === v || this._avcTrack.codec))) return void this.remux(f, h, i);
l = {
data: [],
size: 0
}
}
l && (l.data.push(i.subarray(a, t + 188)), l.size += t + 188 - a);
break;
case A:
u && (s && k(d(s)), s = {
data: [],
size: 0
}), s && (s.data.push(i.subarray(a, t + 188)), s.size += t + 188 - a);
break;
case 0:
u && (a += i[a] + 1), S = this._pmtId = O(i, a);
break;
case S:
u && (a += i[a] + 1);
var y = D(i, a);
v = this._avcTrack.id = y.avc, p = this._aacTrack.id = y.aac, A = this._id3Track.id = y.id3, g && !R && (e.logger.log("reparse from beginning"), g = !1, t = -188), R = this.pmtParsed = !0;
break;
case 17:
case 8191:
break;
default:
g = !0
}
} else this.observer.trigger(n.default.ERROR, {
type: r.ErrorTypes.MEDIA_ERROR,
id: this.id,
details: r.ErrorDetails.FRAG_PARSING_ERROR,
fatal: !1,
reason: "TS packet did not start with 0x47"
});
o && m(d(o)), l && _(d(l)), s && k(d(s)), this.remux(f, h, null)
}
}, {
key: "remux",
value: function(e, t, r) {
this.remuxer.remux(e, t, this._aacTrack, this._avcTrack, this._id3Track, this._txtTrack, this.timeOffset, this.contiguous, r)
}
}, {
key: "destroy",
value: function() {
this.switchLevel(), this._initPTS = this._initDTS = void 0, this._duration = 0
}
}, {
key: "_parsePAT",
value: function(e, t) {
return (31 & e[t + 10]) << 8 | e[t + 11]
}
}, {
key: "_parsePMT",
value: function(r, t) {
var n, s, o, a, i = {
aac: -1,
avc: -1,
id3: -1
};
for (n = (15 & r[t + 1]) << 8 | r[t + 2], s = t + 3 + n - 4, o = (15 & r[t + 10]) << 8 | r[t + 11], t += 12 + o; s > t;) {
switch (a = (31 & r[t + 1]) << 8 | r[t + 2], r[t]) {
case 15:
-1 === i.aac && (i.aac = a);
break;
case 21:
-1 === i.id3 && (i.id3 = a);
break;
case 27:
-1 === i.avc && (i.avc = a);
break;
case 36:
e.logger.warn("HEVC stream type found, not supported for now");
break;
default:
e.logger.log("unkown stream type:" + r[t])
}
t += ((15 & r[t + 3]) << 8 | r[t + 4]) + 5
}
return i
}
}, {
key: "_parsePES",
value: function(u) {
for (var e, o, f, h, d, s, i, a, r, c = 0, t = u.data; t[0].length < 19 && t.length > 1;) {
var l = new Uint8Array(t[0].length + t[1].length);
l.set(t[0]), l.set(t[1], t[0].length), t[0] = l, t.splice(1, 1)
}
if (e = t[0], f = (e[0] << 16) + (e[1] << 8) + e[2], 1 === f) {
for (h = (e[4] << 8) + e[5], o = e[7], 192 & o && (i = 536870912 * (14 & e[9]) + 4194304 * (255 & e[10]) + 16384 * (254 & e[11]) + 128 * (255 & e[12]) + (254 & e[13]) / 2, i > 4294967295 && (i -= 8589934592), 64 & o ? (a = 536870912 * (14 & e[14]) + 4194304 * (255 & e[15]) + 16384 * (254 & e[16]) + 128 * (255 & e[17]) + (254 & e[18]) / 2, a > 4294967295 && (a -= 8589934592)) : a = i), d = e[8], r = d + 9, u.size -= r, s = new Uint8Array(u.size); t.length;) {
e = t.shift();
var n = e.byteLength;
if (r) {
if (r > n) {
r -= n;
continue
}
e = e.subarray(r), n -= r, r = 0
}
s.set(e, c), c += n
}
return {
data: s,
pts: i,
dts: a,
len: h
}
}
return null
}
}, {
key: "_parseAVCPES",
value: function(a) {
var t, m, o, i, h = this,
r = this._avcTrack,
u = r.samples,
y = this._parseAVCNALu(a.data),
d = [],
l = !1,
g = !1,
f = 0;
if (0 === y.length && u.length > 0) {
var v = u[u.length - 1],
c = v.units.units[v.units.units.length - 1],
p = new Uint8Array(c.data.byteLength + a.data.byteLength);
p.set(c.data, 0), p.set(a.data, c.data.byteLength), c.data = p, v.units.length += a.data.byteLength, r.len += a.data.byteLength
}
a.data = null;
var n = "",
E = function() {
d.length && (!this.config.forceKeyFrameOnDiscontinuity || g === !0 || r.sps && (u.length || this.contiguous) ? (m = {
units: {
units: d,
length: f
},
pts: a.pts,
dts: a.dts,
key: g
}, u.push(m), r.len += f, r.nbNalu += d.length) : r.dropped++, d = [], f = 0)
}.bind(this);
y.forEach(function(e) {
switch (e.type) {
case 1:
o = !0, l && (n += "NDR ");
break;
case 5:
o = !0, l && (n += "IDR "), g = !0;
break;
case 6:
o = !0, l && (n += "SEI "), t = new s.default(h.discardEPB(e.data)), t.readUByte();
for (var y = 0, c = 0, b = !1, u = 0; !b && t.bytesAvailable > 1;) {
y = 0;
do u = t.readUByte(), y += u; while (255 === u);
c = 0;
do u = t.readUByte(), c += u; while (255 === u);
if (4 === y && 0 !== t.bytesAvailable) {
b = !0;
var A = t.readUByte();
if (181 === A) {
var T = t.readUShort();
if (49 === T) {
var S = t.readUInt();
if (1195456820 === S) {
var O = t.readUByte();
if (3 === O) {
var m = t.readUByte(),
D = t.readUByte(),
k = 31 & m,
v = [m, D];
for (i = 0; k > i; i++) v.push(t.readUByte()), v.push(t.readUByte()), v.push(t.readUByte());
h._insertSampleInOrder(h._txtTrack.samples, {
type: 3,
pts: a.pts,
bytes: v
})
}
}
}
}
} else if (c < t.bytesAvailable)
for (i = 0; c > i; i++) t.readUByte()
}
break;
case 7:
if (o = !0, l && (n += "SPS "), !r.sps) {
t = new s.default(e.data);
var _ = t.readSPS();
r.width = _.width, r.height = _.height, r.sps = [e.data], r.duration = h._duration;
var L = e.data.subarray(1, 4),
R = "avc1.";
for (i = 0; 3 > i; i++) {
var p = L[i].toString(16);
p.length < 2 && (p = "0" + p), R += p
}
r.codec = R
}
break;
case 8:
o = !0, l && (n += "PPS "), r.pps || (r.pps = [e.data]);
break;
case 9:
o = !1, l && (n += "AUD "), E();
break;
default:
o = !1, n += "unknown NAL " + e.type + " "
}
o && (d.push(e), f += e.data.byteLength)
}), (l || n.length) && e.logger.log(n), E()
}
}, {
key: "_insertSampleInOrder",
value: function(e, t) {
var i = e.length;
if (i > 0) {
if (t.pts >= e[i - 1].pts) e.push(t);
else
for (var r = i - 1; r >= 0; r--)
if (t.pts < e[r].pts) {
e.splice(r, 0, t);
break
}
} else e.push(t)
}
}, {
key: "_parseAVCNALu",
value: function(r) {
for (var s, i, l, _, n, d, t = 0, v = r.byteLength, e = this.avcNaluState, g = []; v > t;) switch (s = r[t++], e) {
case 0:
0 === s && (e = 1);
break;
case 1:
e = 0 === s ? 2 : 0;
break;
case 2:
case 3:
if (0 === s) e = 3;
else if (1 === s && v > t) {
if (_ = 31 & r[t], n) l = {
data: r.subarray(n, t - e - 1),
type: d
}, g.push(l);
else {
var a = this.avcNaluState;
if (a && 4 - a >= t) {
var m = this._avcTrack,
c = m.samples;
if (c.length) {
var p = c[c.length - 1],
R = p.units.units,
u = R[R.length - 1];
u.state && (u.data = u.data.subarray(0, u.data.byteLength - a), p.units.length -= a, m.len -= a)
}
}
if (i = t - e - 1, i > 0) {
var y = this._avcTrack,
f = y.samples;
if (f.length) {
var E = f[f.length - 1],
b = E.units.units,
o = b[b.length - 1],
h = new Uint8Array(o.data.byteLength + i);
h.set(o.data, 0), h.set(r.subarray(0, i), o.data.byteLength), o.data = h, E.units.length += i, y.len += i
}
}
}
n = t, d = _, e = 0
} else e = 0
}
return n && (l = {
data: r.subarray(n, v),
type: d,
state: e
}, g.push(l), this.avcNaluState = e), g
}
}, {
key: "discardEPB",
value: function(t) {
for (var a, n, s = t.byteLength, r = [], e = 1; s - 2 > e;) 0 === t[e] && 0 === t[e + 1] && 3 === t[e + 2] ? (r.push(e + 2), e += 2) : e++;
if (0 === r.length) return t;
a = s - r.length, n = new Uint8Array(a);
var i = 0;
for (e = 0; a > e; i++, e++) i === r[0] && (i++, r.shift()), n[e] = t[i];
return n
}
}, {
key: "_parseAACPES",
value: function(R) {
var l, o, p, E, t, d, h, s, _, a = this._aacTrack,
i = R.data,
g = R.pts,
A = 0,
T = this._duration,
k = this.audioCodec,
u = this.aacOverFlow,
b = this.aacLastPTS;
if (u) {
var m = new Uint8Array(u.byteLength + i.byteLength);
m.set(u, 0), m.set(i, u.byteLength), i = m
}
for (t = A, s = i.length; s - 1 > t && (255 !== i[t] || 240 !== (240 & i[t + 1])); t++);
if (t) {
var y, f;
if (s - 1 > t ? (y = "AAC PES did not start with ADTS header,offset:" + t, f = !1) : (y = "no ADTS header found in AAC PES", f = !0), this.observer.trigger(n.default.ERROR, {
type: r.ErrorTypes.MEDIA_ERROR,
id: this.id,
details: r.ErrorDetails.FRAG_PARSING_ERROR,
fatal: f,
reason: y
}), f) return
}
if (a.audiosamplerate || (l = c.default.getAudioConfig(this.observer, i, t, k), a.config = l.config, a.audiosamplerate = l.samplerate, a.channelCount = l.channelCount, a.codec = l.codec, a.duration = T, e.logger.log("parsed codec:" + a.codec + ",rate:" + l.samplerate + ",nb channel:" + l.channelCount)), E = 0, p = 9216e4 / a.audiosamplerate, u && b) {
var v = b + p;
Math.abs(v - g) > 1 && (e.logger.log("AAC: align PTS for overlapping frames by " + Math.round((v - g) / 90)), g = v)
}
for (; s > t + 5 && (d = 1 & i[t + 1] ? 7 : 9, o = (3 & i[t + 3]) << 11 | i[t + 4] << 3 | (224 & i[t + 5]) >>> 5, o -= d, o > 0 && s >= t + d + o);)
for (h = g + E * p, _ = {
unit: i.subarray(t + d, t + d + o),
pts: h,
dts: h
}, a.samples.push(_), a.len += o, t += o + d, E++; s - 1 > t && (255 !== i[t] || 240 !== (240 & i[t + 1])); t++);
u = s > t ? i.subarray(t, s) : null, this.aacOverFlow = u, this.aacLastPTS = h
}
}, {
key: "_parseID3PES",
value: function(e) {
this._id3Track.samples.push(e)
}
}], [{
key: "probe",
value: function(e) {
return e.length >= 564 && 71 === e[0] && 71 === e[188] && 71 === e[376]
}
}]), t
}();
a.default = o
}, {
17: 17,
21: 21,
24: 24,
26: 26,
43: 43
}],
24: [function(t, r, e) {
"use strict";
Object.defineProperty(e, "__esModule", {
value: !0
});
e.ErrorTypes = {
NETWORK_ERROR: "networkError",
MEDIA_ERROR: "mediaError",
OTHER_ERROR: "otherError"
}, e.ErrorDetails = {
MANIFEST_LOAD_ERROR: "manifestLoadError",
MANIFEST_LOAD_TIMEOUT: "manifestLoadTimeOut",
MANIFEST_PARSING_ERROR: "manifestParsingError",
MANIFEST_INCOMPATIBLE_CODECS_ERROR: "manifestIncompatibleCodecsError",
LEVEL_LOAD_ERROR: "levelLoadError",
LEVEL_LOAD_TIMEOUT: "levelLoadTimeOut",
LEVEL_SWITCH_ERROR: "levelSwitchError",
AUDIO_TRACK_LOAD_ERROR: "audioTrackLoadError",
AUDIO_TRACK_LOAD_TIMEOUT: "audioTrackLoadTimeOut",
FRAG_LOAD_ERROR: "fragLoadError",
FRAG_LOOP_LOADING_ERROR: "fragLoopLoadingError",
FRAG_LOAD_TIMEOUT: "fragLoadTimeOut",
FRAG_DECRYPT_ERROR: "fragDecryptError",
FRAG_PARSING_ERROR: "fragParsingError",
KEY_LOAD_ERROR: "keyLoadError",
KEY_LOAD_TIMEOUT: "keyLoadTimeOut",
BUFFER_ADD_CODEC_ERROR: "bufferAddCodecError",
BUFFER_APPEND_ERROR: "bufferAppendError",
BUFFER_APPENDING_ERROR: "bufferAppendingError",
BUFFER_STALLED_ERROR: "bufferStalledError",
BUFFER_FULL_ERROR: "bufferFullError",
BUFFER_SEEK_OVER_HOLE: "bufferSeekOverHole",
INTERNAL_EXCEPTION: "internalException"
}
}, {}],
25: [function(e, h, t) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
return typeof e
} : function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e
},
d = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
o = e(43),
r = e(24),
u = e(26),
s = i(u),
l = function() {
function e(n) {
a(this, e), this.hls = n, this.onEvent = this.onEvent.bind(this);
for (var r = arguments.length, i = Array(r > 1 ? r - 1 : 0), t = 1; r > t; t++) i[t - 1] = arguments[t];
this.handledEvents = i, this.useGenericHandler = !0, this.registerListeners()
}
return d(e, [{
key: "destroy",
value: function() {
this.unregisterListeners()
}
}, {
key: "isEventHandler",
value: function() {
return "object" === n(this.handledEvents) && this.handledEvents.length && "function" == typeof this.onEvent
}
}, {
key: "registerListeners",
value: function() {
this.isEventHandler() && this.handledEvents.forEach(function(e) {
if ("hlsEventGeneric" === e) throw new Error("Forbidden event name: " + e);
this.hls.on(e, this.onEvent)
}.bind(this))
}
}, {
key: "unregisterListeners",
value: function() {
this.isEventHandler() && this.handledEvents.forEach(function(e) {
this.hls.off(e, this.onEvent)
}.bind(this))
}
}, {
key: "onEvent",
value: function(e, t) {
this.onEventGeneric(e, t)
}
}, {
key: "onEventGeneric",
value: function(e, t) {
var i = function(t, r) {
var e = "on" + t.replace("hls", "");
if ("function" != typeof this[e]) throw new Error("Event " + t + " has no generic handler in this " + this.constructor.name + " class (tried " + e + ")");
return this[e].bind(this, r)
};
try {
i.call(this, e, t).call()
} catch (t) {
o.logger.error("internal error happened while processing " + e + ":" + t.message), this.hls.trigger(s.default.ERROR, {
type: r.ErrorTypes.OTHER_ERROR,
details: r.ErrorDetails.INTERNAL_EXCEPTION,
fatal: !1,
event: e,
err: t
})
}
}
}]), e
}();
t.default = l
}, {
24: 24,
26: 26,
43: 43
}],
26: [function(t, e, r) {
"use strict";
e.exports = {
MEDIA_ATTACHING: "hlsMediaAttaching",
MEDIA_ATTACHED: "hlsMediaAttached",
MEDIA_DETACHING: "hlsMediaDetaching",
MEDIA_DETACHED: "hlsMediaDetached",
BUFFER_RESET: "hlsBufferReset",
BUFFER_CODECS: "hlsBufferCodecs",
BUFFER_CREATED: "hlsBufferCreated",
BUFFER_APPENDING: "hlsBufferAppending",
BUFFER_APPENDED: "hlsBufferAppended",
BUFFER_EOS: "hlsBufferEos",
BUFFER_FLUSHING: "hlsBufferFlushing",
BUFFER_FLUSHED: "hlsBufferFlushed",
MANIFEST_LOADING: "hlsManifestLoading",
MANIFEST_LOADED: "hlsManifestLoaded",
MANIFEST_PARSED: "hlsManifestParsed",
LEVEL_LOADING: "hlsLevelLoading",
LEVEL_LOADED: "hlsLevelLoaded",
LEVEL_UPDATED: "hlsLevelUpdated",
LEVEL_PTS_UPDATED: "hlsLevelPtsUpdated",
LEVEL_SWITCH: "hlsLevelSwitch",
AUDIO_TRACKS_UPDATED: "hlsAudioTracksUpdated",
AUDIO_TRACK_SWITCH: "hlsAudioTrackSwitch",
AUDIO_TRACK_LOADING: "hlsAudioTrackLoading",
AUDIO_TRACK_LOADED: "hlsAudioTrackLoaded",
FRAG_LOADING: "hlsFragLoading",
FRAG_LOAD_PROGRESS: "hlsFragLoadProgress",
FRAG_LOAD_EMERGENCY_ABORTED: "hlsFragLoadEmergencyAborted",
FRAG_LOADED: "hlsFragLoaded",
FRAG_PARSING_INIT_SEGMENT: "hlsFragParsingInitSegment",
FRAG_PARSING_USERDATA: "hlsFragParsingUserdata",
FRAG_PARSING_METADATA: "hlsFragParsingMetadata",
FRAG_PARSING_DATA: "hlsFragParsingData",
FRAG_PARSED: "hlsFragParsed",
FRAG_BUFFERED: "hlsFragBuffered",
FRAG_CHANGED: "hlsFragChanged",
FPS_DROP: "hlsFpsDrop",
FPS_DROP_LEVEL_CAPPING: "hlsFpsDropLevelCapping",
ERROR: "hlsError",
DESTROYING: "hlsDestroying",
KEY_LOADING: "hlsKeyLoading",
KEY_LOADED: "hlsKeyLoaded",
STREAM_STATE_TRANSITION: "hlsStreamStateTransition"
}
}, {}],
27: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e() {
t(this, e)
}
return r(e, null, [{
key: "getSilentFrame",
value: function(e) {
return 1 === e ? new Uint8Array([0, 200, 0, 128, 35, 128]) : 2 === e ? new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]) : 3 === e ? new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]) : 4 === e ? new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]) : 5 === e ? new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]) : 6 === e ? new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224]) : null
}
}]), e
}();
e.default = i
}, {}],
28: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e() {
t(this, e)
}
return r(e, null, [{
key: "bufferInfo",
value: function(r, a, n) {
if (r) {
var e, t = r.buffered,
i = [];
for (e = 0; e < t.length; e++) i.push({
start: t.start(e),
end: t.end(e)
});
return this.bufferedInfo(i, a, n)
}
return {
len: 0,
start: 0,
end: 0,
nextStart: void 0
}
}
}, {
key: "bufferedInfo",
value: function(r, i, s) {
var o, l, a, f, e, t = [];
for (r.sort(function(e, t) {
var r = e.start - t.start;
return r ? r : t.end - e.end
}), e = 0; e < r.length; e++) {
var u = t.length;
if (u) {
var d = t[u - 1].end;
r[e].start - d < s ? r[e].end > d && (t[u - 1].end = r[e].end) : t.push(r[e])
} else t.push(r[e])
}
for (e = 0, o = 0, l = a = i; e < t.length; e++) {
var n = t[e].start,
h = t[e].end;
if (i + s >= n && h > i) l = n, a = h, o = a - i;
else if (n > i + s) {
f = n;
break
}
}
return {
len: o,
start: l,
end: a,
nextStart: f
}
}
}]), e
}();
e.default = i
}, {}],
29: [function(r, s, t) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
e = r(43),
n = function() {
function t() {
i(this, t)
}
return a(t, null, [{
key: "mergeDetails",
value: function(o, i) {
var a, c = Math.max(o.startSN, i.startSN) - i.startSN,
f = Math.min(o.endSN, i.endSN) - i.startSN,
u = i.startSN - o.startSN,
h = o.fragments,
l = i.fragments,
d = 0;
if (c > f) return void(i.PTSKnown = !1);
for (var r = c; f >= r; r++) {
var s = h[u + r],
n = l[r];
n && s && (d = s.cc - n.cc, isNaN(s.startPTS) || (n.start = n.startPTS = s.startPTS, n.endPTS = s.endPTS, n.duration = s.duration, a = n))
}
if (d)
for (e.logger.log("discontinuity sliding from playlist, take drift into account"), r = 0; r < l.length; r++) l[r].cc += d;
if (a) t.updateFragPTSDTS(i, a.sn, a.startPTS, a.endPTS, a.startDTS, a.endDTS);
else if (u >= 0 && u < h.length) {
var g = h[u].start;
for (r = 0; r < l.length; r++) l[r].start += g
}
i.PTSKnown = o.PTSKnown
}
}, {
key: "updateFragPTSDTS",
value: function(a, l, i, s, d, u) {
var o, n, e, r;
if (l < a.startSN || l > a.endSN) return 0;
if (o = l - a.startSN, n = a.fragments, e = n[o], !isNaN(e.startPTS)) {
var h = Math.abs(e.startPTS - i);
isNaN(e.deltaPTS) ? e.deltaPTS = h : e.deltaPTS = Math.max(h, e.deltaPTS), i = Math.min(i, e.startPTS), s = Math.max(s, e.endPTS), d = Math.min(d, e.startDTS), u = Math.max(u, e.endDTS)
}
var f = i - e.start;
for (e.start = e.startPTS = i, e.endPTS = s, e.startDTS = d, e.endDTS = u, e.duration = s - i, r = o; r > 0; r--) t.updatePTS(n, r, r - 1);
for (r = o; r < n.length - 1; r++) t.updatePTS(n, r, r + 1);
return a.PTSKnown = !0, f
}
}, {
key: "updatePTS",
value: function(s, i, a) {
var t = s[i],
r = s[a],
n = r.startPTS;
isNaN(n) ? a > i ? r.start = t.start + t.duration : r.start = t.start - r.duration : a > i ? (t.duration = n - t.start, t.duration < 0 && e.logger.error("negative duration computed for frag " + t.sn + ",level " + t.level + ", there should be some duration drift between playlist and fragment!")) : (r.duration = t.start - n, r.duration < 0 && e.logger.error("negative duration computed for frag " + r.sn + ",level " + r.level + ", there should be some duration drift between playlist and fragment!"))
}
}]), t
}();
t.default = n
}, {
43: 43
}],
30: [function(e, B, a) {
"use strict";
function t(e) {
return e && e.__esModule ? e : {
default: e
}
}
function o(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(a, "__esModule", {
value: !0
});
var n = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
P = e(26),
i = t(P),
s = e(24),
u = e(34),
d = t(u),
h = e(32),
f = t(h),
c = e(3),
g = t(c),
v = e(6),
p = t(v),
y = e(7),
m = t(y),
E = e(4),
G = t(E),
_ = e(11),
R = t(_),
k = e(10),
T = t(k),
A = e(12),
S = t(A),
L = e(9),
D = t(L),
O = e(5),
w = t(O),
r = e(43),
I = e(47),
C = t(I),
M = e(1),
N = t(M),
F = e(33),
x = t(F),
U = e(41),
b = t(U),
l = function() {
function e() {
var t = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0];
o(this, e);
var n = e.DefaultConfig;
if ((t.liveSyncDurationCount || t.liveMaxLatencyDurationCount) && (t.liveSyncDuration || t.liveMaxLatencyDuration)) throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");
for (var a in n) a in t || (t[a] = n[a]);
if (void 0 !== t.liveMaxLatencyDurationCount && t.liveMaxLatencyDurationCount <= t.liveSyncDurationCount) throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');
if (void 0 !== t.liveMaxLatencyDuration && (t.liveMaxLatencyDuration <= t.liveSyncDuration || void 0 === t.liveSyncDuration)) throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');
(0, r.enableLogs)(t.debug), this.config = t;
var i = this.observer = new N.default;
i.trigger = function(r) {
for (var t = arguments.length, a = Array(t > 1 ? t - 1 : 0), e = 1; t > e; e++) a[e - 1] = arguments[e];
i.emit.apply(i, [r, r].concat(a))
}, i.off = function(a) {
for (var t = arguments.length, r = Array(t > 1 ? t - 1 : 0), e = 1; t > e; e++) r[e - 1] = arguments[e];
i.removeListener.apply(i, [a].concat(r))
}, this.on = i.on.bind(i), this.off = i.off.bind(i), this.trigger = i.trigger.bind(i), this.playlistLoader = new d.default(this), this.fragmentLoader = new f.default(this), this.levelController = new T.default(this), this.abrController = new t.abrController(this), this.bufferController = new t.bufferController(this), this.capLevelController = new t.capLevelController(this), this.fpsController = new t.fpsController(this), this.streamController = new t.streamController(this), this.audioStreamController = new t.audioStreamController(this), this.timelineController = new t.timelineController(this), this.audioTrackController = new w.default(this), this.keyLoader = new x.default(this)
}
return n(e, null, [{
key: "isSupported",
value: function() {
return window.MediaSource && "function" == typeof window.MediaSource.isTypeSupported && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')
}
}, {
key: "version",
get: function() {
return "0.6.2-6"
}
}, {
key: "Events",
get: function() {
return i.default
}
}, {
key: "ErrorTypes",
get: function() {
return s.ErrorTypes
}
}, {
key: "ErrorDetails",
get: function() {
return s.ErrorDetails
}
}, {
key: "DefaultConfig",
get: function() {
return e.defaultConfig || (e.defaultConfig = {
autoStartLoad: !0,
startPosition: -1,
debug: !1,
capLevelOnFPSDrop: !1,
capLevelToPlayerSize: !1,
maxBufferLength: 30,
maxBufferSize: 6e7,
maxBufferHole: .5,
maxSeekHole: 2,
seekHoleNudgeDuration: .01,
stalledInBufferedNudgeThreshold: 10,
maxFragLookUpTolerance: .2,
liveSyncDurationCount: 3,
liveMaxLatencyDurationCount: 1 / 0,
liveSyncDuration: void 0,
liveMaxLatencyDuration: void 0,
maxMaxBufferLength: 600,
enableWorker: !0,
enableSoftwareAES: !0,
manifestLoadingTimeOut: 1e4,
manifestLoadingMaxRetry: 1,
manifestLoadingRetryDelay: 1e3,
manifestLoadingMaxRetryTimeout: 64e3,
levelLoadingTimeOut: 1e4,
levelLoadingMaxRetry: 4,
levelLoadingRetryDelay: 1e3,
levelLoadingMaxRetryTimeout: 64e3,
fragLoadingTimeOut: 2e4,
fragLoadingMaxRetry: 6,
fragLoadingRetryDelay: 1e3,
fragLoadingMaxRetryTimeout: 64e3,
fragLoadingLoopThreshold: 3,
startFragPrefetch: !1,
fpsDroppedMonitoringPeriod: 5e3,
fpsDroppedMonitoringThreshold: .2,
appendErrorMaxRetry: 3,
loader: C.default,
fLoader: void 0,
pLoader: void 0,
abrController: g.default,
bufferController: p.default,
capLevelController: m.default,
fpsController: D.default,
streamController: R.default,
audioStreamController: G.default,
timelineController: S.default,
cueHandler: b.default,
enableCEA708Captions: !0,
enableMP2TPassThrough: !1,
stretchShortVideoTrack: !1,
forceKeyFrameOnDiscontinuity: !0,
abrEwmaFastLive: 5,
abrEwmaSlowLive: 9,
abrEwmaFastVoD: 4,
abrEwmaSlowVoD: 15,
abrEwmaDefaultEstimate: 5e5,
abrBandWidthFactor: .8,
abrBandWidthUpFactor: .7
}), e.defaultConfig
},
set: function(t) {
e.defaultConfig = t
}
}]), n(e, [{
key: "destroy",
value: function() {
r.logger.log("destroy"), this.trigger(i.default.DESTROYING), this.detachMedia(), this.playlistLoader.destroy(), this.fragmentLoader.destroy(), this.levelController.destroy(), this.abrController.destroy(), this.bufferController.destroy(), this.capLevelController.destroy(), this.fpsController.destroy(), this.streamController.destroy(), this.audioStreamController.destroy(), this.timelineController.destroy(), this.audioTrackController.destroy(), this.keyLoader.destroy(), this.url = null, this.observer.removeAllListeners()
}
}, {
key: "attachMedia",
value: function(e) {
r.logger.log("attachMedia"), this.media = e, this.trigger(i.default.MEDIA_ATTACHING, {
media: e
})
}
}, {
key: "detachMedia",
value: function() {
r.logger.log("detachMedia"), this.trigger(i.default.MEDIA_DETACHING), this.media = null
}
}, {
key: "loadSource",
value: function(e) {
r.logger.log("loadSource:" + e), this.url = e, this.trigger(i.default.MANIFEST_LOADING, {
url: e
})
}
}, {
key: "startLoad",
value: function() {
var e = arguments.length <= 0 || void 0 === arguments[0] ? -1 : arguments[0];
r.logger.log("startLoad"), this.levelController.startLoad(), this.streamController.startLoad(e), this.audioStreamController.startLoad(e)
}
}, {
key: "stopLoad",
value: function() {
r.logger.log("stopLoad"), this.levelController.stopLoad(), this.streamController.stopLoad(), this.audioStreamController.stopLoad()
}
}, {
key: "swapAudioCodec",
value: function() {
r.logger.log("swapAudioCodec"), this.streamController.swapAudioCodec()
}
}, {
key: "recoverMediaError",
value: function() {
r.logger.log("recoverMediaError");
var e = this.media;
this.detachMedia(), this.attachMedia(e)
}
}, {
key: "levels",
get: function() {
return this.levelController.levels
}
}, {
key: "currentLevel",
get: function() {
return this.streamController.currentLevel
},
set: function(e) {
r.logger.log("set currentLevel:" + e), this.loadLevel = e, this.streamController.immediateLevelSwitch()
}
}, {
key: "nextLevel",
get: function() {
return this.streamController.nextLevel
},
set: function(e) {
r.logger.log("set nextLevel:" + e), this.levelController.manualLevel = e, this.streamController.nextLevelSwitch()
}
}, {
key: "loadLevel",
get: function() {
return this.levelController.level
},
set: function(e) {
r.logger.log("set loadLevel:" + e), this.levelController.manualLevel = e
}
}, {
key: "nextLoadLevel",
get: function() {
return this.levelController.nextLoadLevel
},
set: function(e) {
this.levelController.nextLoadLevel = e
}
}, {
key: "firstLevel",
get: function() {
return this.levelController.firstLevel
},
set: function(e) {
r.logger.log("set firstLevel:" + e), this.levelController.firstLevel = e
}
}, {
key: "startLevel",
get: function() {
return this.levelController.startLevel
},
set: function(e) {
r.logger.log("set startLevel:" + e), this.levelController.startLevel = e
}
}, {
key: "autoLevelCapping",
get: function() {
return this.abrController.autoLevelCapping
},
set: function(e) {
r.logger.log("set autoLevelCapping:" + e), this.abrController.autoLevelCapping = e
}
}, {
key: "autoLevelEnabled",
get: function() {
return -1 === this.levelController.manualLevel
}
}, {
key: "manualLevel",
get: function() {
return this.levelController.manualLevel
}
}, {
key: "audioTracks",
get: function() {
return this.audioTrackController.audioTracks
}
}, {
key: "audioTrack",
get: function() {
return this.audioTrackController.audioTrack
},
set: function(e) {
this.audioTrackController.audioTrack = e
}
}, {
key: "liveSyncPosition",
get: function() {
return this.streamController.liveSyncPosition
}
}]), e
}();
a.default = l
}, {
1: 1,
10: 10,
11: 11,
12: 12,
24: 24,
26: 26,
3: 3,
32: 32,
33: 33,
34: 34,
4: 4,
41: 41,
43: 43,
47: 47,
5: 5,
6: 6,
7: 7,
9: 9
}],
31: [function(e, t, r) {
"use strict";
t.exports = e(30).default
}, {
30: 30
}],
32: [function(t, g, i) {
"use strict";
function a(e) {
return e && e.__esModule ? e : {
default: e
}
}
function h(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function f(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function s(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(i, "__esModule", {
value: !0
});
var c = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = t(26),
e = a(l),
d = t(25),
n = a(d),
r = t(24),
o = t(43),
u = function(i) {
function t(i) {
h(this, t);
var r = f(this, Object.getPrototypeOf(t).call(this, i, e.default.FRAG_LOADING));
return r.loaders = {}, r
}
return s(t, i), c(t, [{
key: "destroy",
value: function() {
for (var t in this.loaders) {
var e = this.loaders[t];
e && e.destroy()
}
this.loaders = {}, n.default.prototype.destroy.call(this)
}
}, {
key: "onFragLoading",
value: function(d) {
var e = d.frag,
a = e.type,
r = this.loaders[a],
t = this.hls.config;
e.loaded = 0, r && (o.logger.warn("abort previous fragment loader for type:" + a), r.abort()), r = this.loaders[a] = e.loader = "undefined" != typeof t.fLoader ? new t.fLoader(t) : new t.loader(t);
var i = void 0,
n = void 0,
s = void 0;
i = {
url: e.url,
frag: e,
responseType: "arraybuffer",
progressData: !1
};
var l = e.byteRangeStartOffset,
u = e.byteRangeEndOffset;
isNaN(l) || isNaN(u) || (i.rangeStart = l, i.rangeEnd = u), n = {
timeout: t.fragLoadingTimeOut,
maxRetry: 0,
retryDelay: 0,
maxRetryDelay: t.fragLoadingMaxRetryTimeout
}, s = {
onSuccess: this.loadsuccess.bind(this),
onError: this.loaderror.bind(this),
onTimeout: this.loadtimeout.bind(this),
onProgress: this.loadprogress.bind(this)
}, r.load(i, n, s)
}
}, {
key: "loadsuccess",
value: function(r, i, a) {
var n = r.data,
t = a.frag;
t.loader = void 0, this.loaders[t.type] = void 0, this.hls.trigger(e.default.FRAG_LOADED, {
payload: n,
frag: t,
stats: i
})
}
}, {
key: "loaderror",
value: function(a, t) {
var i = t.loader;
i && i.abort(), this.loaders[t.type] = void 0, this.hls.trigger(e.default.ERROR, {
type: r.ErrorTypes.NETWORK_ERROR,
details: r.ErrorDetails.FRAG_LOAD_ERROR,
fatal: !1,
frag: t.frag,
response: a
})
}
}, {
key: "loadtimeout",
value: function(a, t) {
var i = t.loader;
i && i.abort(), this.loaders[t.type] = void 0, this.hls.trigger(e.default.ERROR, {
type: r.ErrorTypes.NETWORK_ERROR,
details: r.ErrorDetails.FRAG_LOAD_TIMEOUT,
fatal: !1,
frag: t.frag
})
}
}, {
key: "loadprogress",
value: function(t, i, a) {
var r = i.frag;
r.loaded = t.loaded, this.hls.trigger(e.default.FRAG_LOAD_PROGRESS, {
frag: r,
stats: t
})
}
}]), t
}(n.default);
i.default = u
}, {
24: 24,
25: 25,
26: 26,
43: 43
}],
33: [function(t, g, i) {
"use strict";
function a(e) {
return e && e.__esModule ? e : {
default: e
}
}
function h(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function f(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function s(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(i, "__esModule", {
value: !0
});
var c = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
l = t(26),
e = a(l),
d = t(25),
n = a(d),
r = t(24),
o = t(43),
u = function(i) {
function t(i) {
h(this, t);
var r = f(this, Object.getPrototypeOf(t).call(this, i, e.default.KEY_LOADING));
return r.loaders = {}, r.decryptkey = null, r.decrypturl = null, r
}
return s(t, i), c(t, [{
key: "destroy",
value: function() {
for (var t in this.loaders) {
var e = this.loaders[t];
e && e.destroy()
}
this.loaders = {}, n.default.prototype.destroy.call(this)
}
}, {
key: "onKeyLoading",
value: function(h) {
var t = h.frag,
i = t.type,
n = this.loaders[i],
s = t.decryptdata,
a = s.uri;
if (a !== this.decrypturl || null === this.decryptkey) {
var r = this.hls.config;
n && (o.logger.warn("abort previous fragment loader for type:" + i), n.abort()), t.loader = this.loaders[i] = new r.loader(r), this.decrypturl = a, this.decryptkey = null;
var l = void 0,
u = void 0,
d = void 0;
l = {
url: a,
frag: t,
responseType: "arraybuffer"
}, u = {
timeout: r.fragLoadingTimeOut,
maxRetry: r.fragLoadingMaxRetry,
retryDelay: r.fragLoadingRetryDelay,
maxRetryDelay: r.fragLoadingMaxRetryTimeout
}, d = {
onSuccess: this.loadsuccess.bind(this),
onError: this.loaderror.bind(this),
onTimeout: this.loadtimeout.bind(this)
}, t.loader.load(l, u, d)
} else this.decryptkey && (s.key = this.decryptkey, this.hls.trigger(e.default.KEY_LOADED, {
frag: t
}))
}
}, {
key: "loadsuccess",
value: function(i, a, r) {
var t = r.frag;
this.decryptkey = t.decryptdata.key = new Uint8Array(i.data), t.loader = void 0, this.loaders[r.type] = void 0, this.hls.trigger(e.default.KEY_LOADED, {
frag: t
})
}
}, {
key: "loaderror",
value: function(n, t) {
var i = t.frag,
a = i.loader;
a && a.abort(), this.loaders[t.type] = void 0, this.hls.trigger(e.default.ERROR, {
type: r.ErrorTypes.NETWORK_ERROR,
details: r.ErrorDetails.KEY_LOAD_ERROR,
fatal: !1,
frag: i,
response: n
})
}
}, {
key: "loadtimeout",
value: function(n, t) {
var i = t.frag,
a = i.loader;
a && a.abort(), this.loaders[t.type] = void 0, this.hls.trigger(e.default.ERROR, {
type: r.ErrorTypes.NETWORK_ERROR,
details: r.ErrorDetails.KEY_LOAD_TIMEOUT,
fatal: !1,
frag: i
})
}
}]), t
}(n.default);
i.default = u
}, {
24: 24,
25: 25,
26: 26,
43: 43
}],
34: [function(r, m, o) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function h(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function c(t, e) {
if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !e || "object" != typeof e && "function" != typeof e ? t : e
}
function p(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e);
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e)
}
Object.defineProperty(o, "__esModule", {
value: !0
});
var f = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
u = r(26),
t = i(u),
d = r(25),
s = i(d),
e = r(24),
l = r(46),
g = i(l),
v = r(38),
n = i(v),
a = r(43),
y = function(i) {
function r(i) {
h(this, r);
var e = c(this, Object.getPrototypeOf(r).call(this, i, t.default.MANIFEST_LOADING, t.default.LEVEL_LOADING, t.default.AUDIO_TRACK_LOADING));
return e.loaders = {}, e
}
return p(r, i), f(r, [{
key: "destroy",
value: function() {
for (var t in this.loaders) {
var e = this.loaders[t];
e && e.destroy()
}
this.loaders = {}, s.default.prototype.destroy.call(this)
}
}, {
key: "onManifestLoading",
value: function(e) {
this.load(e.url, {
type: "manifest"
})
}
}, {
key: "onLevelLoading",
value: function(e) {
this.load(e.url, {
type: "level",
level: e.level,
id: e.id
})
}
}, {
key: "onAudioTrackLoading",
value: function(e) {
this.load(e.url, {
type: "audioTrack",
id: e.id
})
}
}, {
key: "load",
value: function(l, t) {
var n, s, o, i, e = this.hls.config;
"manifest" === t.type ? (n = e.manifestLoadingMaxRetry, s = e.manifestLoadingTimeOut, o = e.manifestLoadingRetryDelay, i = e.manifestLoadingMaxRetryTimeOut) : (n = e.levelLoadingMaxRetry, s = e.levelLoadingTimeOut, o = e.levelLoadingRetryDelay, i = e.levelLoadingMaxRetryTimeOut);
var r = this.loaders[t.type];
if (r) {
var u = r.context;
if (u && u.url === l) return void a.logger.warn("playlist request ongoing");
a.logger.warn("abort previous loader for type:" + t.type), r.abort()
}
r = this.loaders[t.type] = t.loader = "undefined" != typeof e.pLoader ? new e.pLoader(e) : new e.loader(e), t.url = l, t.responseType = "";
var d = void 0,
h = void 0;
d = {
timeout: s,
maxRetry: n,
retryDelay: o,
maxRetryDelay: i
}, h = {
onSuccess: this.loadsuccess.bind(this),
onError: this.loaderror.bind(this),
onTimeout: this.loadtimeout.bind(this)
}, r.load(t, d, h)
}
}, {
key: "resolve",
value: function(e, t) {
return g.default.buildAbsoluteURL(t, e)
}
}, {
key: "parseMasterPlaylist",
value: function(h, u) {
for (var l = [], i = void 0, d = /#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g; null != (i = d.exec(h));) {
var e = {},
r = e.attrs = new n.default(i[1]);
e.url = this.resolve(i[2], u);
var s = r.decimalResolution("RESOLUTION");
s && (e.width = s.width, e.height = s.height), e.bitrate = r.decimalInteger("AVERAGE-BANDWIDTH") || r.decimalInteger("BANDWIDTH"), e.name = r.NAME;
var t = r.CODECS;
if (t) {
t = t.split(",");
for (var o = 0; o < t.length; o++) {
var a = t[o]; - 1 !== a.indexOf("avc1") ? e.videoCodec = this.avc1toavcoti(a) : e.audioCodec = a
}
}
l.push(e)
}
return l
}
}, {
key: "parseMasterPlaylistMedia",
value: function(s, o, r) {
for (var i = void 0, a = [], l = /#EXT-X-MEDIA:(.*)/g; null != (i = l.exec(s));) {
var e = {},
t = new n.default(i[1]);
t.TYPE === r && (e.groupId = t["GROUP-ID"], e.name = t.NAME, e.type = r, e.default = "YES" === t.DEFAULT, e.autoselect = "YES" === t.AUTOSELECT, e.forced = "YES" === t.FORCED, t.URI && (e.url = this.resolve(t.URI, o)), e.lang = t.LANGUAGE, e.name || (e.name = e.lang), a.push(e))
}
return a
}
}, {
key: "createInitializationVector",
value: function(r) {
for (var t = new Uint8Array(16), e = 12; 16 > e; e++) t[e] = r >> 8 * (15 - e) & 255;
return t
}
}, {
key: "fragmentDecryptdataFromLevelkey",
value: function(e, r) {
var t = e;
return e && e.method && e.uri && !e.iv && (t = this.cloneObj(e), t.iv = this.createInitializationVector(r)), t
}
}, {
key: "avc1toavcoti",
value: function(r) {
var e, t = r.split(".");
return t.length > 2 ? (e = t.shift() + ".", e += parseInt(t.shift()).toString(16), e += ("000" + parseInt(t.shift()).toString(16)).substr(-4)) : e = r, e
}
}, {
key: "cloneObj",
value: function(e) {
return JSON.parse(JSON.stringify(e))
}
}, {
key: "parseLevelPlaylist",
value: function(P, f, L, S) {
var b, e, k, h = 0,
o = 0,
t = {
type: null,
version: null,
url: f,
fragments: [],
live: !0,
startSN: 0
},
i = {
method: null,
key: null,
iv: null,
uri: null
},
m = 0,
v = null,
r = null,
l = null,
g = null,
c = null,
u = null,
s = [];
for (k = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF):(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE):(\d+(?:@\d+(?:\.\d+)?)?)|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g; null !== (e = k.exec(P));) switch (e.shift(), e = e.filter(function(e) {
return void 0 !== e
}), e[0]) {
case "PLAYLIST-TYPE":
t.type = e[1].toUpperCase();
break;
case "MEDIA-SEQUENCE":
h = t.startSN = parseInt(e[1]);
break;
case "TARGETDURATION":
t.targetduration = parseFloat(e[1]);
break;
case "VERSION":
t.version = parseInt(e[1]);
break;
case "EXTM3U":
break;
case "ENDLIST":
t.live = !1;
break;
case "DIS":
m++, s.push(e);
break;
case "BYTERANGE":
var p = e[1].split("@");
u = 1 === p.length ? c : parseInt(p[1]), c = parseInt(p[0]) + u;
break;
case "INF":
l = parseFloat(e[1]), g = e[2] ? e[2] : null, s.push(e);
break;
case "":
if (!isNaN(l)) {
var R = h++;
b = this.fragmentDecryptdataFromLevelkey(i, R);
var A = e[1] ? this.resolve(e[1], f) : null;
r = {
url: A,
type: S,
duration: l,
title: g,
start: o,
sn: R,
level: L,
cc: m,
decryptdata: b,
programDateTime: v,
tagList: s
}, null !== u && (r.byteRangeStartOffset = u, r.byteRangeEndOffset = c), t.fragments.push(r), o += l, l = null, g = null, u = null, v = null, s = []
}
break;
case "KEY":
var T = e[1],
y = new n.default(T),
d = y.enumeratedString("METHOD"),
_ = y.URI,
D = y.hexadecimalInteger("IV");
d && (i = {
method: null,
key: null,
iv: null,
uri: null
}, _ && "AES-128" === d && (i.method = d, i.uri = this.resolve(_, f), i.key = null, i.iv = D));
break;
case "START":
var O = e[1],
w = new n.default(O),
E = w.decimalFloatingPoint("TIME-OFFSET");
E && (t.startTimeOffset = E);
break;
case "PROGRAM-DATE-TIME":
v = new Date(Date.parse(e[1])), s.push(e);
break;
case "#":
e.shift(), s.push(e);
break;
default:
a.logger.warn("line parsed but not handled: " + e)
}
return r && !r.url && (t.fragments.pop(), o -= r.duration), t.totalduration = o, t.averagetargetduration = o / t.fragments.length, t.endSN = h - 1, t
}
}, {
key: "loadsuccess",
value: function(v, i, l) {
var s = v.data,
r = v.url,
h = l.type,
f = l.id,
c = l.level,
n = this.hls;
if (this.loaders[h] = void 0, void 0 !== r && 0 !== r.indexOf("data:") || (r = l.url), i.tload = performance.now(), 0 === s.indexOf("#EXTM3U"))
if (s.indexOf("#EXTINF:") > 0) {
var g = "audioTrack" !== h,
u = this.parseLevelPlaylist(s, r, c || f || 0, g ? "main" : "audio");
u.tload = i.tload, "manifest" === h && n.trigger(t.default.MANIFEST_LOADED, {
levels: [{
url: r,
details: u
}],
url: r,
stats: i
}), i.tparsed = performance.now(), g ? n.trigger(t.default.LEVEL_LOADED, {
details: u,
level: c || 0,
id: f || 0,
stats: i
}) : n.trigger(t.default.AUDIO_TRACK_LOADED, {
details: u,
id: f,
stats: i
})
} else {
var d = this.parseMasterPlaylist(s, r);
if (d.length) {
var o = this.parseMasterPlaylistMedia(s, r, "AUDIO");
if (o.length) {
var p = !1;
o.forEach(function(e) {
e.url || (p = !0)
}), p === !1 && d[0].audioCodec && !d[0].attrs.AUDIO && (a.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"), o.unshift({
type: "main",
name: "main"
}))
}
n.trigger(t.default.MANIFEST_LOADED, {
levels: d,
audioTracks: o,
url: r,
stats: i
})
} else n.trigger(t.default.ERROR, {
type: e.ErrorTypes.NETWORK_ERROR,
details: e.ErrorDetails.MANIFEST_PARSING_ERROR,
fatal: !0,
url: r,
reason: "no level found in manifest"
})
}
else n.trigger(t.default.ERROR, {
type: e.ErrorTypes.NETWORK_ERROR,
details: e.ErrorDetails.MANIFEST_PARSING_ERROR,
fatal: !0,
url: r,
reason: "no EXTM3U delimiter"
})
}
}, {
key: "loaderror",
value: function(s, r) {
var i, a, n = r.loader;
switch (r.type) {
case "manifest":
i = e.ErrorDetails.MANIFEST_LOAD_ERROR, a = !0;
break;
case "level":
i = e.ErrorDetails.LEVEL_LOAD_ERROR, a = !1;
break;
case "audioTrack":
i = e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, a = !1
}
n && (n.abort(), this.loaders[r.type] = void 0), this.hls.trigger(t.default.ERROR, {
type: e.ErrorTypes.NETWORK_ERROR,
details: i,
fatal: a,
url: n.url,
loader: n,
response: s,
context: r
})
}
}, {
key: "loadtimeout",
value: function(s, r) {
var i, a, n = r.loader;
switch (r.type) {
case "manifest":
i = e.ErrorDetails.MANIFEST_LOAD_TIMEOUT, a = !0;
break;
case "level":
i = e.ErrorDetails.LEVEL_LOAD_TIMEOUT, a = !1;
break;
case "audioTrack":
i = e.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT, a = !1
}
n && (n.abort(), this.loaders[r.type] = void 0), this.hls.trigger(t.default.ERROR, {
type: e.ErrorTypes.NETWORK_ERROR,
details: i,
fatal: a,
url: n.url,
loader: n,
context: r
})
}
}]), r
}(s.default);
o.default = y
}, {
24: 24,
25: 25,
26: 26,
38: 38,
43: 43,
46: 46
}],
35: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e() {
t(this, e)
}
return r(e, null, [{
key: "init",
value: function() {
e.types = {
avc1: [],
avcC: [],
btrt: [],
dinf: [],
dref: [],
esds: [],
ftyp: [],
hdlr: [],
mdat: [],
mdhd: [],
mdia: [],
mfhd: [],
minf: [],
moof: [],
moov: [],
mp4a: [],
mvex: [],
mvhd: [],
sdtp: [],
stbl: [],
stco: [],
stsc: [],
stsd: [],
stsz: [],
stts: [],
tfdt: [],
tfhd: [],
traf: [],
trak: [],
trun: [],
trex: [],
tkhd: [],
vmhd: [],
smhd: []
};
var t;
for (t in e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t.charCodeAt(2), t.charCodeAt(3)]);
var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0]),
a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0]);
e.HDLR_TYPES = {
video: i,
audio: a
};
var n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]),
s = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]);
e.STTS = e.STSC = e.STCO = s, e.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), e.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), e.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), e.STSD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]);
var r = new Uint8Array([105, 115, 111, 109]),
o = new Uint8Array([97, 118, 99, 49]),
l = new Uint8Array([0, 0, 0, 1]);
e.FTYP = e.box(e.types.ftyp, r, l, r, o), e.DINF = e.box(e.types.dinf, e.box(e.types.dref, n))
}
}, {
key: "box",
value: function(a) {
for (var t, i = Array.prototype.slice.call(arguments, 1), e = 8, r = i.length, n = r; r--;) e += i[r].byteLength;
for (t = new Uint8Array(e), t[0] = e >> 24 & 255, t[1] = e >> 16 & 255, t[2] = e >> 8 & 255, t[3] = 255 & e, t.set(a, 4), r = 0, e = 8; n > r; r++) t.set(i[r], e), e += i[r].byteLength;
return t
}
}, {
key: "hdlr",
value: function(t) {
return e.box(e.types.hdlr, e.HDLR_TYPES[t])
}
}, {
key: "mdat",
value: function(t) {
return e.box(e.types.mdat, t)
}
}, {
key: "mdhd",
value: function(t, r) {
return r *= t, e.box(e.types.mdhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, r >> 24, r >> 16 & 255, r >> 8 & 255, 255 & r, 85, 196, 0, 0]))
}
}, {
key: "mdia",
value: function(t) {
return e.box(e.types.mdia, e.mdhd(t.timescale, t.duration), e.hdlr(t.type), e.minf(t))
}
}, {
key: "mfhd",
value: function(t) {
return e.box(e.types.mfhd, new Uint8Array([0, 0, 0, 0, t >> 24, t >> 16 & 255, t >> 8 & 255, 255 & t]))
}
}, {
key: "minf",
value: function(t) {
return "audio" === t.type ? e.box(e.types.minf, e.box(e.types.smhd, e.SMHD), e.DINF, e.stbl(t)) : e.box(e.types.minf, e.box(e.types.vmhd, e.VMHD), e.DINF, e.stbl(t))
}
}, {
key: "moof",
value: function(t, r, i) {
return e.box(e.types.moof, e.mfhd(t), e.traf(i, r))
}
}, {
key: "moov",
value: function(t) {
for (var r = t.length, i = []; r--;) i[r] = e.trak(t[r]);
return e.box.apply(null, [e.types.moov, e.mvhd(t[0].timescale, t[0].duration)].concat(i).concat(e.mvex(t)))
}
}, {
key: "mvex",
value: function(r) {
for (var t = r.length, i = []; t--;) i[t] = e.trex(r[t]);
return e.box.apply(null, [e.types.mvex].concat(i))
}
}, {
key: "mvhd",
value: function(t, r) {
r *= t;
var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, 255 & r, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255]);
return e.box(e.types.mvhd, i)
}
}, {
key: "sdtp",
value: function(n) {
var r, t, i = n.samples || [],
a = new Uint8Array(4 + i.length);
for (t = 0; t < i.length; t++) r = i[t].flags, a[t + 4] = r.dependsOn << 4 | r.isDependedOn << 2 | r.hasRedundancy;
return e.box(e.types.sdtp, a)
}
}, {
key: "stbl",
value: function(t) {
return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.STTS), e.box(e.types.stsc, e.STSC), e.box(e.types.stsz, e.STSZ), e.box(e.types.stco, e.STCO))
}
}, {
key: "avc1",
value: function(t) {
var r, a, n, i = [],
s = [];
for (r = 0; r < t.sps.length; r++) a = t.sps[r], n = a.byteLength, i.push(n >>> 8 & 255), i.push(255 & n), i = i.concat(Array.prototype.slice.call(a));
for (r = 0; r < t.pps.length; r++) a = t.pps[r], n = a.byteLength, s.push(n >>> 8 & 255), s.push(255 & n), s = s.concat(Array.prototype.slice.call(a));
var u = e.box(e.types.avcC, new Uint8Array([1, i[3], i[4], i[5], 255, 224 | t.sps.length].concat(i).concat([t.pps.length]).concat(s))),
o = t.width,
l = t.height;
return e.box(e.types.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, o >> 8 & 255, 255 & o, l >> 8 & 255, 255 & l, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 18, 100, 97, 105, 108, 121, 109, 111, 116, 105, 111, 110, 47, 104, 108, 115, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17]), u, e.box(e.types.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192])))
}
}, {
key: "esds",
value: function(t) {
var e = t.config.length;
return new Uint8Array([0, 0, 0, 0, 3, 23 + e, 0, 1, 0, 4, 15 + e, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5].concat([e]).concat(t.config).concat([6, 1, 2]))
}
}, {
key: "mp4a",
value: function(t) {
var r = t.audiosamplerate;
return e.box(e.types.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, t.channelCount, 0, 16, 0, 0, 0, 0, r >> 8 & 255, 255 & r, 0, 0]), e.box(e.types.esds, e.esds(t)))
}
}, {
key: "stsd",
value: function(t) {
return "audio" === t.type ? e.box(e.types.stsd, e.STSD, e.mp4a(t)) : e.box(e.types.stsd, e.STSD, e.avc1(t))
}
}, {
key: "tkhd",
value: function(t) {
var r = t.id,
i = t.duration * t.timescale,
a = t.width,
n = t.height;
return e.box(e.types.tkhd, new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, 255 & r, 0, 0, 0, 0, i >> 24, i >> 16 & 255, i >> 8 & 255, 255 & i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, a >> 8 & 255, 255 & a, 0, 0, n >> 8 & 255, 255 & n, 0, 0]))
}
}, {
key: "traf",
value: function(i, t) {
var a = e.sdtp(i),
r = i.id;
return e.box(e.types.traf, e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, r >> 24, r >> 16 & 255, r >> 8 & 255, 255 & r])), e.box(e.types.tfdt, new Uint8Array([0, 0, 0, 0, t >> 24, t >> 16 & 255, t >> 8 & 255, 255 & t])), e.trun(i, a.length + 16 + 16 + 8 + 16 + 8 + 8), a)
}
}, {
key: "trak",
value: function(t) {
return t.duration = t.duration || 4294967295, e.box(e.types.trak, e.tkhd(t), e.mdia(t))
}
}, {
key: "trex",
value: function(r) {
var t = r.id;
return e.box(e.types.trex, new Uint8Array([0, 0, 0, 0, t >> 24, t >> 16 & 255, t >> 8 & 255, 255 & t, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]))
}
}, {
key: "trun",
value: function(f, o) {
var i, a, n, s, t, l, d = f.samples || [],
r = d.length,
h = 12 + 16 * r,
u = new Uint8Array(h);
for (o += 8 + h, u.set([0, 0, 15, 1, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r, o >>> 24 & 255, o >>> 16 & 255, o >>> 8 & 255, 255 & o], 0), i = 0; r > i; i++) a = d[i], n = a.duration, s = a.size, t = a.flags, l = a.cts, u.set([n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, t.isLeading << 2 | t.dependsOn, t.isDependedOn << 6 | t.hasRedundancy << 4 | t.paddingValue << 1 | t.isNonSync, 61440 & t.degradPrio, 15 & t.degradPrio, l >>> 24 & 255, l >>> 16 & 255, l >>> 8 & 255, 255 & l], 12 + 16 * i);
return e.box(e.types.trun, u)
}
}, {
key: "initSegment",
value: function(i) {
e.types || e.init();
var t, r = e.moov(i);
return t = new Uint8Array(e.FTYP.byteLength + r.byteLength), t.set(e.FTYP), t.set(r, e.FTYP.byteLength), t
}
}]), e
}();
e.default = i
}, {}],
36: [function(r, g, s) {
"use strict";
function n(e) {
return e && e.__esModule ? e : {
default: e
}
}
function h(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(s, "__esModule", {
value: !0
});
var l = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
u = r(27),
a = n(u),
d = r(26),
t = n(d),
e = r(43),
f = r(35),
i = n(f),
o = r(24);
r(44);
var c = function() {
function r(e, t, i) {
h(this, r), this.observer = e, this.id = t, this.config = i, this.ISGenerated = !1, this.PES2MP4SCALEFACTOR = 4, this.PES_TIMESCALE = 9e4, this.MP4_TIMESCALE = this.PES_TIMESCALE / this.PES2MP4SCALEFACTOR
}
return l(r, [{
key: "destroy",
value: function() {}
}, {
key: "insertDiscontinuity",
value: function() {
this._initPTS = this._initDTS = void 0
}
}, {
key: "switchLevel",
value: function() {
this.ISGenerated = !1
}
}, {
key: "remux",
value: function(h, d, r, i, l, o, e, a) {
if (this.level = h, this.sn = d, this.ISGenerated || this.generateIS(r, i, e), this.ISGenerated)
if (r.samples.length) {
var s = this.remuxAudio(r, e, a);
if (i.samples.length) {
var u = void 0;
s && (u = s.endPTS - s.startPTS), this.remuxVideo(i, e, a, u)
}
} else {
var n = void 0;
i.samples.length && (n = this.remuxVideo(i, e, a)), n && r.codec && this.remuxEmptyAudio(r, e, a, n)
}
l.samples.length && this.remuxID3(l, e), o.samples.length && this.remuxText(o, e), this.observer.trigger(t.default.FRAG_PARSED, {
id: this.id,
level: this.level,
sn: this.sn
})
}
}, {
key: "generateIS",
value: function(r, a, f) {
var n, s, c = this.observer,
g = r.samples,
d = a.samples,
h = this.PES_TIMESCALE,
l = {},
v = {
id: this.id,
level: this.level,
sn: this.sn,
tracks: l,
unique: !1
},
u = void 0 === this._initPTS;
u && (n = s = 1 / 0), r.config && g.length && (r.timescale = r.audiosamplerate, r.timescale * r.duration > Math.pow(2, 32) && ! function() {
var e = function r(t, e) {
return e ? r(e, t % e) : t
};
r.timescale = r.audiosamplerate / e(r.audiosamplerate, 1024)
}(), e.logger.log("audio mp4 timescale :" + r.timescale), l.audio = {
container: "audio/mp4",
codec: r.codec,
initSegment: i.default.initSegment([r]),
metadata: {
channelCount: r.channelCount
}
}, u && (n = s = g[0].pts - h * f)), a.sps && a.pps && d.length && (a.timescale = this.MP4_TIMESCALE, l.video = {
container: "video/mp4",
codec: a.codec,
initSegment: i.default.initSegment([a]),
metadata: {
width: a.width,
height: a.height
}
}, u && (n = Math.min(n, d[0].pts - h * f), s = Math.min(s, d[0].dts - h * f))), Object.keys(l).length ? (c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT, v), this.ISGenerated = !0, u && (this._initPTS = n, this._initDTS = s)) : c.trigger(t.default.ERROR, {
type: o.ErrorTypes.MEDIA_ERROR,
id: this.id,
details: o.ErrorDetails.FRAG_PARSING_ERROR,
fatal: !1,
reason: "no audio/video samples found"
})
}
}, {
key: "remuxVideo",
value: function(s, B, w, M) {
var r, v, C, g, l, H, _, R, E = 8,
f = this.PES_TIMESCALE,
n = this.PES2MP4SCALEFACTOR,
a = s.samples,
p = [],
u = void 0;
u = w ? this.nextAvcDts : B * f;
var y = a[0];
l = Math.max(this._PTSNormalize(y.dts - this._initDTS, u), 0), g = Math.max(this._PTSNormalize(y.pts - this._initDTS, u), 0);
var c = Math.round((l - u) / 90);
w && c && (c > 1 ? e.logger.log("AVC:" + c + " ms hole between fragments detected,filling it") : -1 > c && e.logger.log("AVC:" + -c + " ms overlapping between fragments detected"), l = u, a[0].dts = l + this._initDTS, g = Math.max(g - c, u), a[0].pts = g + this._initDTS, e.logger.log("Video/PTS/DTS adjusted: " + g + "/" + l + ",delta:" + c)), H = l, y = a[a.length - 1], R = Math.max(this._PTSNormalize(y.dts - this._initDTS, u), 0), _ = Math.max(this._PTSNormalize(y.pts - this._initDTS, u), 0), _ = Math.max(_, R);
var F = navigator.vendor,
I = navigator.userAgent,
L = F && F.indexOf("Apple") > -1 && I && !I.match("CriOS");
L && (r = Math.round((R - l) / (n * (a.length - 1))));
for (var b = 0; b < a.length; b++) {
var d = a[b];
L ? d.dts = l + b * n * r : (d.dts = Math.max(this._PTSNormalize(d.dts - this._initDTS, u), l), d.dts = Math.round(d.dts / n) * n), d.pts = Math.max(this._PTSNormalize(d.pts - this._initDTS, u), d.dts), d.pts = Math.round(d.pts / n) * n
}
v = new Uint8Array(s.len + 4 * s.nbNalu + 8);
var D = new DataView(v.buffer);
D.setUint32(0, v.byteLength), v.set(i.default.types.mdat, 4);
for (var h = 0; h < a.length; h++) {
for (var o = a[h], P = 0, T = void 0; o.units.units.length;) {
var m = o.units.units.shift();
D.setUint32(E, m.data.byteLength), E += 4, v.set(m.data, E), E += m.data.byteLength, P += 4 + m.data.byteLength
}
if (L) T = Math.max(0, r * Math.round((o.pts - o.dts) / (n * r)));
else {
if (h < a.length - 1) r = a[h + 1].dts - o.dts;
else {
var S = this.config,
k = o.dts - a[h > 0 ? h - 1 : h].dts;
if (S.stretchShortVideoTrack) {
var x = S.maxBufferHole,
U = S.maxSeekHole,
G = Math.floor(Math.min(x, U) * f),
A = (M ? g + M * f : this.nextAacPts) - o.pts;
A > G ? (r = A - k, 0 > r && (r = k), e.logger.log("It is approximately " + A / 90 + " ms to the next segment; using duration " + r / 90 + " ms for the last video frame.")) : r = k
} else r = k
}
r /= n, T = Math.round((o.pts - o.dts) / n)
}
p.push({
size: P,
duration: r,
cts: T,
flags: {
isLeading: 0,
isDependedOn: 0,
hasRedundancy: 0,
degradPrio: 0,
dependsOn: o.key ? 2 : 1,
isNonSync: o.key ? 0 : 1
}
})
}
this.nextAvcDts = R + r * n;
var j = s.dropped;
if (s.len = 0, s.nbNalu = 0, s.dropped = 0, p.length && navigator.userAgent.toLowerCase().indexOf("chrome") > -1) {
var O = p[0].flags;
O.dependsOn = 2, O.isNonSync = 0
}
s.samples = p, C = i.default.moof(s.sequenceNumber++, l / n, s), s.samples = [];
var N = {
id: this.id,
level: this.level,
sn: this.sn,
data1: C,
data2: v,
startPTS: g / f,
endPTS: (_ + n * r) / f,
startDTS: l / f,
endDTS: this.nextAvcDts / f,
type: "video",
nb: p.length,
dropped: j
};
return this.observer.trigger(t.default.FRAG_PARSING_DATA, N), N
}
}, {
key: "remuxAudio",
value: function(r, j, G) {
var N, A, p, g, c, x, U, C, E, w, P, d, v, n, y, f = this.PES_TIMESCALE,
H = r.timescale,
k = f / H,
B = 1024 * r.timescale / r.audiosamplerate,
T = 8,
R = [],
u = [];
r.samples.sort(function(e, t) {
return e.pts - t.pts
}), u = r.samples;
for (var l = G ? this.nextAacPts : j * f, o = B * k, S = l, s = 0; s < u.length;) {
var h = u[s],
M = this._PTSNormalize(h.pts - this._initDTS, l),
m = M - S;
if (-.5 * o > m) e.logger.log("Dropping frame due to " + Math.round(Math.abs(m / 90)) + " ms overlap."), u.splice(s, 1), r.len -= h.unit.length;
else if (m > .5 * o) {
var D = Math.round(m / o);
e.logger.log("Injecting " + D + " frame" + (D > 1 ? "s" : "") + " of missing audio due to " + Math.round(m / 90) + " ms gap.");
for (var I = 0; D > I; I++) y = h.pts - (D - I) * o, y = Math.max(y, this._initDTS), n = a.default.getSilentFrame(r.channelCount), n || (e.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."), n = h.unit.slice(0)), u.splice(s, 0, {
unit: n,
pts: y,
dts: y
}), r.len += n.length, s += 1;
h.pts = u[s - 1].pts + o, S = this._PTSNormalize(h.pts + o - this._initDTS, l), s += 1
} else Math.abs(m) > .1 * o && e.logger.log("Invalid frame delta " + Math.round(M - S + o) + " at PTS " + Math.round(M / 90) + " (should be " + Math.round(o) + ")."), S += o, 0 === s ? h.pts = this._initDTS + l : h.pts = u[s - 1].pts + o, s += 1
}
for (; u.length;) {
if (A = u.shift(), g = A.unit, w = A.pts - this._initDTS, P = A.dts - this._initDTS, void 0 !== E) d = this._PTSNormalize(w, E), v = this._PTSNormalize(P, E), p.duration = Math.round((v - E) / k);
else {
d = this._PTSNormalize(w, l), v = this._PTSNormalize(P, l);
var _ = Math.round(1e3 * (d - l) / f),
b = 0;
if (G && _) {
if (_ > 0) b = Math.round((d - l) / o), e.logger.log(_ + " ms hole between AAC samples detected,filling it"), b > 0 && (n = a.default.getSilentFrame(r.channelCount), n || (n = g.slice(0)), r.len += b * n.length);
else if (-12 > _) {
e.logger.log(-_ + " ms overlapping between AAC samples detected, drop frame"), r.len -= g.byteLength;
continue
}
d = v = l
}
if (U = Math.max(0, d), C = Math.max(0, v), !(r.len > 0)) return;
for (c = new Uint8Array(r.len + 8), N = new DataView(c.buffer), N.setUint32(0, c.byteLength), c.set(i.default.types.mdat, 4), s = 0; b > s; s++) y = d - (b - s) * o, n = a.default.getSilentFrame(r.channelCount), n || (e.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."), n = g.slice(0)), c.set(n, T), T += n.byteLength, p = {
size: n.byteLength,
cts: 0,
duration: 1024,
flags: {
isLeading: 0,
isDependedOn: 0,
hasRedundancy: 0,
degradPrio: 0,
dependsOn: 1
}
}, R.push(p)
}
c.set(g, T), T += g.byteLength, p = {
size: g.byteLength,
cts: 0,
duration: 0,
flags: {
isLeading: 0,
isDependedOn: 0,
hasRedundancy: 0,
degradPrio: 0,
dependsOn: 1
}
}, R.push(p), E = v
}
var O = 0,
L = R.length;
if (L >= 2 && (O = R[L - 2].duration, p.duration = O), L) {
this.nextAacPts = d + k * O, r.len = 0, r.samples = R, x = i.default.moof(r.sequenceNumber++, C / k, r), r.samples = [];
var F = {
id: this.id,
level: this.level,
sn: this.sn,
data1: x,
data2: c,
startPTS: U / f,
endPTS: this.nextAacPts / f,
startDTS: C / f,
endDTS: (v + k * O) / f,
type: "audio",
nb: L
};
return this.observer.trigger(t.default.FRAG_PARSING_DATA, F), F
}
return null
}
}, {
key: "remuxEmptyAudio",
value: function(t, f, p, l) {
var i = this.PES_TIMESCALE,
v = t.timescale ? t.timescale : t.audiosamplerate,
g = i / v,
u = l.startDTS * i + this._initDTS,
y = l.endDTS * i + this._initDTS,
h = 1024,
d = g * h,
c = Math.ceil((y - u) / d),
n = a.default.getSilentFrame(t.channelCount);
if (!n) return void e.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");
for (var o = [], r = 0; c > r; r++) {
var s = u + r * d;
o.push({
unit: n.slice(0),
pts: s,
dts: s
}), t.len += n.length
}
t.samples = o, this.remuxAudio(t, f, p)
}
}, {
key: "remuxID3",
value: function(r, a) {
var e, n = r.samples.length;
if (n) {
for (var i = 0; n > i; i++) e = r.samples[i], e.pts = (e.pts - this._initPTS) / this.PES_TIMESCALE, e.dts = (e.dts - this._initDTS) / this.PES_TIMESCALE;
this.observer.trigger(t.default.FRAG_PARSING_METADATA, {
id: this.id,
level: this.level,
sn: this.sn,
samples: r.samples
})
}
r.samples = [], a = a
}
}, {
key: "remuxText",
value: function(e, a) {
e.samples.sort(function(e, t) {
return e.pts - t.pts
});
var r, n = e.samples.length;
if (n) {
for (var i = 0; n > i; i++) r = e.samples[i], r.pts = (r.pts - this._initPTS) / this.PES_TIMESCALE;
this.observer.trigger(t.default.FRAG_PARSING_USERDATA, {
id: this.id,
level: this.level,
sn: this.sn,
samples: e.samples
})
}
e.samples = [], a = a
}
}, {
key: "_PTSNormalize",
value: function(e, t) {
var r;
if (void 0 === t) return e;
for (r = e > t ? -8589934592 : 8589934592; Math.abs(e - t) > 4294967296;) e += r;
return e
}
}, {
key: "passthrough",
get: function() {
return !1
}
}]), r
}();
s.default = c
}, {
24: 24,
26: 26,
27: 27,
35: 35,
43: 43,
44: 44
}],
37: [function(r, l, e) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var n = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
s = r(26),
t = i(s),
o = function() {
function e(t, r) {
a(this, e), this.observer = t, this.id = r, this.ISGenerated = !1
}
return n(e, [{
key: "destroy",
value: function() {}
}, {
key: "insertDiscontinuity",
value: function() {}
}, {
key: "switchLevel",
value: function() {
this.ISGenerated = !1
}
}, {
key: "remux",
value: function(o, s, h, d, a, u) {
var n = this.observer;
if (!this.ISGenerated) {
var l = {},
i = {
id: this.id,
tracks: l,
unique: !0
},
e = s,
r = e.codec;
r && (i.tracks.video = {
container: e.container,
codec: r,
metadata: {
width: e.width,
height: e.height
}
}), e = o, r = e.codec, r && (i.tracks.audio = {
container: e.container,
codec: r,
metadata: {
channelCount: e.channelCount
}
}), this.ISGenerated = !0, n.trigger(t.default.FRAG_PARSING_INIT_SEGMENT, i)
}
n.trigger(t.default.FRAG_PARSING_DATA, {
id: this.id,
data1: u,
startPTS: a,
startDTS: a,
type: "audiovideo",
nb: 1,
dropped: 0
})
}
}, {
key: "passthrough",
get: function() {
return !0
}
}]), e
}();
e.default = o
}, {
26: 26
}],
38: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e(r) {
t(this, e), "string" == typeof r && (r = e.parseAttrList(r));
for (var i in r) r.hasOwnProperty(i) && (this[i] = r[i])
}
return r(e, [{
key: "decimalInteger",
value: function(t) {
var e = parseInt(this[t], 10);
return e > Number.MAX_SAFE_INTEGER ? 1 / 0 : e
}
}, {
key: "hexadecimalInteger",
value: function(r) {
if (this[r]) {
var e = (this[r] || "0x").slice(2);
e = (1 & e.length ? "0" : "") + e;
for (var i = new Uint8Array(e.length / 2), t = 0; t < e.length / 2; t++) i[t] = parseInt(e.slice(2 * t, 2 * t + 2), 16);
return i
}
return null
}
}, {
key: "hexadecimalIntegerAsNumber",
value: function(t) {
var e = parseInt(this[t], 16);
return e > Number.MAX_SAFE_INTEGER ? 1 / 0 : e
}
}, {
key: "decimalFloatingPoint",
value: function(e) {
return parseFloat(this[e])
}
}, {
key: "enumeratedString",
value: function(e) {
return this[e]
}
}, {
key: "decimalResolution",
value: function(t) {
var e = /^(\d+)x(\d+)$/.exec(this[t]);
if (null !== e) return {
width: parseInt(e[1], 10),
height: parseInt(e[2], 10)
}
}
}], [{
key: "parseAttrList",
value: function(a) {
for (var t, n = /\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g, r = {}; null !== (t = n.exec(a));) {
var e = t[2],
i = '"';
0 === e.indexOf(i) && e.lastIndexOf(i) === e.length - 1 && (e = e.slice(1, -1)), r[t[1]] = e
}
return r
}
}]), e
}();
e.default = i
}, {}],
39: [function(r, e, i) {
"use strict";
var t = {
search: function(a, s) {
for (var t = 0, r = a.length - 1, e = null, i = null; r >= t;) {
e = (t + r) / 2 | 0, i = a[e];
var n = s(i);
if (n > 0) t = e + 1;
else {
if (!(0 > n)) return i;
r = e - 1
}
}
return null
}
};
e.exports = t
}, {}],
40: [function(_, b, o) {
"use strict";
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(o, "__esModule", {
value: !0
});
var n = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
d = {
42: 225,
92: 233,
94: 237,
95: 243,
96: 250,
123: 231,
124: 247,
125: 209,
126: 241,
127: 9608,
128: 174,
129: 176,
130: 189,
131: 191,
132: 8482,
133: 162,
134: 163,
135: 9834,
136: 224,
137: 32,
138: 232,
139: 226,
140: 234,
141: 238,
142: 244,
143: 251,
144: 193,
145: 201,
146: 211,
147: 218,
148: 220,
149: 252,
150: 8216,
151: 161,
152: 42,
153: 8217,
154: 9473,
155: 169,
156: 8480,
157: 8226,
158: 8220,
159: 8221,
160: 192,
161: 194,
162: 199,
163: 200,
164: 202,
165: 203,
166: 235,
167: 206,
168: 207,
169: 239,
170: 212,
171: 217,
172: 249,
173: 219,
174: 171,
175: 187,
176: 195,
177: 227,
178: 205,
179: 204,
180: 236,
181: 210,
182: 242,
183: 213,
184: 245,
185: 123,
186: 125,
187: 92,
188: 94,
189: 95,
190: 124,
191: 8764,
192: 196,
193: 228,
194: 214,
195: 246,
196: 223,
197: 165,
198: 164,
199: 9475,
200: 197,
201: 229,
202: 216,
203: 248,
204: 9487,
205: 9491,
206: 9495,
207: 9499
},
u = function(e) {
var t = e;
return d.hasOwnProperty(e) && (t = d[e]), String.fromCharCode(t)
},
t = 15,
r = 32,
g = {
17: 1,
18: 3,
21: 5,
22: 7,
23: 9,
16: 11,
19: 12,
20: 14
},
v = {
17: 2,
18: 4,
21: 6,
22: 8,
23: 10,
19: 13,
20: 15
},
f = {
25: 1,
26: 3,
29: 5,
30: 7,
31: 9,
24: 11,
27: 12,
28: 14
},
E = {
25: 2,
26: 4,
29: 6,
30: 8,
31: 10,
27: 13,
28: 15
},
c = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "black", "transparent"],
e = {
verboseFilter: {
DATA: 3,
DEBUG: 3,
INFO: 2,
WARNING: 2,
TEXT: 1,
ERROR: 0
},
time: null,
verboseLevel: 0,
setTime: function(e) {
this.time = e
},
log: function(e, r) {
var t = this.verboseFilter[e];
this.verboseLevel >= t
}
},
i = function(t) {
for (var r = [], e = 0; e < t.length; e++) r.push(t[e].toString(16));
return r
},
h = function() {
function e(t, r, i, n, s) {
a(this, e), this.foreground = t || "white", this.underline = r || !1, this.italics = i || !1, this.background = n || "black", this.flash = s || !1
}
return n(e, [{
key: "reset",
value: function() {
this.foreground = "white", this.underline = !1, this.italics = !1, this.background = "black", this.flash = !1
}
}, {
key: "setStyles",
value: function(r) {
for (var i = ["foreground", "underline", "italics", "background", "flash"], e = 0; e < i.length; e++) {
var t = i[e];
r.hasOwnProperty(t) && (this[t] = r[t])
}
}
}, {
key: "isDefault",
value: function() {
return "white" === this.foreground && !this.underline && !this.italics && "black" === this.background && !this.flash
}
}, {
key: "equals",
value: function(e) {
return this.foreground === e.foreground && this.underline === e.underline && this.italics === e.italics && this.background === e.background && this.flash === e.flash
}
}, {
key: "copy",
value: function(e) {
this.foreground = e.foreground, this.underline = e.underline, this.italics = e.italics, this.background = e.background, this.flash = e.flash
}
}, {
key: "toString",
value: function() {
return "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this.italics + ", background=" + this.background + ", flash=" + this.flash
}
}]), e
}(),
y = function() {
function e(t, r, i, n, s, o) {
a(this, e), this.uchar = t || " ", this.penState = new h(r, i, n, s, o)
}
return n(e, [{
key: "reset",
value: function() {
this.uchar = " ", this.penState.reset()
}
}, {
key: "setChar",
value: function(e, t) {
this.uchar = e, this.penState.copy(t)
}
}, {
key: "setPenState",
value: function(e) {
this.penState.copy(e)
}
}, {
key: "equals",
value: function(e) {
return this.uchar === e.uchar && this.penState.equals(e.penState)
}
}, {
key: "copy",
value: function(e) {
this.uchar = e.uchar, this.penState.copy(e.penState)
}
}, {
key: "isEmpty",
value: function() {
return " " === this.uchar && this.penState.isDefault()
}
}]), e
}(),
m = function() {
function t() {
a(this, t), this.chars = [];
for (var e = 0; r > e; e++) this.chars.push(new y);
this.pos = 0, this.currPenState = new h
}
return n(t, [{
key: "equals",
value: function(i) {
for (var t = !0, e = 0; r > e; e++)
if (!this.chars[e].equals(i.chars[e])) {
t = !1;
break
}
return t
}
}, {
key: "copy",
value: function(t) {
for (var e = 0; r > e; e++) this.chars[e].copy(t.chars[e])
}
}, {
key: "isEmpty",
value: function() {
for (var t = !0, e = 0; r > e; e++)
if (!this.chars[e].isEmpty()) {
t = !1;
break
}
return t
}
}, {
key: "setCursor",
value: function(t) {
this.pos !== t && (this.pos = t), this.pos < 0 ? (e.log("ERROR", "Negative cursor position " + this.pos), this.pos = 0) : this.pos > r && (e.log("ERROR", "Too large cursor position " + this.pos), this.pos = r)
}
}, {
key: "moveCursor",
value: function(t) {
var r = this.pos + t;
if (t > 1)
for (var e = this.pos + 1; r + 1 > e; e++) this.chars[e].setPenState(this.currPenState);
this.setCursor(r)
}
}, {
key: "backSpace",
value: function() {
this.moveCursor(-1), this.chars[this.pos].setChar(" ", this.currPenState)
}
}, {
key: "insertChar",
value: function(t) {
t >= 144 && this.backSpace();
var i = u(t);
return this.pos >= r ? void e.log("ERROR", "Cannot insert " + t.toString(16) + " (" + i + ") at position " + this.pos + ". Skipping it!") : (this.chars[this.pos].setChar(i, this.currPenState), void this.moveCursor(1))
}
}, {
key: "clearFromPos",
value: function(t) {
var e;
for (e = t; r > e; e++) this.chars[e].reset()
}
}, {
key: "clear",
value: function() {
this.clearFromPos(0), this.pos = 0, this.currPenState.reset()
}
}, {
key: "clearToEndOfRow",
value: function() {
this.clearFromPos(this.pos)
}
}, {
key: "getTextString",
value: function() {
for (var t = [], i = !0, e = 0; r > e; e++) {
var a = this.chars[e].uchar;
" " !== a && (i = !1), t.push(a)
}
return i ? "" : t.join("")
}
}, {
key: "setPenStyles",
value: function(e) {
this.currPenState.setStyles(e);
var t = this.chars[this.pos];
t.setPenState(this.currPenState)
}
}]), t
}(),
s = function() {
function r() {
a(this, r), this.rows = [];
for (var e = 0; t > e; e++) this.rows.push(new m);
this.currRow = t - 1, this.nrRollUpRows = null, this.reset()
}
return n(r, [{
key: "reset",
value: function() {
for (var e = 0; t > e; e++) this.rows[e].clear();
this.currRow = t - 1
}
}, {
key: "equals",
value: function(i) {
for (var r = !0, e = 0; t > e; e++)
if (!this.rows[e].equals(i.rows[e])) {
r = !1;
break
}
return r
}
}, {
key: "copy",
value: function(r) {
for (var e = 0; t > e; e++) this.rows[e].copy(r.rows[e])
}
}, {
key: "isEmpty",
value: function() {
for (var r = !0, e = 0; t > e; e++)
if (!this.rows[e].isEmpty()) {
r = !1;
break
}
return r
}
}, {
key: "backSpace",
value: function() {
var e = this.rows[this.currRow];
e.backSpace()
}
}, {
key: "clearToEndOfRow",
value: function() {
var e = this.rows[this.currRow];
e.clearToEndOfRow()
}
}, {
key: "insertChar",
value: function(e) {
var t = this.rows[this.currRow];
t.insertChar(e)
}
}, {
key: "setPen",
value: function(e) {
var t = this.rows[this.currRow];
t.setPenStyles(e)
}
}, {
key: "moveCursor",
value: function(e) {
var t = this.rows[this.currRow];
t.moveCursor(e)
}
}, {
key: "setCursor",
value: function(t) {
e.log("INFO", "setCursor: " + t);
var r = this.rows[this.currRow];
r.setCursor(t)
}
}, {
key: "setPAC",
value: function(t) {
e.log("INFO", "pacData = " + JSON.stringify(t));
var r = t.row - 1;
this.nrRollUpRows && r < this.nrRollUpRows - 1 && (r = this.nrRollUpRows - 1), this.currRow = r;
var i = this.rows[this.currRow];
if (null !== t.indent) {
var a = t.indent,
n = Math.max(a - 1, 0);
i.setCursor(t.indent), t.color = i.chars[n].penState.foreground
}
var s = {
foreground: t.color,
underline: t.underline,
italics: t.italics,
background: "black",
flash: !1
};
this.setPen(s)
}
}, {
key: "setBkgData",
value: function(t) {
e.log("INFO", "bkgData = " + JSON.stringify(t)), this.backSpace(), this.setPen(t), this.insertChar(32)
}
}, {
key: "setRollUpRows",
value: function(e) {
this.nrRollUpRows = e
}
}, {
key: "rollUp",
value: function() {
if (null === this.nrRollUpRows) return void e.log("DEBUG", "roll_up but nrRollUpRows not set yet");
e.log("TEXT", this.getDisplayText());
var r = this.currRow + 1 - this.nrRollUpRows,
t = this.rows.splice(r, 1)[0];
t.clear(), this.rows.splice(this.currRow, 0, t), e.log("INFO", "Rolling up")
}
}, {
key: "getDisplayText",
value: function(r) {
r = r || !1;
for (var e = [], n = "", s = -1, i = 0; t > i; i++) {
var a = this.rows[i].getTextString();
a && (s = i + 1, r ? e.push("Row " + s + ": '" + a + "'") : e.push(a.trim()))
}
return e.length > 0 && (n = r ? "[" + e.join(" | ") + "]" : e.join("\n")), n
}
}, {
key: "getTextAndFormat",
value: function() {
return this.rows
}
}]), r
}(),
l = function() {
function r(e, i) {
a(this, r), this.chNr = e, this.outputFilter = i, this.mode = null, this.verbose = 0, this.displayedMemory = new s, this.nonDisplayedMemory = new s, this.lastOutputScreen = new s, this.currRollUpRow = this.displayedMemory.rows[t - 1], this.writeScreen = this.displayedMemory, this.mode = null, this.cueStartTime = null
}
return n(r, [{
key: "reset",
value: function() {
this.mode = null, this.displayedMemory.reset(), this.nonDisplayedMemory.reset(), this.lastOutputScreen.reset(), this.currRollUpRow = this.displayedMemory.rows[t - 1], this.writeScreen = this.displayedMemory, this.mode = null, this.cueStartTime = null, this.lastCueEndTime = null
}
}, {
key: "getHandler",
value: function() {
return this.outputFilter
}
}, {
key: "setHandler",
value: function(e) {
this.outputFilter = e
}
}, {
key: "setPAC",
value: function(e) {
this.writeScreen.setPAC(e)
}
}, {
key: "setBkgData",
value: function(e) {
this.writeScreen.setBkgData(e)
}
}, {
key: "setMode",
value: function(t) {
t !== this.mode && (this.mode = t, e.log("INFO", "MODE=" + t), "MODE_POP-ON" === this.mode ? this.writeScreen = this.nonDisplayedMemory : (this.writeScreen = this.displayedMemory, this.writeScreen.reset()), "MODE_ROLL-UP" !== this.mode && (this.displayedMemory.nrRollUpRows = null, this.nonDisplayedMemory.nrRollUpRows = null), this.mode = t)
}
}, {
key: "insertChars",
value: function(r) {
for (var t = 0; t < r.length; t++) this.writeScreen.insertChar(r[t]);
var i = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP";
e.log("INFO", i + ": " + this.writeScreen.getDisplayText(!0)), "MODE_PAINT-ON" !== this.mode && "MODE_ROLL-UP" !== this.mode || (e.log("TEXT", "DISPLAYED: " + this.displayedMemory.getDisplayText(!0)), this.outputDataUpdate())
}
}, {
key: "ccRCL",
value: function() {
e.log("INFO", "RCL - Resume Caption Loading"), this.setMode("MODE_POP-ON")
}
}, {
key: "ccBS",
value: function() {
e.log("INFO", "BS - BackSpace"), "MODE_TEXT" !== this.mode && (this.writeScreen.backSpace(), this.writeScreen === this.displayedMemory && this.outputDataUpdate())
}
}, {
key: "ccAOF",
value: function() {}
}, {
key: "ccAON",
value: function() {}
}, {
key: "ccDER",
value: function() {
e.log("INFO", "DER- Delete to End of Row"), this.writeScreen.clearToEndOfRow(), this.outputDataUpdate()
}
}, {
key: "ccRU",
value: function(t) {
e.log("INFO", "RU(" + t + ") - Roll Up"), this.writeScreen = this.displayedMemory, this.setMode("MODE_ROLL-UP"), this.writeScreen.setRollUpRows(t)
}
}, {
key: "ccFON",
value: function() {
e.log("INFO", "FON - Flash On"), this.writeScreen.setPen({
flash: !0
})
}
}, {
key: "ccRDC",
value: function() {
e.log("INFO", "RDC - Resume Direct Captioning"), this.setMode("MODE_PAINT-ON")
}
}, {
key: "ccTR",
value: function() {
e.log("INFO", "TR"), this.setMode("MODE_TEXT")
}
}, {
key: "ccRTD",
value: function() {
e.log("INFO", "RTD"), this.setMode("MODE_TEXT")
}
}, {
key: "ccEDM",
value: function() {
e.log("INFO", "EDM - Erase Displayed Memory"), this.displayedMemory.reset(), this.outputDataUpdate()
}
}, {
key: "ccCR",
value: function() {
e.log("CR - Carriage Return"), this.writeScreen.rollUp(), this.outputDataUpdate()
}
}, {
key: "ccENM",
value: function() {
e.log("INFO", "ENM - Erase Non-displayed Memory"), this.nonDisplayedMemory.reset()
}
}, {
key: "ccEOC",
value: function() {
if (e.log("INFO", "EOC - End Of Caption"), "MODE_POP-ON" === this.mode) {
var t = this.displayedMemory;
this.displayedMemory = this.nonDisplayedMemory, this.nonDisplayedMemory = t, this.writeScreen = this.nonDisplayedMemory, e.log("TEXT", "DISP: " + this.displayedMemory.getDisplayText())
}
this.outputDataUpdate()
}
}, {
key: "ccTO",
value: function(t) {
e.log("INFO", "TO(" + t + ") - Tab Offset"), this.writeScreen.moveCursor(t)
}
}, {
key: "ccMIDROW",
value: function(r) {
var t = {
flash: !1
};
if (t.underline = r % 2 === 1, t.italics = r >= 46, t.italics) t.foreground = "white";
else {
var i = Math.floor(r / 2) - 16,
a = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"];
t.foreground = a[i]
}
e.log("INFO", "MIDROW: " + JSON.stringify(t)), this.writeScreen.setPen(t)
}
}, {
key: "outputDataUpdate",
value: function() {
var t = e.time;
null !== t && this.outputFilter && (this.outputFilter.updateData && this.outputFilter.updateData(t, this.displayedMemory), null !== this.cueStartTime || this.displayedMemory.isEmpty() ? this.displayedMemory.equals(this.lastOutputScreen) || (this.outputFilter.newCue && this.outputFilter.newCue(this.cueStartTime, t, this.lastOutputScreen), this.cueStartTime = this.displayedMemory.isEmpty() ? null : t) : this.cueStartTime = t, this.lastOutputScreen.copy(this.displayedMemory))
}
}, {
key: "cueSplitAtTime",
value: function(e) {
this.outputFilter && (this.displayedMemory.isEmpty() || (this.outputFilter.newCue && this.outputFilter.newCue(this.cueStartTime, e, this.displayedMemory), this.cueStartTime = e))
}
}]), r
}(),
p = function() {
function t(i, e, r) {
a(this, t), this.field = i || 1, this.outputs = [e, r], this.channels = [new l(1, e), new l(2, r)], this.currChNr = -1, this.lastCmdA = null, this.lastCmdB = null, this.bufferedData = [], this.startTime = null, this.lastTime = null, this.dataCounters = {
padding: 0,
char: 0,
cmd: 0,
other: 0
}
}
return n(t, [{
key: "getHandler",
value: function(e) {
return this.channels[e].getHandler()
}
}, {
key: "setHandler",
value: function(e, t) {
this.channels[e].setHandler(t)
}
}, {
key: "addData",
value: function(l, s) {
var t, r, a, o = !1;
this.lastTime = l, e.setTime(l);
for (var n = 0; n < s.length; n += 2)
if (r = 127 & s[n], a = 127 & s[n + 1], 0 !== r || 0 !== a) {
if (e.log("DATA", "[" + i([s[n], s[n + 1]]) + "] -> (" + i([r, a]) + ")"), t = this.parseCmd(r, a), t || (t = this.parseMidrow(r, a)), t || (t = this.parsePAC(r, a)), t || (t = this.parseBackgroundAttributes(r, a)), !t && (o = this.parseChars(r, a)))
if (this.currChNr && this.currChNr >= 0) {
var u = this.channels[this.currChNr - 1];
u.insertChars(o)
} else e.log("WARNING", "No channel found yet. TEXT-MODE?");
t ? this.dataCounters.cmd += 2 : o ? this.dataCounters.char += 2 : (this.dataCounters.other += 2, e.log("WARNING", "Couldn't parse cleaned data " + i([r, a]) + " orig: " + i([s[n], s[n + 1]])))
} else this.dataCounters.padding += 2
}
}, {
key: "parseCmd",
value: function(a, t) {
var n = null,
s = (20 === a || 28 === a) && t >= 32 && 47 >= t,
o = (23 === a || 31 === a) && t >= 33 && 35 >= t;
if (!s && !o) return !1;
if (a === this.lastCmdA && t === this.lastCmdB) return this.lastCmdA = null, this.lastCmdB = null, e.log("DEBUG", "Repeated command (" + i([a, t]) + ") is dropped"), !0;
n = 20 === a || 23 === a ? 1 : 2;
var r = this.channels[n - 1];
return 20 === a || 28 === a ? 32 === t ? r.ccRCL() : 33 === t ? r.ccBS() : 34 === t ? r.ccAOF() : 35 === t ? r.ccAON() : 36 === t ? r.ccDER() : 37 === t ? r.ccRU(2) : 38 === t ? r.ccRU(3) : 39 === t ? r.ccRU(4) : 40 === t ? r.ccFON() : 41 === t ? r.ccRDC() : 42 === t ? r.ccTR() : 43 === t ? r.ccRTD() : 44 === t ? r.ccEDM() : 45 === t ? r.ccCR() : 46 === t ? r.ccENM() : 47 === t && r.ccEOC() : r.ccTO(t - 32), this.lastCmdA = a, this.lastCmdB = t, this.currChNr = n, !0
}
}, {
key: "parseMidrow",
value: function(t, r) {
var a = null;
if ((17 === t || 25 === t) && r >= 32 && 47 >= r) {
if (a = 17 === t ? 1 : 2, a !== this.currChNr) return e.log("ERROR", "Mismatch channel in midrow parsing"), !1;
var n = this.channels[a - 1];
return n.ccMIDROW(r), e.log("DEBUG", "MIDROW (" + i([t, r]) + ")"), !0
}
return !1
}
}, {
key: "parsePAC",
value: function(e, t) {
var r = null,
i = null,
a = (e >= 17 && 23 >= e || e >= 25 && 31 >= e) && t >= 64 && 127 >= t,
n = (16 === e || 24 === e) && t >= 64 && 95 >= t;
if (!a && !n) return !1;
if (e === this.lastCmdA && t === this.lastCmdB) return this.lastCmdA = null, this.lastCmdB = null, !0;
r = 23 >= e ? 1 : 2, i = t >= 64 && 95 >= t ? 1 === r ? g[e] : f[e] : 1 === r ? v[e] : E[e];
var s = this.interpretPAC(i, t),
o = this.channels[r - 1];
return o.setPAC(s), this.lastCmdA = e, this.lastCmdB = t, this.currChNr = r, !0
}
}, {
key: "interpretPAC",
value: function(i, r) {
var e = r,
t = {
color: null,
italics: !1,
indent: null,
underline: !1,
row: i
};
return e = r > 95 ? r - 96 : r - 64, t.underline = 1 === (1 & e), 13 >= e ? t.color = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "white"][Math.floor(e / 2)] : 15 >= e ? (t.italics = !0, t.color = "white") : t.indent = 4 * Math.floor((e - 16) / 2), t
}
}, {
key: "parseChars",
value: function(t, r) {
var s = null,
n = null,
a = null;
if (t >= 25 ? (s = 2, a = t - 8) : (s = 1, a = t), a >= 17 && 19 >= a) {
var o = r;
o = 17 === a ? r + 80 : 18 === a ? r + 112 : r + 144, e.log("INFO", "Special char '" + u(o) + "' in channel " + s), n = [o]
} else t >= 32 && 127 >= t && (n = 0 === r ? [t] : [t, r]);
if (n) {
var l = i(n);
e.log("DEBUG", "Char codes = " + l.join(",")), this.lastCmdA = null, this.lastCmdB = null
}
return n
}
}, {
key: "parseBackgroundAttributes",
value: function(r, e) {
var t, i, a, n, s = (16 === r || 24 === r) && e >= 32 && 47 >= e,
o = (23 === r || 31 === r) && e >= 45 && 47 >= e;
return s || o ? (t = {}, 16 === r || 24 === r ? (i = Math.floor((e - 32) / 2), t.background = c[i], e % 2 === 1 && (t.background = t.background + "_semi")) : 45 === e ? t.background = "transparent" : (t.foreground = "black", 47 === e && (t.underline = !0)), a = 24 > r ? 1 : 2, n = this.channels[a - 1], n.setBkgData(t), this.lastCmdA = null, this.lastCmdB = null, !0) : !1
}
}, {
key: "reset",
value: function() {
for (var e = 0; e < this.channels.length; e++) this.channels[e] && this.channels[e].reset();
this.lastCmdA = null, this.lastCmdB = null
}
}, {
key: "cueSplitAtTime",
value: function(t) {
for (var e = 0; e < this.channels.length; e++) this.channels[e] && this.channels[e].cueSplitAtTime(t)
}
}]), t
}();
o.default = p
}, {}],
41: [function(r, e, i) {
"use strict";
var t = {
newCue: function(h, l, d, o) {
for (var i, t, s, r, n, u = window.VTTCue || window.TextTrackCue, e = 0; e < o.rows.length; e++)
if (i = o.rows[e], s = !0, r = 0, n = "", !i.isEmpty()) {
for (var a = 0; a < i.chars.length; a++) i.chars[a].uchar.match(/\s/) && s ? r++ : (n += i.chars[a].uchar, s = !1);
t = new u(l, d, n.trim()), r >= 16 ? r-- : r++, navigator.userAgent.match(/Firefox\//) ? t.line = e + 1 : t.line = e > 7 ? e - 2 : e + 1, t.align = "left", t.position = 100 * (r / 32) + (navigator.userAgent.match(/Firefox\//) ? 50 : 0), h.addCue(t)
}
}
};
e.exports = t
}, {}],
42: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e(r) {
t(this, e), this.alpha_ = r ? Math.exp(Math.log(.5) / r) : 0, this.estimate_ = 0, this.totalWeight_ = 0
}
return r(e, [{
key: "sample",
value: function(e, r) {
var t = Math.pow(this.alpha_, e);
this.estimate_ = r * (1 - t) + t * this.estimate_, this.totalWeight_ += e
}
}, {
key: "getTotalWeight",
value: function() {
return this.totalWeight_
}
}, {
key: "getEstimate",
value: function() {
if (this.alpha_) {
var e = 1 - Math.pow(this.alpha_, this.totalWeight_);
return this.estimate_ / e
}
return this.estimate_
}
}]), e
}();
e.default = i
}, {}],
43: [function(l, u, r) {
"use strict";
function e() {}
function a(t, e) {
return e = "[" + t + "] > " + e
}
function n(t) {
var r = window.console[t];
return r ? function() {
for (var n = arguments.length, e = Array(n), i = 0; n > i; i++) e[i] = arguments[i];
e[0] && (e[0] = a(t, e[0])), r.apply(window.console, e)
} : e
}
function s(r) {
for (var i = arguments.length, a = Array(i > 1 ? i - 1 : 0), e = 1; i > e; e++) a[e - 1] = arguments[e];
a.forEach(function(e) {
t[e] = r[e] ? r[e].bind(r) : n(e)
})
}
Object.defineProperty(r, "__esModule", {
value: !0
});
var o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
return typeof e
} : function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e
},
i = {
trace: e,
debug: e,
log: e,
warn: e,
info: e,
error: e
},
t = i;
r.enableLogs = function(e) {
if (e === !0 || "object" === ("undefined" == typeof e ? "undefined" : o(e))) {
s(e, "debug", "log", "info", "warn", "error");
try {
t.log()
} catch (e) {
t = i
}
} else t = i
}, r.logger = t
}, {}],
44: [function(e, t, r) {
"use strict";
"undefined" == typeof ArrayBuffer || ArrayBuffer.prototype.slice || (ArrayBuffer.prototype.slice = function(r, t) {
var i = new Uint8Array(this);
void 0 === t && (t = i.length);
for (var a = new ArrayBuffer(t - r), n = new Uint8Array(a), e = 0; e < n.length; e++) n[e] = i[e + r];
return a
})
}, {}],
45: [function(a, n, e) {
"use strict";
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var r = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
i = function() {
function e() {
t(this, e)
}
return r(e, null, [{
key: "toString",
value: function(t) {
for (var r = "", i = t.length, e = 0; i > e; e++) r += "[" + t.start(e) + "," + t.end(e) + "]";
return r
}
}]), e
}();
e.default = i
}, {}],
46: [function(r, t, i) {
"use strict";
var e = {
buildAbsoluteURL: function(r, t) {
if (t = t.trim(), /^[a-z]+:/i.test(t)) return t;
var l = null,
o = null,
n = /^([^#]*)(.*)$/.exec(t);
n && (o = n[2], t = n[1]);
var s = /^([^\?]*)(.*)$/.exec(t);
s && (l = s[2], t = s[1]);
var h = /^([^#]*)(.*)$/.exec(r);
h && (r = h[1]);
var u = /^([^\?]*)(.*)$/.exec(r);
u && (r = u[1]);
var i = /^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(r);
if (!i) throw new Error("Error trying to parse base URL.");
var f = i[2] || "",
d = i[1] || "",
c = i[4],
a = null;
return a = /^\/\//.test(t) ? f + "//" + e.buildAbsolutePath("", t.substring(2)) : /^\//.test(t) ? d + "/" + e.buildAbsolutePath("", t.substring(1)) : e.buildAbsolutePath(d + c, t), l && (a += l), o && (a += o), a
},
buildAbsolutePath: function(n, s) {
for (var i, e, o = s, a = "", t = n.replace(/[^\/]*$/, o.replace(/(\/|^)(?:\.?\/+)+/g, "$1")), r = 0; e = t.indexOf("/../", r), e > -1; r = e + i) i = /^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length, a = (a + t.substring(r, e)).replace(new RegExp("(?:\\/+[^\\/]*){0," + (i - 1) / 3 + "}$"), "/");
return a + t.substr(r)
}
};
t.exports = e
}, {}],
47: [function(r, s, t) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(i, r) {
for (var t = 0; t < r.length; t++) {
var e = r[t];
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, e.key, e)
}
}
return function(t, r, i) {
return r && e(t.prototype, r), i && e(t, i), t
}
}(),
e = r(43),
n = function() {
function t(e) {
i(this, t), e && e.xhrSetup && (this.xhrSetup = e.xhrSetup)
}
return a(t, [{
key: "destroy",
value: function() {
this.abort(), this.loader = null
}
}, {
key: "abort",
value: function() {
var e = this.loader;
e && 4 !== e.readyState && (this.stats.aborted = !0, e.abort()), window.clearTimeout(this.requestTimeout), this.requestTimeout = null, window.clearTimeout(this.retryTimeout), this.retryTimeout = null
}
}, {
key: "load",
value: function(t, e, r) {
this.context = t, this.config = e, this.callbacks = r, this.stats = {
trequest: performance.now(),
retry: 0
}, this.retryDelay = e.retryDelay, this.loadInternal()
}
}, {
key: "loadInternal",
value: function() {
var e, t = this.context;
e = "undefined" != typeof XDomainRequest ? this.loader = new XDomainRequest : this.loader = new XMLHttpRequest, e.onloadend = this.loadend.bind(this), e.onprogress = this.loadprogress.bind(this), e.open("GET", t.url, !0), t.rangeEnd && e.setRequestHeader("Range", "bytes=" + t.rangeStart + "-" + (t.rangeEnd - 1)), e.responseType = t.responseType;
var r = this.stats;
r.tfirst = 0, r.loaded = 0, this.xhrSetup && this.xhrSetup(e, t.url), this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout), e.send()
}
}, {
key: "loadend",
value: function(l) {
var i = l.currentTarget,
r = i.status,
t = this.stats,
a = this.context,
o = this.config;
if (!t.aborted)
if (window.clearTimeout(this.requestTimeout), r >= 200 && 300 > r) {
t.tload = Math.max(t.tfirst, performance.now());
var n = void 0,
s = void 0;
"arraybuffer" === a.responseType ? (n = i.response, s = n.byteLength) : (n = i.responseText, s = n.length), t.loaded = t.total = s;
var u = {
url: i.responseURL,
data: n
};
this.callbacks.onSuccess(u, t, a)
} else t.retry >= o.maxRetry || r >= 400 && 499 > r ? (e.logger.error(r + " while loading " + a.url), this.callbacks.onError({
code: r,
text: i.statusText
}, a)) : (e.logger.warn(r + " while loading " + a.url + ", retrying in " + this.retryDelay + "..."), this.destroy(), this.retryTimeout = window.setTimeout(this.loadInternal.bind(this), this.retryDelay), this.retryDelay = Math.min(2 * this.retryDelay, o.maxRetryDelay), t.retry++)
}
}, {
key: "loadtimeout",
value: function() {
e.logger.warn("timeout while loading " + this.context.url), this.callbacks.onTimeout(this.stats, this.context)
}
}, {
key: "loadprogress",
value: function(t) {
var e = this.stats;
0 === e.tfirst && (e.tfirst = Math.max(performance.now(), e.trequest)), e.loaded = t.loaded, t.lengthComputable && (e.total = t.total);
var r = this.callbacks.onProgress;
r && r(e, this.context, null)
}
}]), t
}();
t.default = n
}, {
43: 43
}]
}, {}, [31])(31)
});