Skip to content

Instantly share code, notes, and snippets.

@batFormat
Created January 30, 2021 03:10
Show Gist options
  • Save batFormat/336c6fe65b5515a58af2a3ec05840c00 to your computer and use it in GitHub Desktop.
Save batFormat/336c6fe65b5515a58af2a3ec05840c00 to your computer and use it in GitHub Desktop.
Плеер который написан в Forecast
var storageAvailable,
storageData = {};
function storageAvailable(e) {
try {
var t = window[e],
r = '__storage_test__';
return t.setItem(r, r), t.removeItem(r), !0;
} catch (e) {
return !1;
}
}
function writeStorage(e, t) {
try {
if (storageAvailable) window.localStorage.setItem(e, t);
else {
var r = {
origin: 'Facecast_player',
source_frame: code,
type: 'write_storage',
key: e,
value: t,
};
window.parent.postMessage(JSON.stringify(r), '*');
}
} catch (e) {
console.log(e.toString());
}
}
function readStorage(e) {
var t;
try {
t = storageAvailable ? window.localStorage.getItem(e) : storageData[e];
} catch (e) {
console.log(e.toString());
}
return t;
}
function updateStorageData() {
try {
window.parent.postMessage(
JSON.stringify({
origin: 'Facecast_player',
source_frame: code,
type: 'update_storage',
}),
'*'
),
setTimeout(updateStorageData, 1e3);
} catch (e) {
console.log(e.toString());
}
}
(storageAvailable = storageAvailable('localStorage')) || updateStorageData();
var thumbnailPlayer,
bindThumbnailPlayer,
settingsOpen,
speedSelectOpen,
multicamOn,
chatOpen,
logo_image,
player,
pollResultId,
pollVoteId,
pollWidgetId,
code = window.location.href.substr(
window.location.href.indexOf('/v/') + 3,
6
),
no_animation = 0 <= window.location.href.indexOf('noanimation'),
no_label = 0 <= window.location.href.indexOf('nolabel'),
no_date = 0 <= window.location.href.indexOf('nodate'),
sh_chat = 0 <= window.location.href.indexOf('showchat'),
sh_cnt = 0 <= window.location.href.indexOf('showcnt'),
clappr_debug = 0 <= window.location.href.indexOf('clapprdebug'),
$spinner = $('.LNIframe .waiter'),
prefix = document.location.protocol + '//',
p = {
sid: '',
hc: '',
cdn: 'auto',
player: {},
images: [],
servers_cnt: 0,
chat_cnt: 0,
answ_cnt: 0,
show_live_label: !0,
def_poster: '/f/images/255-preview20.jpg',
logo: !1,
locale: 'ru',
lang: 'ru',
autorun: 'auto',
hideMediaControl: !0,
muted: !1,
startLevel: 3,
live_duration: 10,
delay_switching_to_auto_mode: 5e3,
auth_hb_error_cnt: 0,
poll_hb_delay: 5,
},
url = {
server: {},
media: '',
event: '',
hb: '',
req_cnt: 0,
answ_cnt: 0,
group: 0,
bandwidth: 0,
a: [],
remote_addr: [],
sequence: 0,
},
speedtest = [],
mobileBrowserRegex = /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/;
(p.isMobile = mobileBrowserRegex.test(navigator.userAgent)),
'c0b813' == code &&
(window.location.href = 'http://pro-stream.ru/broadcasts/prasium/'),
'y5hf49' == code && (p.key = 'cstf8ru7'),
'efnr9i' == code && (p.key = 'vvi3ttm6');
try {
(pollResultId = JSON.parse(readStorage('pollResultId')) || []),
(pollVoteId = JSON.parse(readStorage('pollVoteId')) || []),
(pollWidgetId = JSON.parse(readStorage('pollWidgetId')) || []);
} catch (e) {
(pollResultId = []), (pollVoteId = []), (pollWidgetId = []);
}
var isPollOverlayEnabled = !1,
pollRecordResultId = [],
userErr = {
empty: {
name:
'ru' === p.lang
? 'Введите полное имя'
: 'Enter your full name',
email: 'ru' === p.lang ? 'Введите email' : 'Enter your email',
phone:
'ru' === p.lang
? 'Введите телефон'
: 'Enter your phone number',
accept:
'ru' === p.lang
? 'Поставьте галочку'
: 'Check the checkbox',
},
invalid: {
email:
'ru' === p.lang
? 'Введите корректный email'
: 'Enter a valid email',
},
};
try {
p.guid = readStorage('guid');
} catch (e) {
console.log(e);
}
if (!p.guid) {
p.guid = guidGenerator();
try {
writeStorage('guid', p.guid);
} catch (e) {
console.log(e);
}
}
function guidGenerator() {
function e() {
return ((65536 * (1 + Math.random())) | 0).toString(16).substring(1);
}
return e() + e() + '-' + e() + '-' + e() + '-' + e() + '-' + e() + e() + e();
}
function getJsonFromUrl(e) {
var t = (e = e || location.search).lastIndexOf('/');
t && (e = e.substr(t));
var r = e.lastIndexOf('?');
r && (e = e.substr(r));
var n = e.substr(1),
s = {};
return (
n.split('&').forEach(function (e) {
var t = e.split('=');
s[t[0]] = decodeURIComponent(t[1]);
}),
s
);
}
newrelic.setCustomAttribute('uid', p.guid);
var cdn_threshold = 15,
threshold = [8, 14],
servers = [
{
src: 'e10-fd.facecast.net',
data: 0,
event: 0,
delay: 0,
group: 1,
priority: 100,
backup: 0,
},
{
src: 'edge-7.facecast.net',
data: 0,
event: 0,
delay: 0,
group: 2,
priority: 100,
backup: 1,
},
{
src: 'edge-8.facecast.net',
data: 0,
event: 0,
delay: 0,
group: 2,
priority: 100,
backup: 1,
},
{
src: 'edge-9.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 2,
priority: 100,
backup: 0,
},
{
src: 'edge-10.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 2,
priority: 100,
backup: 1,
},
{
src: 'edge-11.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 2,
priority: 100,
backup: 1,
},
{
src: 'edge-12.facecast.net',
data: 0,
event: 0,
delay: 0,
group: 2,
priority: 100,
backup: 1,
},
{
src: 'e10-ll.facecast.net',
data: 0,
event: 0,
delay: 0,
group: 2,
priority: 100,
backup: 1,
},
{
src: 'edge-de-1.facecast.net',
data: 0,
event: 0,
delay: 0,
group: 4,
priority: 100,
backup: 0,
},
{
src: 'edge-de-2.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 4,
priority: 100,
backup: 0,
},
{
src: 'edge-nyc-1.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 5,
priority: 100,
backup: 0,
},
{
src: 'cdn-1.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 101,
priority: 100,
backup: 0,
cdn: 1,
},
{
src: 'cdn-2.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 102,
priority: 100,
backup: 0,
cdn: 1,
},
{
src: 'cdn-3.facecast.net',
data: 1,
event: 1,
delay: 0,
group: 103,
priority: 100,
backup: 0,
cdn: 1,
},
],
auth_hb_servers = [
{ src: 'auth-1.facecast.net' },
{ src: 'auth-2.facecast.net' },
{ src: 'auth-3.facecast.net' },
];
function get_urls() {
return p.src
? (run_player(), void $('.name').fadeOut(2e3))
: (p.srv
? ('.net' !== p.srv.substr(-4) && (p.srv += '.facecast.net'),
speedtest.push({ timeline: 1, src: p.srv, priority: 100 }),
(url.media = p.srv),
(url.event = p.srv),
(url.done = 1),
(url.server = {}),
(url.event_server = {}),
(url.hb = 'edge-aux.facecast.net'),
init_event())
: (get_srv_from_ls(),
window.addEventListener(
'first_edgetest_answer',
on_first_edgetest_asnwer
),
edgetest()),
!0);
}
function get_srv_from_ls() {
if (
(dmesg('Getting fastest server(fastest_srv_ls) from local storage.'),
(p.fastest_srv_ls = readStorage('fastest_srv_ls')),
!p.fastest_srv_ls)
)
return (
dmesg('Fastest server(fastest_srv_ls) not found in local storage.'),
(p.fastest_srv_ls = null),
!1
);
try {
(p.fastest_srv_ls = JSON.parse(p.fastest_srv_ls)),
dmesg(
'Got fastest server(fastest_srv_ls) from local storage: ' +
p.fastest_srv_ls.srv +
'.',
1
);
} catch (e) {
return (
(p.fastest_srv_ls = null),
dmesg('Error parsing fastest_srv_ls. ' + e.toString(), 3),
!1
);
}
if (+Date.now() > +p.fastest_srv_ls.expire)
return (
dmesg('Fastest server(fastest_srv_ls) is expired.'),
(p.fastest_srv_ls = null),
!1
);
var e = servers.filter(function (e) {
return -1 !== e.src.indexOf(p.fastest_srv_ls.srv);
});
if (!e.length)
return (
dmesg(
'Fastest server(fastest_srv_ls) ' +
p.fastest_srv_ls.srv +
' is not found in servers array.'
),
(p.fastest_srv_ls = null),
!1
);
e = e[0];
}
function edgetest() {
return (
(p.edgetest_in_progress = !0),
p.edgetests_cnt++,
dmesg('Starting edgetest #' + p.edgetests_cnt + ' ...'),
(p.edgetest_answ_cnt = 0),
(p.edgetest_req_cnt = 0),
(p.edgetest_pings = []),
(p.edgetest_xhrs_req = []),
(p.edgetest_xhrs_res = []),
(p.first_edgetest_answer = null),
(p.edgetest_timeout_exceeded = !1),
(p.edgetest_done = !1),
servers.forEach(function (e, t) {
(e.id = t),
e.pings || (e.pings = []),
e.ping_avg || (e.ping_avg = 1e4),
e.ping_min || (e.ping_min = 1e4),
(e.event || e.data) && (p.edgetest_req_cnt++, edgetest_send_req(e));
}),
setTimeout(on_edgetest_timeout_exceed, p.edgetest_timeout),
!0
);
}
function edgetest_send_req(n) {
var s = Date.now(),
i = $.ajax({
type: 'GET',
crossDomain: !0,
url: '//' + n.src + '/lb/edgetest.json',
dataType: 'json',
error: function (e, t, r) {
p.edgetest_xhrs_res.push({ src: n.src, xhr: e }), p.edgetest_answ_cnt++;
n.pings.push(1e4),
(n.allow = 0),
calc_ping(n),
0 < +p.edgetest_answ_cnt &&
+p.edgetest_answ_cnt == +p.edgetest_req_cnt &&
on_edgetest_end();
},
success: function (e) {
if (e.allow) {
p.edgetest_answ_cnt++;
var t = Date.now() - s;
if (
(n.pings.push(t),
p.edgetest_pings.push(t),
(n.allow = e.allow),
(n.remote_addr = e.remote_addr),
calc_ping(n),
dmesg(
'Edgetest #' +
p.edgetests_cnt +
' reply from: \t' +
n.src +
', delay ' +
t +
'ms. \tClient ip:' +
e.remote_addr
),
-1 == url.remote_addr.join().search(e.remote_addr) &&
(url.remote_addr.length &&
dmesg(
'Diff IP address for server ' +
n.remote_addr +
' from ' +
n.src,
2
),
p.dont_add_remote_addr || url.remote_addr.push(e.remote_addr)),
p.first_edgetest_answer ||
((p.first_edgetest_answer = n),
window.dispatchEvent(
new CustomEvent('first_edgetest_answer', {
detail: { first_edgetest_answer: p.first_edgetest_answer },
})
)),
p.edgetest_xhrs_res.push({ src: n.src, xhr: i }),
0 < +p.edgetest_answ_cnt &&
+p.edgetest_answ_cnt == +p.edgetest_req_cnt &&
on_edgetest_end(),
url.a[n.group])
)
for (var r = 0; r < speedtest.length; r++)
speedtest[r].group == n.group &&
((0 == n.backup && 1 == speedtest[r].backup) ||
(1 == n.backup && n.id < speedtest[r].id)) &&
(dmesg(
'Reordering speedtest array, ' +
speedtest[r].src +
' -> ' +
n.src
),
(speedtest[r] = n));
else speedtest.push(n);
(url.a[n.group] = 1),
!url.event &&
n.event &&
((url.event_server = n), (url.event = n.src), init_event()),
1 == +p.edgetests_cnt &&
p.fastest_srv_ls &&
-1 !== n.src.indexOf(p.fastest_srv_ls.srv) &&
try_srv_from_ls(n);
} else
p.edgetest_answ_cnt++,
(n.allow = 0),
dmesg('Edgetest deny: ' + n.src, 2),
0 < +p.edgetest_answ_cnt &&
+p.edgetest_answ_cnt == +p.edgetest_req_cnt &&
on_edgetest_end();
},
});
p.edgetest_xhrs_req.push({ src: n.src, xhr: i }),
dmesg('Edgetest #' + p.edgetests_cnt + ' request sent to:\t' + n.src);
}
function calc_ping(e) {
return (
e.pings.length &&
((e.ping_min = +Math.min.apply(Math, e.pings).toFixed(2)),
(e.ping_avg =
e.pings.reduce(function (e, t) {
return e + t;
}) / e.pings.length)),
!0
);
}
function on_first_edgetest_asnwer(e) {
var t = e.detail.first_edgetest_answer;
dmesg('Edgetest #' + p.edgetests_cnt + ' first answer: ' + t.src, 1),
p.edgetest_timeout_exceeded &&
(dmesg('Edgetest #' + p.edgetests_cnt + ' timeout exceeded.', 2),
get_xhrs_unresponsed().forEach(function (e) {
dmesg('Edgetest #' + p.edgetests_cnt + ' abort request: ' + e.src),
e.xhr.abort();
}));
return 2 != +p.edgetests_cnt || p.first_load || first_player_load(t), !0;
}
function try_srv_from_ls(e) {
return (
clearTimeout(window.trySrvFromLSTimeout),
!!p.fastest_srv_ls &&
(p.event
? 6 == +p.event.view_mode_id && e.cdn
? (dmesg(
'fastest_srv_ls: ' +
e.src +
' cannot be used for view_mode_id == 6.',
3
),
(window.trySrvFromLSTimeout = null),
!1)
: -1 !== e.src.indexOf(p.fastest_srv_ls.srv)
? (dmesg(
'Have reply from fastest server(fastest_srv_ls) ' +
p.fastest_srv_ls.srv +
'.',
1
),
dmesg('Switch to fastest_srv_ls: ' + p.fastest_srv_ls.srv + '.', 1),
first_player_load(e),
!(window.trySrvFromLSTimeout = null))
: ((window.trySrvFromLSTimeout = null), !1)
: ((window.trySrvFromLSTimeout = setTimeout(function () {
try_srv_from_ls(e);
}, 100)),
!1))
);
}
function on_edgetest_timeout_exceed() {
if (!p.edgetest_done)
return (
(p.edgetest_timeout_exceeded = !0),
p.first_edgetest_answer &&
(dmesg('Edgetest #' + p.edgetests_cnt + ' timeout exceeded.', 2),
get_xhrs_unresponsed().forEach(function (e) {
dmesg('Edgetest #' + p.edgetests_cnt + ' abort request: ' + e.src),
e.xhr.abort();
})),
!0
);
}
function get_xhrs_unresponsed() {
var t = p.edgetest_xhrs_res.map(function (e) {
return e.src;
});
return p.edgetest_xhrs_req.filter(function (e) {
return -1 === t.indexOf(e.src);
});
}
function on_edgetest_end() {
if (
(clearTimeout(window.onEdgetestEndTimeout),
!p.event || window.trySrvFromLSTimeout)
)
return (window.onEdgetestEndTimeout = setTimeout(on_edgetest_end, 100)), !1;
if (
+p.on_edgetest_end_cnt != +p.edgetests_cnt &&
(p.on_edgetest_end_cnt++,
(p.edgetest_done = !0),
(url.min_ping_avg = 1e5),
(+p.edgetests_cnt > +p.edgetest_heat_cnt ||
(p.first_load && +p.edgetests_cnt == +p.edgetest_heat_cnt)) &&
servers.forEach(function (e) {
e.allow &&
-1 === url.remote_addr.indexOf(e.remote_addr) &&
(e.allow = !1);
}),
(servers = servers.filter(function (e) {
return (
!e.cdn ||
6 != +p.event.view_mode_id ||
(dmesg(
'CDN cannot be used for view_mode_id == 6. Remove ' +
e.src +
' from servers array.'
),
!1)
);
})).forEach(function (e, t) {
e.allow &&
e.ping_avg &&
+e.ping_avg < +url.min_ping_avg &&
((url.min_ping_avg = e.ping_avg),
(url.fastest_avg = t),
e.cdn || (url.hb = e.src));
}),
void 0 !== url.min_ping_avg && void 0 !== url.fastest_avg)
) {
if (
(+p.edgetests_cnt <= +p.edgetest_heat_cnt &&
(dmesg(
'Edgetest #' +
p.edgetests_cnt +
' done. Fastest: ' +
servers[url.fastest_avg].src +
' - ' +
servers[url.fastest_avg].ping_avg +
'ms',
1
),
dmesg('Statistics heartbeat server: ' + url.hb, 1)),
p.first_load &&
p.event &&
(2 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id ||
7 == +p.event.view_mode_id) &&
(p.dont_add_remote_addr = !0),
+p.edgetests_cnt < +p.edgetest_heat_cnt && !p.first_load)
)
return (p.edgetest_in_progress = !1), edgetest(), !0;
if (+p.edgetests_cnt == +p.edgetest_heat_cnt && !p.first_load)
return (
(p.edgetest_in_progress = !1),
first_player_load(servers[url.fastest_avg]),
!0
);
if (
+p.edgetests_cnt > +p.edgetest_heat_cnt ||
(p.first_load && +p.edgetests_cnt == +p.edgetest_heat_cnt)
) {
if (
((p.edgetest_in_progress = !1),
('buffering' !== p.edgetest_trigger && 'xhr' !== p.edgetest_trigger) ||
(dmesg('Starting speedtest...'),
(p.speedtest_seq = 0),
(p.speedtest_in_progress = !1),
speed_test()),
'resolution' === p.edgetest_trigger)
) {
(p.edgetest_pings = p.edgetest_pings
.filter(function (e) {
return +e;
})
.sort(function (e, t) {
return e - t;
})
.filter(function (e, t, r) {
return r.indexOf(e) === t;
})),
1 < p.edgetest_pings.length &&
(p.edgetest_pings = p.edgetest_pings.slice(0, -1));
var e = p.edgetest_pings.reduce(function (e, t) {
return e + t;
}),
t = Math.ceil(e / p.edgetest_pings.length || 0);
dmesg(
p.edge_test_pings +
' ' +
t +
' ' +
p.speedtest_min_ping_resolution_trigger
),
+p.speedtest_min_ping_resolution_trigger > +t
? (dmesg('Starting speedtest'),
(p.speedtest_seq = 0),
(p.speedtest_in_progress = !1),
speed_test())
: afterEdgetestSpeedtest();
}
return !0;
}
p.edgetest_in_progress = !1;
}
}
function first_player_load(e) {
p.first_load ||
((p.first_load = !0),
(p.srv = e.src.split('.')[0]),
(url.server = e),
(url.media = e.src),
(url.done = 1),
firstLoadFastest(),
set_bufferfull_listener(),
set_player_play_intent_listener());
}
function set_bufferfull_listener() {
player && player.core && player.core.getCurrentPlayback()
? player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_BUFFERFULL, buffer_full_callback)
: setTimeout(set_bufferfull_listener, 0);
}
function buffer_full_callback() {
dmesg('PLAYBACK_BUFFERFULL. Starting speedtest'),
(p.speedtest_seq = 0),
(p.speedtest_in_progress = !1),
speed_test(),
player.core
.getCurrentPlayback()
.off(Clappr.Events.PLAYBACK_BUFFERFULL, buffer_full_callback);
}
function set_player_play_intent_listener() {
player && player.core && player.core.getCurrentPlayback()
? player.core
.getCurrentPlayback()
.once(Clappr.Events.PLAYBACK_PLAY_INTENT, function () {
setTimeout(
bufferfull_timeout_callback,
p.speedtest_bufferfull_timeout
);
})
: setTimeout(set_player_play_intent_listener, 0);
}
function bufferfull_timeout_callback() {
return (
+p.speedtest_cnt < 1 &&
!p.speedtest_in_progress &&
(player.core
.getCurrentPlayback()
.off(Clappr.Events.PLAYBACK_BUFFERFULL, buffer_full_callback),
dmesg('Speedtest bufferfull timeout exceeded. Starting speedtest...'),
(p.speedtest_seq = 0),
(p.speedtest_in_progress = !1),
speed_test()),
!0
);
}
function speed_test() {
if (
((p.speedtest_in_progress = !0),
0 == +p.speedtest_seq &&
((p.speedtest_answ_cnt = 0), (p.speedtest_req_cnt = 0)),
!p ||
!p.event ||
(2 != +p.event.view_mode_id &&
4 != +p.event.view_mode_id &&
5 != +p.event.view_mode_id &&
6 != +p.event.view_mode_id &&
7 != +p.event.view_mode_id) ||
p.auth)
)
if (+p.speedtest_seq >= +servers.length) parse_speedtest();
else if (p.master_playlist && p.chunk_path) {
var e = p.speedtest_seq;
servers[e].has_speedtest ||
servers[e].init_speedtest ||
(servers[e].allow
? init_speedtest(servers[e])
: (p.speedtest_seq++, speed_test()));
} else get_master_url();
else
dmesg(
'Speedtest: viewer is not authorized. Vaiting for authorization...',
2
);
}
function get_master_url() {
var r = [];
if (p.master_playlist) get_chunk_playlist();
else {
var n,
e,
t = ['?live=' + p.live_duration, ''];
if (
p &&
p.event &&
(2 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id ||
7 == +p.event.view_mode_id) &&
p.auth
)
(e = url.server.cdn ? p.auth.cdn_src : p.auth.edge_src),
(n = prefix + url.media + '/' + e + '.m3u8' + t[p.event.use_dvr]);
else
(n = prefix + url.media + '/public/' + p.event.id + '.m3u8'),
(n += t[p.event.use_dvr]);
dmesg('Speedtest getting master playlist... ' + n),
$.ajax({
type: 'GET',
url: n,
dataType: 'text',
error: function (e, t, r) {
console.log('ajax_error\n' + r + '\n' + t + '\n' + e.statusText),
dmesg(
'Error getting master playlist: ' +
n +
' ' +
r +
' ' +
t +
' ' +
e.statusText,
3
),
(url.min_ping_avg = 1e4),
servers.forEach(function (e) {
e.src === url.server.src && (e.allow = 0);
}),
servers.forEach(function (e) {
e.allow &&
e.ping_min &&
+e.ping_min < +url.min_ping_avg &&
((url.min_ping_avg = e.ping_min),
(url.server = e),
(url.media = e.src));
}),
setTimeout(function () {
dmesg('Trying to get master playlist from ' + url.media),
get_master_url();
}, 1e3);
},
success: function (e) {
if (e && 0 < e.length) {
e.split('\n').forEach(function (e) {
-1 == e.indexOf('#') && 2 < e.length && r.push(e);
}),
r.reverse();
var t = new URL(n);
(p.master_playlist =
t.protocol +
'//' +
t.host +
t.pathname.split('.')[0] +
'/' +
r[0].split('/')[1]),
dmesg('Got master playlist.', 1),
get_chunk_playlist();
}
},
});
}
}
function get_chunk_playlist() {
dmesg('Speedtest getting chunk playlist... ' + p.master_playlist);
var n = [];
$.ajax({
type: 'GET',
url: p.master_playlist,
dataType: 'text',
error: function (e, t, r) {
console.log('ajax_error\n' + r + '\n' + t + '\n' + e.statusText),
dmesg(
'Error getting chunk playlist: ' +
p.master_playlist +
' ' +
r +
' ' +
t +
' ' +
e.statusText,
3
),
(p.master_playlist = null),
setTimeout(function () {
dmesg('Trying to get master playlist again'), get_master_url();
}, 1e3);
},
success: function (e) {
if (e && 0 < e.length) {
e.split('\n').forEach(function (e) {
-1 == e.indexOf('#') && 2 < e.length && n.push(e);
}),
n.reverse();
var t = 10 < n.length ? 10 : n.length - 1,
r = new URL(p.src);
(p.chunk_path = p.edge_chunk_path =
r.pathname.split('.')[0] + '/' + n[t]),
p &&
p.event &&
(2 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id ||
7 == +p.event.view_mode_id) &&
p.auth &&
((p.edge_chunk_path = '/' + p.auth.edge_src + '/' + n[t]),
(p.chunk_path = '/' + p.auth.cdn_src + '/' + n[t])),
dmesg('Got chunk playlist.', 1),
speed_test();
}
},
});
}
function init_speedtest(s) {
dmesg('Speedtest started for ' + s.src, 0),
p.speedtest_req_cnt++,
(s.init_speedtest = 1);
var i = Date.now(),
e = s.cdn ? p.chunk_path : p.edge_chunk_path;
$.ajax({
type: 'GET',
crossDomain: !0,
cache: !0,
url: 'https://' + s.src + e,
dataType: 'text',
error: function (e, t, r) {
p.speedtest_answ_cnt++,
(s.has_speedtest = 1),
(s.speed_avg = 0),
(s.speedtests = []),
dmesg(
'Speedtest error (' +
p.speedtest_answ_cnt +
' of ' +
p.speedtest_req_cnt +
') from: ' +
s.src +
' ' +
r +
t +
' ' +
e.statusText,
3
);
},
success: function (e) {
p.speedtest_answ_cnt++, (s.has_speedtest = 1);
var t = (Date.now() - i) / 1e3;
(s.bytes = e.length),
(s.speed = +(Math.round((e.length / t) * 8) / 1e6).toFixed(2)),
s.speedtest || (s.speedtest = []),
3 < s.speedtest.length && (s.speedtest = s.speedtest.slice(1, 4)),
s.id == p.best_server &&
0 ==
player.core.getCurrentPlayback()._hls.levelController
.currentLevelIndex &&
(s.speedtest = []),
s.speedtest.push(s.speed);
for (var r = 0, n = 0; n < s.speedtest.length; n++) r += s.speedtest[n];
(s.speed_avg = +(r / s.speedtest.length).toFixed(2)),
(s.timeline = Date.now()),
(s.timeline += (t * (100 - s.priority)) / 100),
(url.bandwidth += s.speed),
dmesg(
'Speedtest reply (' +
p.speedtest_answ_cnt +
' of ' +
p.speedtest_req_cnt +
'):\t' +
s.src +
',\tspeed: ' +
s.speed +
' Mbps, priority ' +
s.priority +
'%'
);
},
complete: function () {
p.speedtest_seq++,
p.speedtest_seq >= servers.length
? parse_speedtest()
: setTimeout(function () {
speed_test();
}, p.speedtest_delay);
},
});
}
function parse_speedtest() {
(p.speedtest_seq = 0), p.speedtest_cnt++;
for (var e = (url.best_speed = 0); e < servers.length; e++)
url.best_speed < servers[e].speed &&
servers[e].allow &&
((url.best_speed = servers[e].speed),
(p.best_server = servers[e]),
(url.server = servers[e]),
(url.media = servers[e].src),
servers[e].cdn || (url.hb = servers[e].src)),
(servers[e].has_speedtest = void 0),
(servers[e].init_speedtest = void 0);
dmesg(
'Speedtest done. Fastest: ' +
p.best_server.src +
', speed: ' +
p.best_server.speed +
' Mbps',
1
),
dmesg('Statistics heartbeat server: ' + url.hb, 1),
(p.srv = p.best_server.src.split('.')[0]),
(Clappr.Browser.isiOS && 1 == +p.speedtest_cnt) || sw(p.srv),
void 0 !== window.speedTestListener &&
(window.speedTestListener.speedTest = 0),
fin_speedtest(),
set_speedtest_listeners(),
dmesg('Write fastest_srv_ls: ' + p.srv + ' to local storage.'),
writeStorage(
'fastest_srv_ls',
JSON.stringify({
srv: p.srv,
expire: +Date.now() + p.fastest_srv_ls_expire,
})
),
(p.speedtest_in_progress = !1),
1 < +p.speedtest_cnt && afterEdgetestSpeedtest();
}
function afterEdgetestSpeedtest() {
clearTimeout(window.playback_seek_listen_buffering),
clearTimeout(window.playback_seek_listen_buffering_after_test),
clearTimeout(window.stillBufferringTimeout),
clearTimeout(window.checkLevelTimeout),
(p.listen_buffering = !1),
dmesg(
"After edgetest/speedtest: Don't trigger edgetest + speedtest on buffering for " +
p.speedtest_listener_off_time * p.edgetests_cnt +
'ms.'
),
(window.playback_seek_listen_buffering_after_test = setTimeout(function () {
dmesg(
'After edgetest/speedtest: ' +
p.speedtest_listener_off_time * p.edgetests_cnt +
'ms elapsed. Trigger for edgetest + speedtest is on.'
),
(p.listen_buffering = !0),
(window.playback_seek_listen_buffering_after_test = null),
(window.checkLevelTimeout = setTimeout(
check_level,
p.check_level_timeout
));
}, p.speedtest_listener_off_time * p.edgetests_cnt));
}
function set_speedtest_listeners() {
p.speed_test_listeners_set ||
p.srv_query ||
(dmesg('Setting speedtest listeners...'),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_BUFFERING, buffering_callback),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_SEEK, seek_callback),
Clappr.Browser.isiOS || check_level(),
speedtest_check_buffering(),
(p.speed_test_listeners_set = !0));
}
function seek_callback() {
window.playback_seek_listen_buffering_after_test
? dmesg('PLAYER_SEEK')
: (dmesg(
"PLAYER_SEEK. Don't trigger edgetest + speedtest on buffering for " +
p.speedtest_listener_off_time +
'ms.'
),
(p.listen_buffering = !1),
clearTimeout(window.playback_seek_listen_buffering),
(window.playback_seek_listen_buffering = setTimeout(function () {
dmesg(
p.speedtest_listener_off_time +
'ms elapsed. Trigger for edgetest + speedtest is on.'
),
(p.listen_buffering = !0);
}, p.speedtest_listener_off_time)));
}
function buffering_callback() {
dmesg('PLAYER_BUFFERING'),
p.edgetest_in_progress ||
p.speedtest_in_progress ||
!p.listen_buffering ||
(p.speedtest_buffering_counter.push(Date.now()),
1 < p.speedtest_buffering_counter.length &&
p.speedtest_buffering_counter.slice(-1)[0] -
p.speedtest_buffering_counter.slice(-2, -1)[0] <
6e4 &&
((p.edgetest_trigger = 'buffering'),
(p.speedtest_buffering_counter = []),
p.edgetest_in_progress ||
p.speedtest_in_progress ||
((p.listen_buffering = !1),
clearTimeout(window.playback_seek_listen_buffering),
edgetest())),
clearTimeout(window.stillBufferringTimeout),
(window.stillBufferringTimeout = setTimeout(function () {
player.core.getCurrentPlayback().buffering &&
p.listen_buffering &&
((p.speedtest_buffering_counter = []),
(p.edgetest_trigger = 'buffering'),
p.edgetest_in_progress ||
p.speedtest_in_progress ||
(dmesg(
'Player is buffering more than 3 seconds. Starting edgetest...'
),
(p.listen_buffering = !1),
clearTimeout(window.playback_seek_listen_buffering),
edgetest()));
}, 3e3)));
}
function check_level() {
if (
player &&
!p.edgetest_in_progress &&
!p.speedtest_in_progress &&
p.listen_buffering
) {
var e = player.getPlugin('level_selector'),
t = null;
e && e.currentLevel && (t = e.currentLevel.level.height),
t &&
160 == +t &&
e.selectedLevelId &&
-1 == +e.selectedLevelId &&
((p.edgetest_trigger = 'resolution'),
dmesg('Low resolution. Starting edgetest...'),
p.edgetest_in_progress ||
p.speedtest_in_progress ||
((p.listen_buffering = !1),
clearTimeout(window.playback_seek_listen_buffering),
edgetest()));
}
clearTimeout(window.checkLevelTimeout),
(window.checkLevelTimeout = setTimeout(check_level, p.check_level_timeout));
}
function speedtest_check_buffering() {
clearTimeout(window.speedtest_check_buffering_timeout),
p.listen_buffering &&
(player.core.getCurrentPlayback().buffering &&
(dmesg('PLAYER_BUFFERING'),
p.speedtest_buffering_counter.push(Date.now())),
1 < p.speedtest_buffering_counter.length &&
p.speedtest_buffering_counter.slice(-1)[0] -
p.speedtest_buffering_counter.slice(-2, -1)[0] <
6e4 &&
((p.edgetest_trigger = 'buffering'),
(p.speedtest_buffering_counter = []),
p.edgetest_in_progress ||
p.speedtest_in_progress ||
((p.listen_buffering = !1),
clearTimeout(window.playback_seek_listen_buffering),
edgetest())));
window.speedtest_check_buffering_timeout = setTimeout(
speedtest_check_buffering,
p.speedtest_check_buffering_timeout
);
}
function reset_speedtest_listeners() {
dmesg('Reset speedtest listeners'),
(p.speed_test_listeners_set = !1),
player.core
.getCurrentPlayback()
.off(Clappr.Events.PLAYBACK_BUFFERING, buffering_callback),
player.core
.getCurrentPlayback()
.off(Clappr.Events.PLAYBACK_SEEK, seek_callback),
setTimeout(set_speedtest_listeners, 1e3);
}
function sw(e) {
if (
(dmesg('Switch to ' + e, 1),
(p.srv = e),
Clappr.Browser.isiOS || Clappr.Browser.isMobile || Clappr.Browser.isMobile)
) {
var t = player.core.getCurrentPlayback().getCurrentTime(),
r = player.core.getCurrentContainer(),
n = player.core.getCurrentPlayback(),
s = servers.filter(function (e) {
return -1 !== e.src.indexOf(p.srv);
})[0],
i = n._options.src,
a = new URL(i);
if (a.host == s.src) return void dmesg('SRC is already ' + s.src);
var o = a.pathname;
if (
p &&
p.event &&
(2 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id ||
7 == +p.event.view_mode_id) &&
p.auth
) {
var l = o.split(p.auth.cdn_src);
(o = 1 < l.length ? l[1] : o.split(p.auth.edge_src)[1]),
(o = (s = servers.filter(function (e) {
return -1 !== e.src.indexOf(p.srv);
})[0]).cdn
? '/' + p.auth.cdn_src + o
: '/' + p.auth.edge_src + o);
}
var d = 'https://' + s.src + o;
(d += ['?live=' + p.live_duration, ''][p.event.use_dvr]),
r && (r.options.source = d),
n && (n.options.source = d),
(p.listen_buffering = !1),
player.load(d),
player.play(),
n.unmute(),
player.unmute(),
player.core
.getCurrentPlayback()
.once(Clappr.Events.PLAYBACK_PLAY, function (e) {
(p.listen_buffering = !1),
player.seek(t),
n.unmute(),
player.unmute(),
reset_speedtest_listeners();
});
}
}
function success_event() {
19318 == p.event.id &&
($('.userreg__body__phone > h3')
.html('Должность,<br>организация')
.css('width', '110'),
$('.userreg__body__accept > label').html(
'Я принимаю <a href="http://webinars.kpmg.ru/privacy" target="_blank">соглашение</a> на обработку персональных данных'
),
'en' == p.lang &&
$('.userreg__body__phone > h3').html('Company,<br>your position'),
$('.userreg__body__name > h3').css('width', '110'),
$('.userreg__body__email > h3').css('width', '110'),
$('.userreg__body__phone > h3').css('width', '110'),
$('.userreg__footer > a').css('display', 'none'),
$('.userreg__body__accept > label').css('padding-left', '140px'),
$('.userreg__body__accept > input[type="checkbox"]').css(
'margin-left',
'117px'
),
(userErr.empty.phone =
'ru' === p.lang
? 'Введите должность'
: 'Enter your job title'));
}
(p.fastest_srv_ls = null),
(p.edgetest_in_progress = !1),
(p.edgetests_cnt = 0),
(p.first_edgetest_answer = null),
(p.edgetest_timeout_exceeded = !1),
(p.edgetest_answ_cnt = 0),
(p.edgetest_req_cnt = 0),
(p.edgetest_pings = []),
(p.edgetest_timeout = 2e3),
(p.edgetest_done = !1),
(p.edgetest_xhrs_req = []),
(p.edgetest_xhrs_res = []),
(p.first_load = !1),
(p.dont_add_remote_addr = !1),
(p.on_edgetest_end_cnt = 0),
(p.edgetest_heat_cnt = 2),
(p.speedtest_cnt = 0),
(p.speedtest_answ_cnt = 0),
(p.speedtest_req_cnt = 0),
(p.speedtest_delay = 300),
(p.speedtest_bufferfull_timeout = 5e3),
(p.speedtest_in_progress = !1),
(p.speedtest_listener_off_time = 1e4),
(p.speedtest_buffering_counter = []),
(p.fastest_srv_ls_expire = 864e5),
(p.listen_buffering = !0),
(p.speedtest_min_ping_resolution_trigger = 300),
(p.check_level_timeout = 5e3),
(p.speedtest_check_buffering_timeout = 2e3);
var preselected_cdn,
SMS_REPEAT_INTERVAL = '';
function fin_speedtest() {
for (var e = 0; e < speedtest.length; e++)
speedtest[e].timeline &&
speedtest[e].timeline <= Date.now() &&
(!url.done &&
speedtest[e].cdn &&
speedtest[e].speed > cdn_threshold &&
null == preselected_cdn &&
2 < speedtest.length &&
dmesg('Preselect ' + speedtest[(preselected_cdn = e)].src),
!url.done &&
speedtest[e].speed < cdn_threshold &&
null == preselected_cdn &&
((url.server = speedtest[e]),
(url.media = speedtest[e].src),
(url.done = 1),
dmesg(
'Speedtest done (low speed, no preselect), source = \t' +
url.media +
',\tspeed: ' +
speedtest[e].speed +
' Mbit',
1
)),
!url.done &&
speedtest[e].speed > cdn_threshold &&
!speedtest[e].cdn &&
((url.server = speedtest[e]),
(url.media = speedtest[e].src),
(url.done = 1),
dmesg(
'Speedtest done (high speed), source = \t' +
url.media +
',\tspeed: ' +
speedtest[e].speed +
' Mbit',
1
)),
!url.done &&
!speedtest[e].cdn &&
speedtest[e].speed <= cdn_threshold &&
null != preselected_cdn &&
((url.server = speedtest[preselected_cdn]),
(url.media = speedtest[preselected_cdn].src),
(url.done = 1),
dmesg(
'Speedtest done (low speed, use preselect), source = \t' +
url.media +
',\tspeed: ' +
speedtest[preselected_cdn].speed +
' Mbit',
1
)),
url.hb ||
speedtest[e].cdn ||
!speedtest[e].src ||
((url.hb = speedtest[e].src),
dmesg('Statistics heartbeat server: ' + url.hb, 1)));
url.done && !p.src && hb_schedule();
}
function on_src_receive() {
duration(p.src), dmesg('SRC = ' + p.src, 1), try_load();
}
function auth_window() {
p.key
? ($('.LNIframe .event_form #pass').val(p.key),
p.no_auto_login
? $('.a-window, .a-header, .a-auth, .a-body')
.show()
.css('display', 'flex')
: look_by_multipassword())
: $('.a-window, .a-header, .a-auth, .a-body').show().css('display', 'flex'),
p.ref.indexOf('admin') < 0 &&
-1 == document.location.href.indexOf('nofocus') &&
$('#pass').focus();
}
var start,
INPUT_PHONE_NUMBER = '';
function showFullUserregForm() {
$('.userreg__code_error').html(''),
$('.userreg__window-short').hide(),
$('.userreg__window').show();
}
function backToShortUserregForm() {
$('.userreg__error_field').html(''),
$('.userreg__window').hide(),
$('.userreg__window-short').show();
}
function show_userreg_window() {
var e = Cookies.get('userreg', { path: '/v' });
e = (e = e || readStorage('userreg')) ? JSON.parse(e) : {};
var t = p.event.viewer_data ? p.event.viewer_data.split(';') : '';
t && (t[t.length - 1] || (t = t.slice(0, -1))), (p.event.customFields = t);
for (var r = 0; r < t.length; r++) {
if (-1 !== t[r].toLowerCase().indexOf('email'))
var n =
'<div class="userreg__body__custom"><h3 class="userreg__code">' +
t[r] +
'</h3><input type="text" id="userreg-user-email" onkeydown="validateEmailInput(event)" onkeyup="validateEmailInput(event)" onkeypress="validateEmailInput(event)"></div><div class="userreg__body__email-error userreg__error_field"></div>';
else if (
!p.event.has_phone_validation ||
(-1 === t[r].toLowerCase().indexOf('phone') &&
-1 === t[r].toLowerCase().indexOf('телефон'))
)
n =
'<div class="userreg__body__custom"><h3 class="userreg__code">' +
t[r] +
'</h3><input type="text" id="userreg-custom-' +
r +
'" ></div><div class="userreg__error_custom userreg__error-' +
r +
'"></div>';
else
var n =
'<div class="userreg__body__custom"><h3 class="userreg__code">' +
t[r] +
'</h3><div class="userreg-input-group-prepend"><div>+</div><input type="text" id="userreg-user-phone"></div></div><div class="userreg__body__phone-error userreg__error_field"></div>';
$('.userreg__custom').append(n);
}
if (
(p.key
? ($('#userreg-pass').val(p.key),
p.no_auto_login ? backToShortUserregForm() : look_by_multipassword())
: e[p.event.id]
? ((p.key = e[p.event.id].key), look_by_multipassword())
: $('.userreg__window').show(),
p.ref.indexOf('admin') < 0 && $('#userreg-user-name').focus(),
1 != p.event.userreg_strict &&
$('.userreg-goback, .userreg__warning').hide(),
p.event.has_phone_validation || $('.userreg_phone_warning').hide(),
p.event.has_phone_validation &&
$('#userreg-user-phone').on('keydown', function (e) {
setTimeout(validateInput, 0);
}),
'ec7mtl' === p.event.code)
) {
$('.userreg__footer').append(
'<p class="userreg__warning" >** Ваша регистрация будет проверена нашими менеджерами, и персональный билет будет отправлен Вам на электронную почту.</p>'
);
}
}
function validateInput() {
var e = $('#userreg-user-phone').val();
e.match(/^(?![0])(\d{0,15})?$/)
? (INPUT_PHONE_NUMBER = e)
: (e = INPUT_PHONE_NUMBER),
$('#userreg-user-phone').val(e);
}
function validateEmailInput(e) {
'Space' == (e = e || window.event).code && e.preventDefault();
}
function init_event() {
var e =
url.event +
'/eventdata?init&code=' +
code +
'&ref=' +
p.ref +
'&sid=' +
p.sid;
dmesg('Getting eventdata...\t\t' + prefix + e),
$.ajax({
url: prefix + e,
method: 'GET',
dataType: 'json',
cache: !1,
error: function (e, t, r) {
console.log('ajax_error\n' + r + '\n' + t + '\n' + e.statusText),
dmesg(
'Error getting eventdata from: ' +
url.event +
r +
' ' +
t +
' ' +
e.statusText,
3
),
1 === servers.length
? (dmesg('Reconnect to the last server.', 1),
setTimeout(init_event, 1e4))
: ((servers = servers.filter(function (e) {
return e.src !== url.event;
})),
dmesg(
'Server ' +
url.event +
' has been successfully removed from the list.',
1
),
dmesg('Starting reelection...', 2),
setTimeout(reload_player, 3e3));
},
success: function (e) {
if (
((p.event = e),
success_event(),
dmesg(
'Eventdata done: EID = ' + p.event.id + ' "' + p.event.name + '"',
1
),
2957 == p.event.user_id && addGTM(),
'auto' === p.autorun &&
(1 == p.event.is_live
? (p.autorun = !0)
: 1 < p.event.view_mode_id &&
0 != p.autorun &&
'false' != p.autorun &&
(p.autorun = !0)),
null != p.event.has_hd && (cdn_threshold = threshold[p.event.has_hd]),
p.event.hypercomments_auth)
) {
p.hc = p.event.hypercomments_auth;
var t = p.hc.split('_');
dmesg('HC_Auth = ' + Base64.decode(t[0]).split('"')[3]);
}
4 === p.event.view_mode_id &&
($('#pass').addClass('inp4'), $('#buy-btn').show()),
1 != p.event.view_mode_id &&
7 != p.event.view_mode_id &&
'https://' != prefix &&
(document.location.href =
document.location.href.replace('http:', 'https:') +
(-1 == document.location.href.indexOf('?') ? '?' : '&') +
'ref=' +
p.ref),
0 == p.event.has_whitelabel &&
237 != p.event.user_id &&
((p.logo = !0), dmesg('Player logo is Enabled')),
p.chat_on && (p.event.chat = 1),
$('.vcnt').html(+p.event.viewers_now + 1),
1 != p.event.is_live ||
(!sh_cnt && 1 != p.event.show_cnt) ||
$('.vcnt').show();
var r =
moment(1e3 * p.event.date_plan_start_ts).unix() - moment().unix();
0 < r && !p.c && !p.isReload && (countdown_init(r), (p.c = 1)),
p.event.disable_message &&
$('.disable').html(p.event.disable_message),
1 == p.event.has_disabled && $('.disable').show(),
p.srv && (firstLoadFastest(), fin_speedtest()),
1 != p.event.has_disable && init_src();
},
});
}
function firstLoadFastest() {
if (p.event && url.done && url.media && !p.src) {
if ((hb_schedule(), p.event && 1 == p.event.view_mode_id)) {
var e = ['?live=' + p.live_duration, ''];
(p.src = prefix + url.media + '/public/' + p.event.id + '.m3u8'),
(p.src += e[p.event.use_dvr]),
on_src_receive();
}
if (
p.event &&
p.event.view_mode_id &&
1 != p.event.view_mode_id &&
!p.auth_window
) {
if (
((p.auth_window = 1),
$spinner.hide(),
dmesg(
'Event is secured (view_mode_id = ' +
p.event.view_mode_id +
'), open Auth window'
),
15 < p.event.duration && countdown_stop(),
p.event.event_id < 1)
)
return;
7 !== p.event.view_mode_id ? auth_window() : show_userreg_window();
}
}
}
function get_event() {
$.ajax({
url: prefix + url.media + '/eventdata?hb&code=' + code + '&ref=' + p.ref,
method: 'GET',
dataType: 'json',
error: function () {},
success: function (e) {
if (
(p.event.has_disabled != e.has_disabled && location.reload(),
p.event.has_banners !== e.has_banners &&
window.player &&
'function' == typeof window.player.getPlugin &&
window.player.getPlugin('adv-banners') &&
(Boolean(e.has_banners)
? window.player.getPlugin('adv-banners').enable()
: window.player.getPlugin('adv-banners').disable()),
window.player &&
'function' == typeof window.player.getPlugin &&
window.player.getPlugin('adv-banners'))
) {
var t = [];
try {
t = JSON.parse(e.banner_urls);
} catch (e) {}
window.player
.getPlugin('adv-banners')
.updateConf({
loop: 'number' != typeof e.banner_loop || Boolean(e.banner_loop),
closable:
'number' != typeof e.banner_closable ||
Boolean(e.banner_closable),
bannerUrls: t,
bannerShowTime:
'number' == typeof e.banner_show_time ? e.banner_show_time : 10,
bannerShowDelay:
'number' == typeof e.banner_show_delay ? e.banner_show_time : 60,
});
}
var r = p.event.is_live,
n = p.event.duration,
s = e.duration,
i = p.event.has_episodes;
writeStorage('duration', e.duration),
(p.event = e),
(p.event.is_live = r),
(p.event.duration = n),
(p.event.edatadur = s),
i &&
!p.event.has_episodes &&
($('.trigger-episode-button').hide(),
player.getPlugin('episodes-navigation-container').isOpened &&
(player.getPlugin('episodes-navigation-container').slide(),
reload_background())),
+e.poll_hb_delay && (p.poll_hb_delay = e.poll_hb_delay),
0 == p.event.is_live && $('.vcnt').hide(),
pollOverlayInit(),
$('.vcnt').html(1 * p.event.viewers_now),
p.player.loaded || try_load();
},
});
}
var dmsg = [];
function dmesg(e, t) {
(start = start || new Date().getTime()), (t = t || 0);
var r = new Date().getTime(),
n = Math.floor((r - start) / 1e3),
s = r - start - 1e3 * n,
i = '';
s < 100 && (i = '0'), s < 10 && (i += '0');
var a =
'<font ' +
['', 'color=green', 'color=orange', 'color=red'][t] +
'>' +
(n + '.' + i + (r - start - 1e3 * n)) +
'\t' +
escapeHtml(e) +
'</font><br>';
dmsg.push(a),
-1 < (window.location.href + p.ref).indexOf('fcdebug') && console.log(e),
$('#dmesg').append(a);
}
function fcdebug() {
$('#fcdebug').show();
}
function countdown_init(e) {
$spinner.hide(),
no_animation ||
$(function () {
(ts = new Date().getTime() + 1e3 * e),
$('#countdown')
.countdown({ timestamp: ts, callback: function () {} })
.css('margin-bottom', '12px');
});
}
function countdown_stop() {
$('#countdown').html('').hide(),
$('.Iframe_body .LNIframe .info-wrap').addClass('no-countdown'),
(p.c = void 0);
}
function js_after_playerload() {
var e =
0 == document.documentElement.clientWidth
? document.body.clientWidth
: document.documentElement.clientWidth;
$spinner.hide(),
$('.description').fadeOut(1e3),
setTimeout(function () {
$('.Iframe_body .comment_arrow, .lang_arrow').addClass('relax'),
$('.Iframe_body .trigger-episode-button').addClass('relax');
}, 3e4),
setTimeout(function () {
$('.name').fadeOut(2e3);
}, 7e3),
setTimeout(function () {
$('.description-date').fadeOut(2e3),
$('.description-date-wrap').fadeOut(2e3);
}, 1e3),
e < 800 &&
'0px' == $('#hypercomments_widget').css('right') &&
$('#hypercomments_widget').css('right', 0);
}
function Player(e) {
switch (e) {
case 'load':
$spinner.show(),
$('.awa').hide(),
countdown_stop(),
p.logo && $spinner.hide(),
p.event.is_live &&
0 != p.autorun &&
'false' != p.autorun &&
(p.autorun = !0),
p.player_loaded || ((p.player_loaded = 1), run_player());
break;
case 'hide':
$('.player .play').hide();
}
}
function hb() {
duration(p.src),
url.hb &&
(p.src &&
-1 == p.src.indexOf('csw_') &&
1 == url.server.cdn &&
player &&
'function' == typeof player.isPlaying &&
player.isPlaying() &&
(1 == p.event.view_mode_id &&
(p.stat_src = prefix + url.hb + '/public/' + p.event.id + '.m3u8'),
1 < p.event.view_mode_id &&
(p.stat_src = prefix + url.hb + '/' + p.auth.edge_src + '.m3u8'),
$.ajax({ url: p.stat_src })),
p.src &&
-1 < p.src.indexOf('csw_') &&
player &&
'function' == typeof player.isPlaying &&
player.isPlaying() &&
((p.stat_src = prefix + url.hb + '/public/' + p.event.id + '.m3u8'),
$.ajax({ url: p.stat_src })));
}
function auth_hb() {}
function debounce(e, t) {
var r;
return function () {
clearTimeout(r),
(r = setTimeout(function () {
e();
}, t));
};
}
function reload_background() {
var e = $(window).width(),
t = $('#hypercomments_widget');
if (
(chatOpen
? (t.show(),
t.css('right', 0),
800 <= e
? $('[data-player]').first().addClass('comments')
: ($('[data-player]').first().css('width', '100%'),
$('[data-player]').first().removeClass('comments')))
: (t.css('right', -360),
$('[data-player]').first().removeClass('comments')),
!chatOpen &&
player &&
player.getPlugin &&
player.getPlugin('episodes-navigation-container').isOpened &&
(800 <= e
? $('[data-player]').first().addClass('comments')
: ($('[data-player]').first().css('width', '100%'),
$('[data-player]').first().removeClass('comments'))),
logo_image)
)
var r = 0,
n = setInterval(function () {
300 < r ? clearInterval(n) : ((r += 10), resize_logo());
}, 10);
}
function resize_logo() {
var e = $('[data-player] > .logo > .logo-image');
e.css({ height: 'auto' }),
$('[data-player] > .logo').css({
'max-width':
Math.min(
p.logo_width,
$('#player [data-player]').first().width() - 60
) + 'px',
'max-height':
Math.min(
p.logo_height,
$('#player [data-player]').first().height() - 100
) + 'px',
}),
e.css({ height: e.width() / p.logo_aspect_ratio });
}
function date_format() {
moment.locale(p.lang);
var e = moment(p.event.date_plan_start, 'DD.MM.YYYY HH:mm:ss').format('LL'),
t = moment(p.event.date_plan_start, 'DD.MM.YYYY HH:mm:ss').format('LT'),
r = 'ru' === p.lang ? 'РїРѕ РњРѕСЃРєРІРµ' : '(MSK, UTC+3)';
$('.description-date').html(
'<span>' + e + '</span><br><span>' + t + '</span> <span>' + r + '</span>'
);
}
function sms_verification_repeat() {
$('.sms_verification_repeat_error')
.css('display', 'none')
.text('')
.css('color', 'black'),
$('.sms_verification_repeat_time_counter')
.css('display', 'none')
.text('')
.css('color', 'black'),
$('.validation_phone').hide().css('color', 'white');
var e = p.event.id,
t = $('.LNIframe .event_form #pass').val() || p.key;
7 === p.event.view_mode_id &&
(t = $('#userreg-pass').val() || $('#us-pass').val() || p.key),
p.event.userreg_strict &&
(t =
$('.userreg__window-short #userreg-pass').val() ||
$('#us-pass').val() ||
p.key);
var r = Cookies.get('userreg_verification', { path: '/v' }),
n = '';
(r = (r = r || readStorage('userreg_verification')) ? JSON.parse(r) : {})[
e
] &&
r[e].email &&
(n = r[e].email);
var s = { event_id: e, password: t, email: n };
(event.target.disabled = !0),
$.ajax({
url: 'https://kassa.facecast.net/api/verification/send',
data: s,
method: 'POST',
dataType: 'json',
success: function (e) {
if (
($('.sbtn-validation-repeat').prop('disabled', !1),
e.ok || console.log('Server error', e),
e.ok)
) {
e.ticket_id && ((p.ticket_id = e.ticket_id), (p.phone = e.phone)),
$('.sms_verification_repeat_error')
.css('display', 'block')
.text('Сообщение отправлено')
.css('color', 'green');
var t =
'ru' == p.lang
? 'Код отправлен на номер: '
: 'Code sent to: ';
$('.validation_phone')
.show()
.css('display', 'flex')
.text(t + p.phone),
$('.phone_validation_window').show().css('display', 'flex'),
Cookies.set('sms_send_error', 0, { path: '/v' }),
writeStorage('sms_send_error', 0);
}
return !0;
},
error: function (e) {
if (
($('.sbtn-validation-repeat').prop('disabled', !1), e.responseJSON)
) {
if (
e.responseJSON.err &&
'SMS_SEND_LIMIT' == e.responseJSON.err.type
) {
SMS_REPEAT_INTERVAL && clearInterval(SMS_REPEAT_INTERVAL);
var t =
'ru' == p.lang
? 'Лимит СМС исчерпан'
: 'SMS limit is exceeded';
return void $('.sms_verification_repeat_time_counter')
.css('display', 'block')
.text(t)
.css('color', 'red');
}
if (e.responseJSON.err && 'SMS_SEND_DELAY' == e.responseJSON.err.type)
return (
SMS_REPEAT_INTERVAL && clearInterval(SMS_REPEAT_INTERVAL),
void (SMS_REPEAT_INTERVAL = setInterval(function () {
nextSMSCounter(e.responseJSON.err.time);
}, 1e3))
);
if (
e.responseJSON.err &&
'CHECK_BALANCE' == e.responseJSON.err.type &&
'INSUFFICIENT_SMS_FUNDS' == e.responseJSON.err.code
) {
Cookies.set('sms_send_error', 1, { path: '/v' }),
writeStorage('sms_send_error', 1);
t =
'ru' == p.lang
? 'Ошибка отправки СМС. Пожалуйста обратитесь к организатору трансляции'
: 'Error sending SMS. Please contact the broadcast organizer';
return void $('.validation_phone')
.show()
.css('display', 'flex')
.css('color', 'red')
.text(t);
}
if (
e.responseJSON.err &&
'CHECK_BALANCE' == e.responseJSON.err.type &&
'SMS_PRICE_NOT_FOUND' == e.responseJSON.err.code
) {
t =
'ru' == p.lang
? 'DB_ERROR_1, попробуйте позже'
: 'DB_ERROR_1, try again later';
return void $('.validation_phone')
.show()
.css('display', 'flex')
.css('color', 'red')
.text(t);
}
}
$('.sms_verification_repeat_error')
.css('display', 'block')
.text(
'ru' == p.lang
? 'Ошибка отправки сообщения'
: 'SMS send error'
)
.css('color', 'red'),
console.log('Network Error', e);
},
});
}
function nextSMSCounter(e) {
var t = e - Date.now(),
r = (Math.floor(t / 864e5), Math.floor((t % 864e5) / 36e5)),
n = Math.floor(((t % 864e5) % 36e5) / 6e4),
s = Math.round(((t % 864e5) % 6e4) / 1e3);
if (s <= 0)
return (
$('.sms_verification_repeat_time_counter')
.css('display', 'none')
.text('')
.css('color', 'black'),
0
);
60 == s && ((s = 0), n++),
r < 10 && (r = '0' + r),
n < 10 && (n = '0' + n),
s < 10 && (s = '0' + s);
var i =
'ru' == p.lang
? 'Повторное сообщение можно отправить через: '
: 'Next message can be sent in: ';
(i = i + r + ':' + n + ':' + s),
$('.sms_verification_repeat_time_counter')
.css('display', 'block')
.text(i)
.css('color', 'red');
}
function verifyPhoneNumber(r) {
$('.verify_error').css('display', 'none');
var e = p.event.id,
t = $('.LNIframe .event_form #pass').val() || p.key;
7 === p.event.view_mode_id &&
(t = $('#userreg-pass').val() || $('#us-pass').val() || p.key),
p.event.userreg_strict &&
(t =
$('.userreg__window-short #userreg-pass').val() ||
$('#us-pass').val() ||
p.key);
var n = Cookies.get('userreg_verification', { path: '/v' }),
s = '';
(n = (n = n || readStorage('userreg_verification')) ? JSON.parse(n) : {})[
e
] &&
n[e].email &&
(s = n[e].email);
var i = $('.validation_code_input').val(),
a = p.ticket_id,
o = !0;
if (!i || !i.length) {
var l = 'ru' == p.lang ? 'Введите код' : 'Enter a code';
$('.verify_error').css('display', 'block').text(l).css('color', 'red'),
(o = !1);
}
var d = { ticket_id: a, code: i, email: s, password: t, event_id: e };
o &&
((r.target.disabled = !0),
$.ajax({
url: 'https://kassa.facecast.net/api/verification/verify',
data: d,
method: 'POST',
dataType: 'json',
success: function (e) {
if (((r.target.disabled = !1), !e.ok)) {
var t =
'ru' == p.lang
? 'Ошибка верификации'
: 'Verification Error';
$('.verify_error')
.css('display', 'block')
.text(t)
.css('color', 'red');
}
return (
e.ok &&
((p.event.userreg_strict = !0),
$('.auth_window.a-window').remove(),
$('.userreg__window').remove(),
$('.userreg__window-short').remove(),
$('.phone_validation_window').hide(),
(p.key = e.key),
look_by_multipassword()),
!0
);
},
error: function (e) {
r.target.disabled = !1;
var t =
'ru' == p.lang
? 'Ошибка верификации'
: 'Verification Error';
$('.verify_error').css('display', 'block').text(t).css('color', 'red'),
console.log('Network Error', e);
},
}));
}
function look_by_multipassword() {
var n = $('.LNIframe .event_form #pass').val() || p.key;
if (
(7 !== p.event.view_mode_id &&
($('.userreg__window').remove(),
$('.userreg__window-short').remove(),
$('.us-window').remove()),
7 === p.event.view_mode_id &&
(n = $('#userreg-pass').val() || $('#us-pass').val() || p.key),
p.event.userreg_strict &&
(n =
$('.userreg__window-short #userreg-pass').val() ||
$('#us-pass').val() ||
p.key),
p.key || (p.key = n),
n)
) {
if ((p.event.view_mode_id, (p.key = n), !p.auth_req || 0 == p.auth_req)) {
p.auth_req = 1;
var e =
prefix +
url.media +
'/viewer_auth?eid=' +
p.event.id +
'&key=' +
n +
'&check=0&check_doubleview=0';
$.ajax({
url: e,
error: function () {
p.auth_req = 0;
},
success: function (e) {
p.auth_req = 0;
try {
e = JSON.parse(e);
} catch (e) {
return;
}
if (
7 === p.event.view_mode_id &&
p.event.userreg_strict &&
'PHONE_NOT_VERIFIED' === e.error_code
)
return (
$('.auth_window').hide(),
$('.userreg__window-short').hide(),
void showPhoneVerificationWindow()
);
if (
(e.error &&
(dmesg('Auth error: ' + e.error, 2),
'Неверный код' === e.error &&
(e.error =
'ru' === p.lang
? 'Неверный код'
: 'Invalid password'),
'Доступ ограничен, обратитесь к организатору' ===
e.error &&
(e.error =
'ru' === p.lang
? 'Доступ ограничен, обратитесь к организатору'
: 'Access restricted, contact the organizer'),
(p.key = void 0),
(n = void 0),
7 !== p.event.view_mode_id || p.event.userreg_strict
? 7 === p.event.view_mode_id && p.event.userreg_strict
? ($('.auth_body .event_error').html(e.error),
$('.userreg__window-short .userreg__code_error').html(
e.error
),
$('.userreg__window-short').show())
: ($('.userreg__window').remove(),
$('.userreg__window-short').remove(),
$('.us-window').remove(),
$('.event_error').html(e.error),
$(
'.auth_window, .auth_header, .auth, .auth' +
p.event.view_mode_id
)
.show()
.css('display', 'flex'))
: ($('.userreg__window').hide(),
$('.userreg__window-short').show(),
$('.userreg__window-short .userreg__code_error').html(
e.error
))),
e.src || e.playlist_src)
) {
(p.auth = e),
2 != p.event.view_mode_id &&
7 != p.event.view_mode_id &&
1 === e.hb &&
((p.auth_hb_req = 1), auth_hb_init()),
!url.event_server.cdn && url.server.cdn && (e.src = e.cdn_src);
var t = ['?live=' + p.live_duration, ''];
if (
((p.src =
prefix +
url.media +
'/' +
e.src +
'.m3u8' +
t[p.event.use_dvr]),
(p.auth_stat_src = e.stat_src),
duration(p.src),
(p.event.pid = e.pid),
$('.auth_window').hide(),
p.key &&
window.parent &&
window.parent.postMessage(
JSON.stringify({
type: 'auth',
key: p.key,
init: 'Facecast_player',
}),
'*'
),
dmesg('Auth success, SRC = ' + p.src, 1),
7 === p.event.view_mode_id)
) {
var r = Cookies.get('userreg', { path: '/v' });
if (!(r = r && JSON.parse(r)) || !r[p.event.id])
((r = r || {})[p.event.id] = { eid: p.event.id, key: p.key }),
Cookies.set('userreg', JSON.stringify(r), { path: '/v' }),
writeStorage('userreg', JSON.stringify(r));
$('.userreg__window').hide(), $('.userreg__window-short').hide();
}
!p.auth_hb &&
2 < p.event.view_mode_id &&
7 != p.event.view_mode_id &&
(p.auth_hb = 1),
p.event.date_real_start_ts ||
readStorage(
'successful_registration_popup_shown-' + p.event.id
) ||
7 !== p.event.view_mode_id ||
$('.alert_window_popup').css('display', 'flex').show(),
try_load();
}
send_stat();
},
}),
dmesg('Auth request sent ' + e);
}
} else {
var t = 'ru' === p.lang ? 'Введите код' : 'Enter the code';
7 !== p.event.view_mode_id || p.event.userreg_strict
? 7 === p.event.view_mode_id && p.event.userreg_strict
? $('.us-window .us-auth .us-body .event_form .event_error').html(t)
: $('.event_form .event_error').html(t)
: $('.userreg__window-short .userreg__code_error').html(t);
}
}
function fixPageXY(e) {
if (null == e.pageX && null != e.clientX) {
var t = document.documentElement,
r = document.body;
(e.pageX = e.clientX + (t.scrollLeft || (r && r.scrollLeft) || 0)),
(e.pageX -= t.clientLeft || 0),
(e.pageY = e.clientY + (t.scrollTop || (r && r.scrollTop) || 0)),
(e.pageY -= t.clientTop || 0);
}
}
function go_buy() {
dmesg(
'Opening new window: https://facecast.net/view/ticket/' + p.event.id + '/'
);
var e = getRef(),
t = Object.keys(p)
.filter(function (e) {
return e.match('utm');
})
.map(function (e) {
return [e, p[e]];
})
.map(function (e) {
return e[0] + '=' + e[1];
})
.join('&'),
r = '';
if (getParentQueryString()) {
var n = parseQuery(getParentQueryString());
r = Object.keys(n)
.filter(function (e) {
return e.match('utm');
})
.map(function (e) {
return [e, n[e]];
})
.map(function (e) {
return 'parent_' + e[0] + '=' + e[1];
})
.join('&');
}
r
? window.open(
'https://kassa.facecast.net/events/' +
p.event.id +
'?lang=' +
p.lang +
'&' +
t +
'&ref=' +
e +
'&' +
r,
'_blank',
''
) ||
(window.location.href =
'https://kassa.facecast.net/events/' +
p.event.id +
'?lang=' +
p.lang +
'&' +
t +
'&ref=' +
e +
'&' +
r)
: window.open(
'https://kassa.facecast.net/events/' +
p.event.id +
'?lang=' +
p.lang +
'&' +
t +
'&ref=' +
e,
'_blank',
''
) ||
(window.location.href =
'https://kassa.facecast.net/events/' +
p.event.id +
'?lang=' +
p.lang +
'&' +
t +
'&ref=' +
e);
}
function register(n) {
var t = !0,
s = $('#userreg-user-email').val().trim(),
e = '',
r = $('#userreg-user-accept').prop('checked'),
i = [],
a = getRef();
if (($('.userreg__error_field').css('display', 'none'), s.length)) {
if (
!s.match(
/^[a-zA-Z0-9]+(([+._-]+[a-zA-Z0-9_]+)+|([a-zA-Z0-9_]?))@[a-zA-Z0-9]+(([._-]+[a-zA-Z0-9]+)+|([a-zA-Z0-9]?))\.[a-zA-Z]{2,6}$/gi
)
) {
o =
'ru' == p.lang
? 'Введите корректный email'
: 'Enter a valid email';
$('.userreg__body__email-error').css('display', 'block').html(o),
(t = !1);
}
} else {
var o = 'ru' == p.lang ? 'Введите Email' : 'Enter Email';
$('.userreg__body__email-error').css('display', 'block').html(o), (t = !1);
}
if (
(60 < s.length &&
($('.userreg__body__email-error')
.css('display', 'block')
.html(
'Максимальная длина почты 60 символов'
),
(t = !1)),
p.event.has_phone_validation)
)
if ((e = $('#userreg-user-phone').val()).length)
if (e.match(/^\d+$/)) {
if (15 < e.length) {
o =
'ru' == p.lang
? 'Максимальная длина номера телефона 15 символов'
: 'Maximum phone number length 15 characters';
$('.userreg__body__phone-error').css('display', 'block').html(o),
(t = !1);
} else if (e.length < 10) {
o =
'ru' == p.lang
? 'Минимальная длина номера телефона 10 символов'
: 'Minimum phone number length 10 characters';
$('.userreg__body__phone-error').css('display', 'block').html(o),
(t = !1);
}
} else {
var o =
'ru' == p.lang
? 'Телефонный номер должен состоять только из цифр'
: 'The phone number must consist of numbers only';
$('.userreg__body__phone-error').css('display', 'block').html(o),
(t = !1);
}
else {
var o =
'ru' == p.lang
? 'Введите телефон'
: 'Enter your phone number';
$('.userreg__body__phone-error').css('display', 'block').html(o),
(t = !1);
}
if (!r) {
o =
'ru' == p.lang
? 'Поставьте галочку'
: 'Check the checkbox';
$('.userreg__body__accept-error').css('display', 'block').html(o), (t = !1);
}
var l = 0;
$('.userreg__custom input').each(function () {
if (((i[l] = $(this).val()), $(this).html(''), !i[l].length)) {
var e = 'ru' == p.lang ? 'Введите данные' : 'Enter data';
$('.userreg__error-' + l).html(e), (t = !1);
}
l++;
});
var d = [];
if (
(Object.keys(p)
.filter(function (e) {
return e.match('utm');
})
.forEach(function (e) {
d.push([e, p[e]]);
}),
getParentQueryString())
) {
var c = parseQuery(getParentQueryString());
Object.keys(c)
.filter(function (e) {
return e.match('utm');
})
.forEach(function (e) {
d.push(['parent_' + e, c[e]]);
});
}
var u = {
ajaj: 1,
event_id: p.event.id,
email: s,
phone: e,
viewer_data: JSON.stringify(i),
ref: a,
lang: p.lang,
utm: d,
};
t
? (disableRegisterButton(n.target),
setTimeout(function () {
enableRegisterButton(n.target);
}, 7e3),
$.ajax({
url: 'https://kassa.facecast.net/api/viewers/register',
data: u,
method: 'POST',
dataType: 'json',
success: function (e) {
if (
(enableRegisterButton(n.target),
e.ticket_id && (p.ticket_id = e.ticket_id),
e.error && console.log('Server error', e),
!e.ok && 'NOT_ALLOWED_EMAIL_DOMAIN' === e.err)
) {
var t =
'ru' == p.lang
? 'Указанный адрес запрещён'
: 'The specified address is prohibited';
$('.userreg__body__email-error').css('display', 'block').html(t);
}
if (e.ok && !e.userreg_strict)
(p.key = e.key),
$('#userreg-pass').val(''),
look_by_multipassword();
else if (
e.ok &&
e.userreg_strict &&
p.event.has_phone_validation &&
!e.phone_validated
) {
p.event.userreg_strict = !0;
var r = {};
(r[p.event.id] = {
event_id: p.event.id,
email: s,
ticket_id: p.ticket_id,
}),
Cookies.set('userreg_verification', JSON.stringify(r), {
path: '/v',
}),
writeStorage('userreg_verification', JSON.stringify(r)),
Cookies.set('sms_send_error', 0, { path: '/v' }),
writeStorage('sms_send_error', 0),
$('.auth_window.a-window').remove(),
$('.userreg__window').remove(),
$('.userreg__window-short').remove(),
showPhoneVerificationWindow();
} else
e.ok &&
e.userreg_strict &&
p.event.has_phone_validation &&
e.phone_validated
? ((p.event.userreg_strict = !0),
$('.auth_window.a-window').remove(),
$('.userreg__window').remove(),
$('.userreg__window-short').remove(),
$('.us-window, .us-header, .us-auth, .us-body')
.show()
.css('display', 'flex'))
: e.ok &&
e.userreg_strict &&
!p.event.has_phone_validation &&
((p.event.userreg_strict = !0),
$('.auth_window.a-window').remove(),
$('.userreg__window').remove(),
$('.userreg__window-short').remove(),
$('.us-window, .us-header, .us-auth, .us-body')
.show()
.css('display', 'flex'));
return !0;
},
error: function (e) {
if (
(enableRegisterButton(n.target),
e.responseJSON &&
'NOT_VALID_PHONE' == e.responseJSON.err &&
$('.userreg__body__phone-error')
.css('display', 'block')
.html(e.responseJSON.message),
e.responseJSON &&
'SMS_SEND_ERROR' == e.responseJSON.message &&
'INSUFFICIENT_SMS_FUNDS' == e.responseJSON.err.stack.code)
) {
(p.event.userreg_strict = !0), (p.SMS_SEND_ERROR = !0);
var t = {};
(t[p.event.id] = { event_id: p.event.id, email: s }),
Cookies.set('userreg_verification', JSON.stringify(t), {
path: '/v',
}),
writeStorage('userreg_verification', JSON.stringify(t)),
Cookies.set('sms_send_error', 1, { path: '/v' }),
writeStorage('sms_send_error', 1),
$('.auth_window.a-window').remove(),
$('.userreg__window').remove(),
$('.userreg__window-short').remove(),
showPhoneVerificationWindow();
}
e.responseJSON &&
'SMS_SEND_ERROR' == e.responseJSON.message &&
'SMS_PRICE_NOT_FOUND' == e.responseJSON.err.stack.code &&
((p.DB_ERROR_1 = 1),
$('.auth_window.a-window').remove(),
$('.userreg__window').remove(),
$('.userreg__window-short').remove(),
showPhoneVerificationWindow()),
console.log('Network Error', e);
},
}))
: console.log('Form Error');
}
function disableRegisterButton(e) {
e.disabled = !0;
var t = 'ru' == p.lang ? 'РЕГИСТРАЦИЯ...' : 'REGISTRATION...';
e.value = t;
}
function enableRegisterButton(e) {
e.disabled = !1;
var t = 'ru' == p.lang ? 'ЗАРЕГИСТРИРОВАТЬСЯ' : 'REGISTER';
e.value = t;
}
function showPhoneVerificationWindow() {
if (($('.validation_phone').css('color', 'white').hide(), p.DB_ERROR_1)) {
var e =
'ru' == p.lang
? 'DB_ERROR_1, попробуйте позже'
: 'DB_ERROR_1, try again later';
return (
$('.validation_phone')
.show()
.css('display', 'flex')
.css('color', 'red')
.text(e),
void $('.phone_validation_window').show().css('display', 'flex')
);
}
if (p.SMS_SEND_ERROR) {
e =
'ru' == p.lang
? 'Ошибка отправки СМС. Пожалуйста обратитесь к организатору трансляции'
: 'Error sending SMS. Please contact the broadcast organizer';
return (
$('.validation_phone')
.show()
.css('display', 'flex')
.css('color', 'red')
.text(e),
void $('.phone_validation_window').show().css('display', 'flex')
);
}
if (+Cookies.get.sms_send_error) {
e =
'ru' == p.lang
? 'Ошибка отправки СМС. Пожалуйста обратитесь к организатору трансляции'
: 'Error sending SMS. Please contact the broadcast organizer';
return (
$('.validation_phone')
.show()
.css('display', 'flex')
.css('color', 'red')
.text(e),
void $('.phone_validation_window').show().css('display', 'flex')
);
}
if (+readStorage('sms_send_error')) {
e =
'ru' == p.lang
? 'Ошибка отправки СМС. Пожалуйста обратитесь к организатору трансляции'
: 'Error sending SMS. Please contact the broadcast organizer';
return (
$('.validation_phone')
.show()
.css('display', 'flex')
.css('color', 'red')
.text(e),
void $('.phone_validation_window').show().css('display', 'flex')
);
}
var t = p.event.id,
r = $('.LNIframe .event_form #pass').val() || p.key;
7 === p.event.view_mode_id &&
(r = $('#userreg-pass').val() || $('#us-pass').val() || p.key),
p.event.userreg_strict &&
(r =
$('.userreg__window-short #userreg-pass').val() ||
$('#us-pass').val() ||
p.key);
var n = Cookies.get('userreg_verification', { path: '/v' }),
s = '';
(n = (n = n || readStorage('userreg_verification')) ? JSON.parse(n) : {})[
t
] &&
n[t].email &&
(s = n[t].email),
(data = { event_id: t, email: s, password: r }),
$.ajax({
url: 'https://kassa.facecast.net/api/verification/get_phone',
data: data,
method: 'POST',
dataType: 'json',
success: function (e) {
if (((event.target.disabled = !1), e.phone)) {
p.phone = e.phone;
var t =
'ru' == p.lang
? 'Код отправлен на номер: '
: 'Code sent to: ';
$('.validation_phone')
.show()
.css('display', 'flex')
.text(t + p.phone),
$('.phone_validation_window').show().css('display', 'flex');
}
return (
e.error &&
($('.phone_validation_window').show().css('display', 'flex'),
console.log('Server error', e)),
!0
);
},
error: function (e) {
(event.target.disabled = !1),
$('.phone_validation_window').show().css('display', 'flex'),
console.log('Network Error', e);
},
});
}
function getRef() {
var e = encodeURIComponent(p.ref);
return (
-1 !== window.location.search.indexOf('ref') &&
(e = encodeURIComponent(
window.location.search.substr(window.location.search.indexOf('ref') + 4)
)),
e
);
}
function getParentQueryString() {
return document.referrer ? '?' + document.referrer.split('?')[1] : '';
}
function parseQuery(e) {
for (
var t = {}, r = ('?' === e[0] ? e.substr(1) : e).split('&'), n = 0;
n < r.length;
n++
) {
var s = r[n].split('=');
t[decodeURIComponent(s[0])] = decodeURIComponent(s[1] || '');
}
return t;
}
function show_chat_button() {
'ru' == p.lang && $('.comment_arrow').attr('style', 'display:block;'),
'ru' != p.lang &&
$('.comment_arrow').attr(
'style',
'background: rgba(0, 0, 0, 0) url("//facecast.net/images/comments_en.png") repeat scroll 0% 0% / contain padding-box border-box; display:block;'
);
}
function load_chat() {
dmesg('Loading chat'),
(_hcwp = window._hcwp || []),
_hcwp.push({
widget: 'Stream',
widget_id: 27474,
css: '//facecast.net/css/hc_lite.css?',
href: p.chat_id ? p.chat_id : code,
auth: p.hc,
}),
(function () {
if (!('HC_LOAD_INIT' in window)) {
HC_LOAD_INIT = !0;
var e = (
p.lang ||
navigator.language ||
navigator.systemLanguage ||
navigator.userLanguage ||
'en'
)
.substr(0, 2)
.toLowerCase(),
t = document.createElement('script');
(t.type = 'text/javascript'),
(t.async = !0),
(t.src =
('https:' == document.location.protocol ? 'https' : 'http') +
'://w.hypercomments.com/widget/hc/27474/' +
e +
'/widget.js');
var r = document.getElementsByTagName('script')[0];
r.parentNode.insertBefore(t, r.nextSibling);
}
})(),
check_chat();
}
function check_chat() {
if (null == $('.hc__root').width()) return setTimeout(check_chat, 200), !1;
$('#chat_wait').hide(), dmesg('Loading chat done.');
}
function check_reload() {
var e = player.getCurrentTime();
setTimeout(function () {
p.src
? (dmesg('Set new SRC = ' + p.src + ', load to player', 2),
player.configure({ source: p.src }),
player.listenToOnce(player, Clappr.Events.PLAYER_PLAY, function () {
thumbnailPlayer &&
($('#thumbnail-player-track')
.detach()
.appendTo($('#player div[data-player]')),
thumbnailPlayer.configure({ source: p.src }),
bindThumbnailPlayer && bindThumbnailPlayer(player),
(speedSelectOpen = settingsOpen = !1));
((p.event.has_multicam &&
(void 0 === p.multicam || !1 !== JSON.parse(p.multicam))) ||
(void 0 !== p.multicam && JSON.parse(p.multicam))) &&
!p.isMobile &&
(window.setupPiPControls(),
(e = window.getSecondaryPlayer().getCurrentTime()),
$('#player2').detach().appendTo($('#player div[data-player]')),
window.updatePrimaryVideo(),
window.changeSecondaryPlayerSource(window.getCurrentViewNum()));
player.seek(e);
}),
$('.description').hide(),
(p.run1 = void 0))
: (check_reload(), $('.auth_window').hide());
}, 200),
$spinner.hide();
}
function reload_player() {
$spinner.show(),
dmesg('Servers re-check started', 2),
(p.old_src = p.src),
(p.old_srv = url.media),
(p.isReload = !0),
(url = {
server: {},
media: '',
event: '',
hb: '',
req_cnt: 0,
answ_cnt: 0,
group: 0,
bandwidth: 0,
a: [],
remote_addr: [],
done: void 0,
edgetest: void 0,
});
for (var e = 0; e < speedtest.length; e++) speedtest[e].timeline = 0;
(speedtest = void 0),
(speedtest = []),
(p.src = void 0),
(p.server = void 0),
(servers.have_response = void 0),
(p.run1 = void 0),
(p.player_frag_listener = void 0),
p.srv_query || (p.srv = void 0),
get_urls(),
check_reload();
}
var Base64 = {
_keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
encode: function (e) {
var t,
r,
n,
s,
i,
a,
o,
l = '',
p = 0;
for (e = Base64._utf8_encode(e); p < e.length; )
(s = (t = e.charCodeAt(p++)) >> 2),
(i = ((3 & t) << 4) | ((r = e.charCodeAt(p++)) >> 4)),
(a = ((15 & r) << 2) | ((n = e.charCodeAt(p++)) >> 6)),
(o = 63 & n),
isNaN(r) ? (a = o = 64) : isNaN(n) && (o = 64),
(l =
l +
this._keyStr.charAt(s) +
this._keyStr.charAt(i) +
this._keyStr.charAt(a) +
this._keyStr.charAt(o));
return l;
},
decode: function (e) {
var t,
r,
n,
s,
i,
a,
o = '',
l = 0;
for (e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ''); l < e.length; )
(t =
(this._keyStr.indexOf(e.charAt(l++)) << 2) |
((s = this._keyStr.indexOf(e.charAt(l++))) >> 4)),
(r =
((15 & s) << 4) | ((i = this._keyStr.indexOf(e.charAt(l++))) >> 2)),
(n = ((3 & i) << 6) | (a = this._keyStr.indexOf(e.charAt(l++)))),
(o += String.fromCharCode(t)),
64 != i && (o += String.fromCharCode(r)),
64 != a && (o += String.fromCharCode(n));
return (o = Base64._utf8_decode(o));
},
_utf8_encode: function (e) {
e = e.replace(/\r\n/g, '\n');
for (var t = '', r = 0; r < e.length; r++) {
var n = e.charCodeAt(r);
n < 128
? (t += String.fromCharCode(n))
: (127 < n && n < 2048
? (t += String.fromCharCode((n >> 6) | 192))
: ((t += String.fromCharCode((n >> 12) | 224)),
(t += String.fromCharCode(((n >> 6) & 63) | 128))),
(t += String.fromCharCode((63 & n) | 128)));
}
return t;
},
_utf8_decode: function (e) {
for (var t = '', r = 0, n = (c1 = c2 = 0); r < e.length; )
(n = e.charCodeAt(r)) < 128
? ((t += String.fromCharCode(n)), r++)
: 191 < n && n < 224
? ((c2 = e.charCodeAt(r + 1)),
(t += String.fromCharCode(((31 & n) << 6) | (63 & c2))),
(r += 2))
: ((c2 = e.charCodeAt(r + 1)),
(c3 = e.charCodeAt(r + 2)),
(t += String.fromCharCode(
((15 & n) << 12) | ((63 & c2) << 6) | (63 & c3)
)),
(r += 3));
return t;
},
};
function addGTM() {
$('.LNIframe').append(
"\x3c!-- Google Tag Manager --\x3e <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KLP89LK');</script>\x3c!-- End Google Tag Manager --\x3e\x3c!-- Google Tag Manager (noscript) --\x3e" +
'<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KLP89LK" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>\x3c!-- End Google Tag Manager (noscript) --\x3e'
);
}
function multitrack_master_playlist(e) {
var t = (
navigator.language ||
navigator.systemLanguage ||
navigator.userLanguage ||
'en'
)
.substr(0, 2)
.toLowerCase(),
r = '?',
n = '';
if (
((p.multitrack = [
{ lang: 'RU', title: 'Р СѓСЃСЃРєРёР№' },
{ lang: 'EN', title: 'English' },
]),
p.event.multitrack &&
4 < p.event.multitrack.length &&
(p.multitrack = JSON.parse(p.event.multitrack)),
p.lang)
)
for (var s in p.multitrack)
p.multitrack[s].lang &&
p.multitrack[s].lang.toLowerCase() == p.lang &&
(t = p.lang);
null != e && (p.current_lang = e);
for (var i = 0; i < p.multitrack.length; i++)
t == p.multitrack[i].lang.toLowerCase() &&
null == p.current_lang &&
(p.current_lang = i),
(null != e && e != i) ||
(r +=
'&aid=' +
i +
'&aname_' +
i +
'=' +
p.multitrack[i].title +
'&acode_' +
i +
'=' +
p.multitrack[i].lang.toUpperCase());
(r += '&adefault=' + p.current_lang),
1 != p.event.use_dvr && (n = '&live=' + p.live_duration);
var a;
function o(e, t, r, n, s, i) {
return v(((a = v(v(t, e), v(n, i))) << (o = s)) | (a >>> (32 - o)), r);
var a, o;
}
function c(e, t, r, n, s, i, a) {
return o((t & r) | (~t & n), e, t, s, i, a);
}
function u(e, t, r, n, s, i, a) {
return o((t & n) | (r & ~n), e, t, s, i, a);
}
function _(e, t, r, n, s, i, a) {
return o(t ^ r ^ n, e, t, s, i, a);
}
function g(e, t, r, n, s, i, a) {
return o(r ^ (t | ~n), e, t, s, i, a);
}
function v(e, t) {
var r = (65535 & e) + (65535 & t);
return (((e >> 16) + (t >> 16) + (r >> 16)) << 16) | (65535 & r);
}
return (
(p.src.split('?')[0] || p.src) +
r +
n +
'&confid=' +
((a = r + n),
(a = unescape(encodeURIComponent(a))),
(result = (function (e) {
for (var t, r = '0123456789ABCDEF', n = '', s = 0; s < e.length; s++)
(t = e.charCodeAt(s)),
(n += r.charAt((t >>> 4) & 15) + r.charAt(15 & t));
return n;
})(
(function (e) {
for (var t = '', r = 0; r < 32 * e.length; r += 8)
t += String.fromCharCode((e[r >> 5] >>> r % 32) & 255);
return t;
})(
(function (e, t) {
(e[t >> 5] |= 128 << t % 32), (e[14 + (((t + 64) >>> 9) << 4)] = t);
for (
var r = 1732584193,
n = -271733879,
s = -1732584194,
i = 271733878,
a = 0;
a < e.length;
a += 16
) {
var o = r,
l = n,
p = s,
d = i;
(n = g(
(n = g(
(n = g(
(n = g(
(n = _(
(n = _(
(n = _(
(n = _(
(n = u(
(n = u(
(n = u(
(n = u(
(n = c(
(n = c(
(n = c(
(n = c(
n,
(s = c(
s,
(i = c(
i,
(r = c(
r,
n,
s,
i,
e[a + 0],
7,
-680876936
)),
n,
s,
e[a + 1],
12,
-389564586
)),
r,
n,
e[a + 2],
17,
606105819
)),
i,
r,
e[a + 3],
22,
-1044525330
)),
(s = c(
s,
(i = c(
i,
(r = c(
r,
n,
s,
i,
e[a + 4],
7,
-176418897
)),
n,
s,
e[a + 5],
12,
1200080426
)),
r,
n,
e[a + 6],
17,
-1473231341
)),
i,
r,
e[a + 7],
22,
-45705983
)),
(s = c(
s,
(i = c(
i,
(r = c(
r,
n,
s,
i,
e[a + 8],
7,
1770035416
)),
n,
s,
e[a + 9],
12,
-1958414417
)),
r,
n,
e[a + 10],
17,
-42063
)),
i,
r,
e[a + 11],
22,
-1990404162
)),
(s = c(
s,
(i = c(
i,
(r = c(
r,
n,
s,
i,
e[a + 12],
7,
1804603682
)),
n,
s,
e[a + 13],
12,
-40341101
)),
r,
n,
e[a + 14],
17,
-1502002290
)),
i,
r,
e[a + 15],
22,
1236535329
)),
(s = u(
s,
(i = u(
i,
(r = u(
r,
n,
s,
i,
e[a + 1],
5,
-165796510
)),
n,
s,
e[a + 6],
9,
-1069501632
)),
r,
n,
e[a + 11],
14,
643717713
)),
i,
r,
e[a + 0],
20,
-373897302
)),
(s = u(
s,
(i = u(
i,
(r = u(
r,
n,
s,
i,
e[a + 5],
5,
-701558691
)),
n,
s,
e[a + 10],
9,
38016083
)),
r,
n,
e[a + 15],
14,
-660478335
)),
i,
r,
e[a + 4],
20,
-405537848
)),
(s = u(
s,
(i = u(
i,
(r = u(r, n, s, i, e[a + 9], 5, 568446438)),
n,
s,
e[a + 14],
9,
-1019803690
)),
r,
n,
e[a + 3],
14,
-187363961
)),
i,
r,
e[a + 8],
20,
1163531501
)),
(s = u(
s,
(i = u(
i,
(r = u(
r,
n,
s,
i,
e[a + 13],
5,
-1444681467
)),
n,
s,
e[a + 2],
9,
-51403784
)),
r,
n,
e[a + 7],
14,
1735328473
)),
i,
r,
e[a + 12],
20,
-1926607734
)),
(s = _(
s,
(i = _(
i,
(r = _(r, n, s, i, e[a + 5], 4, -378558)),
n,
s,
e[a + 8],
11,
-2022574463
)),
r,
n,
e[a + 11],
16,
1839030562
)),
i,
r,
e[a + 14],
23,
-35309556
)),
(s = _(
s,
(i = _(
i,
(r = _(r, n, s, i, e[a + 1], 4, -1530992060)),
n,
s,
e[a + 4],
11,
1272893353
)),
r,
n,
e[a + 7],
16,
-155497632
)),
i,
r,
e[a + 10],
23,
-1094730640
)),
(s = _(
s,
(i = _(
i,
(r = _(r, n, s, i, e[a + 13], 4, 681279174)),
n,
s,
e[a + 0],
11,
-358537222
)),
r,
n,
e[a + 3],
16,
-722521979
)),
i,
r,
e[a + 6],
23,
76029189
)),
(s = _(
s,
(i = _(
i,
(r = _(r, n, s, i, e[a + 9], 4, -640364487)),
n,
s,
e[a + 12],
11,
-421815835
)),
r,
n,
e[a + 15],
16,
530742520
)),
i,
r,
e[a + 2],
23,
-995338651
)),
(s = g(
s,
(i = g(
i,
(r = g(r, n, s, i, e[a + 0], 6, -198630844)),
n,
s,
e[a + 7],
10,
1126891415
)),
r,
n,
e[a + 14],
15,
-1416354905
)),
i,
r,
e[a + 5],
21,
-57434055
)),
(s = g(
s,
(i = g(
i,
(r = g(r, n, s, i, e[a + 12], 6, 1700485571)),
n,
s,
e[a + 3],
10,
-1894986606
)),
r,
n,
e[a + 10],
15,
-1051523
)),
i,
r,
e[a + 1],
21,
-2054922799
)),
(s = g(
s,
(i = g(
i,
(r = g(r, n, s, i, e[a + 8], 6, 1873313359)),
n,
s,
e[a + 15],
10,
-30611744
)),
r,
n,
e[a + 6],
15,
-1560198380
)),
i,
r,
e[a + 13],
21,
1309151649
)),
(s = g(
s,
(i = g(
i,
(r = g(r, n, s, i, e[a + 4], 6, -145523070)),
n,
s,
e[a + 11],
10,
-1120210379
)),
r,
n,
e[a + 2],
15,
718787259
)),
i,
r,
e[a + 9],
21,
-343485551
)),
(r = v(r, o)),
(n = v(n, l)),
(s = v(s, p)),
(i = v(i, d));
}
return Array(r, n, s, i);
})(
(function (e) {
for (var t = Array(e.length >> 2), r = 0; r < t.length; r++)
t[r] = 0;
for (r = 0; r < 8 * e.length; r += 8)
t[r >> 5] |= (255 & e.charCodeAt(r / 8)) << r % 32;
return t;
})(a),
8 * a.length
)
)
)),
result.toLowerCase())
);
}
function render_track_button() {
var e;
(p.multitrack = []),
p.event.multitrack &&
4 < p.event.multitrack.length &&
(p.multitrack = JSON.parse(p.event.multitrack)),
player &&
player.core.getCurrentPlayback()._hls &&
0 < player.core.getCurrentPlayback()._hls.audioTracks.length &&
(e = player.core.getCurrentPlayback()._hls.audioTracks[
player.core.getCurrentPlayback()._hls.audioTrack
].lang),
$('.lang_arrow').css({ display: 'flex' }),
$('.lang_holder').html('');
for (var t = 0; t < p.multitrack.length; t++)
$('.lang_holder').append(
'<div data-id="' +
t +
'" onclick="switch_track(' +
t +
')">' +
p.multitrack[t].lang +
'</div>'
),
e ||
p.lang != p.multitrack[t].lang.toLowerCase() ||
(e = p.multitrack[t].lang);
(e = e || 'en'),
$('.lang_holder [data-id=' + p.current_lang + ']').addClass('active'),
$('.lang_text_holder').html(e.toUpperCase());
}
function switch_track(e) {
if (
player &&
player.core.getCurrentPlayback()._hls &&
player.core.getCurrentPlayback()._hls.audioTracks.length > e
) {
var t = player.core.getCurrentPlayback()._hls.audioTracks;
if (t[0] && t[0].lang)
for (var r = 0; r < t.length; r++)
t[r].lang &&
t[r].lang.toLowerCase() == p.multitrack[e].lang.toLowerCase() &&
(player.core.getCurrentPlayback()._hls.audioTrack = r);
else player.core.getCurrentPlayback()._hls.audioTrack = e;
p.current_lang = e;
} else {
p.current_lang = e;
var n = parseInt(player.getCurrentTime());
player.load(multitrack_master_playlist(e)),
p.event.use_dvr && player.seek(n),
player.play(),
player.unmute();
}
$('.lang_holder.active > div.active').removeClass('active'),
$('.lang_holder [data-id="' + p.current_lang + '"]').addClass('active'),
$('.lang_holder').removeClass('active'),
$('.lang_text_holder').html(p.multitrack[p.current_lang].lang),
$('.lang_arrow').removeClass('relax'),
setTimeout(function () {
$('.lang_arrow').addClass('relax');
}, 500);
}
function auth_hb_init() {
p.auth_hb_server ||
((p.auth_hb_server =
auth_hb_servers[Math.floor(Math.random() * auth_hb_servers.length)].src),
dmesg('Start auth hb init, server: ' + p.auth_hb_server),
$.ajax({
url: prefix + p.auth_hb_server + '/auth/issue',
method: 'POST',
data: JSON.stringify({
Subject: p.auth.key_id.toString() || p.key,
Id: p.guid,
}),
dataType: 'json',
cache: !0,
error: function (e, t, r) {
dmesg('Start auth hb init serror, server: ' + p.auth_hb_server, 3),
(p.auth_hb_server =
auth_hb_servers[
Math.floor(Math.random() * auth_hb_servers.length)
].src),
p.auth_hb_error_cnt++,
setTimeout(function () {
(p.auth_hb_server = void 0), auth_hb_init();
}, 5e3);
},
success: function (e) {
e.Token &&
((p.auth_hb_token = e.Token),
p.auth_hb_started || auth_hb2(),
(p.auth_hb_started = 1));
},
}));
}
function auth_hb2() {
if (((p.auth_hb_started = 1), !p.auth_hb_token))
return (
p.auth_hb_error_cnt++,
void setTimeout(function () {
auth_hb_init();
}, 5e3)
);
$.ajax({
url: prefix + p.auth_hb_server + '/auth/verify',
method: 'POST',
data: JSON.stringify({ Token: p.auth_hb_token, Id: p.guid }),
dataType: 'json',
cache: !0,
error: function (e, t, r) {
dmesg('Auth_hb2 error, server: ' + p.auth_hb_server, 3),
(p.auth_hb_server =
auth_hb_servers[
Math.floor(Math.random() * auth_hb_servers.length)
].src),
p.auth_hb_error_cnt++,
p.auth_hb_error_cnt,
p.event.auth_hb_error_limit,
hb_auth_lock(),
setTimeout(
function () {
auth_hb2();
},
p.event.auth_hb_delay
? 1e3 * p.event.auth_hb_delay + 1e3 * p.auth_hb_error_cnt
: 1e4
);
},
success: function (e) {
(p.auth_hb_error_cnt = 0) == e.Allow && hb_auth_lock(),
setTimeout(
function () {
auth_hb2();
},
p.event.auth_hb_delay
? 1e3 * p.event.auth_hb_delay + 1e3 * p.auth_hb_error_cnt
: 1e4
);
},
});
}
function hb_auth_lock() {
player && player.stop(),
$('.disable')
.html(
'ru' == p.lang
? 'Ошибка сети или ваш код используется на другом устройстве.'
: 'Network error or your password is being used on another device.'
)
.show(),
setTimeout(function () {
var e = location.href,
t = getJsonFromUrl(e);
console.log(t),
t.no_auto_login ||
(e = e + (e.indexOf('?') < 0 ? '?' : '&') + 'no_auto_login=1'),
t.key || (e = e + '&key=' + p.key),
(location.href = e);
}, 5e3);
}
function confirm_success_register_popup() {
$('.alert_window_popup').hide(),
writeStorage('successful_registration_popup_shown-' + p.event.id, '1');
}
function isFramed() {
var t = !1;
try {
t =
window != window.top ||
document != top.document ||
self.location != top.location;
} catch (e) {
t = !0;
}
return t;
}
function copyToClipboard(e) {
var t = document.createElement('textarea');
(t.value = e),
document.body.appendChild(t),
t.select(),
document.execCommand('copy'),
document.body.removeChild(t);
}
function click_for_id(e) {
copyToClipboard(p.guid),
$('.guid-wrapper').show(),
p.click_for_id || ((p.click_for_id = 1), $('.guid').html(p.guid));
}
function _toConsumableArray(e) {
return _arrayWithoutHoles(e) || _iterableToArray(e) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError('Invalid attempt to spread non-iterable instance');
}
function _iterableToArray(e) {
if (
Symbol.iterator in Object(e) ||
'[object Arguments]' === Object.prototype.toString.call(e)
)
return Array.from(e);
}
function _arrayWithoutHoles(e) {
if (Array.isArray(e)) {
for (var t = 0, r = new Array(e.length); t < e.length; t++) r[t] = e[t];
return r;
}
}
(window.initializeDoublePlayer = function (s, o) {
$('#player2').show();
var l,
d,
n,
r,
c = s.options.source,
i = !0;
n = 3 != o ? 'multicam' : 'normal';
var u,
_ = !1,
a = 0,
g = {
primary: { width: '200%', left: 0 },
secondary: { width: '200%', left: '-100%' },
};
$('div[data-player]').append($('#player2'));
var v,
t,
h = 0.25,
m = !0;
function f() {
(i = !i),
$('.pip-btn').attr(
'class',
i ? 'pip-mode pip-btn active' : 'pip-mode pip-btn'
),
$('.pip-menu-btn').attr(
'class',
i ? 'pip-menu-btn active' : 'pip-menu-btn'
),
i ? 'multicam' === n && O(getCurrentViewNum()) : $('#player2').hide(0);
}
function w() {
b(), y(), x();
}
function y() {
var e, t, r;
(e =
16 *
(r =
(r = m
? Math.round(($(window).height() * h) / 9)
: Math.round(($(window).width() * h) / 16)) < 10
? 10
: r) -
1),
(t = 9 * r),
$('#player2, #player2').css({ width: e, height: t }),
u.resize({ width: e, height: t });
var n = $('#player2'),
s = n[0].getBoundingClientRect();
if (
s.left < 0 ||
s.right > $('[data-player]').first().width() ||
s.top < 0 ||
s.bottom > $(window).height()
) {
var i = parseFloat(n[0].getAttribute('data-x')),
a = parseFloat(n[0].getAttribute('data-y'));
s.left < 0
? ((i -= s.left), n[0].setAttribute('data-x', i))
: s.right > $('[data-player]').first().width()
? ((i -= s.right - $('[data-player]').first().width()),
n[0].setAttribute('data-x', i))
: s.top < 0
? ((a -= s.top), n[0].setAttribute('data-y', a))
: s.bottom > $(window).height() &&
((a -= s.bottom - $(window).height()),
n[0].setAttribute('data-y', a)),
(n[0].style.webkitTransform = n[0].style.transform =
'translate(' + i + 'px, ' + a + 'px)');
}
}
function b() {
var e,
t = $('[data-player]').first(),
r = $('#player .video-custom-wrap').first();
(e =
'multicam' === n
? t.width() / t.height() > 16 / 9
? ((m = !0), Math.round((t.height() / 9) * 16 - 2))
: ((m = !1), '100%')
: t.width() / t.height() > 32 / 9
? ((m = !0), Math.round((t.height() / 9) * 32 - 2))
: ((m = !1), '95%')),
r.css('width', e);
r.width();
}
function k() {
var n = $(
'<div class="pip-controls"><div class="pip-menu-btn">PiP</div><div class="pip-container hidden"><svg viewbox="0 0 56 40" class="pip-mode pip-btn"><rect stroke-width="4" rx="4" ry="4" x="2" y="2" width="52" height="36" /><rect stroke-width="4" rx="2" ry="2" x="26" y="14" width="20" height="16" /></svg><hr><svg viewbox="0 0 56 40" class="pip-mode pip-first"><rect stroke-width="4" rx="4" ry="4" x="2" y="2" width="52" height="36" /><text x="29" y="25">1</text></svg><svg viewbox="0 0 56 40" class="pip-mode pip-second"><rect stroke-width="4" rx="4" ry="4" x="2" y="2" width="52" height="36" /><text x="29" y="25">2</text></svg><svg viewbox="0 0 56 40" class="pip-mode pip-both"><rect stroke-width="4" rx="4" ry="4" x="2" y="2" width="52" height="36" /><text x="16" y="25">1</text><text x="40" y="25">2</text><line x1="28" x2="28" y1="4" y2="36" /></svg></div></div>'
);
s.once(Clappr.Events.PLAYER_PLAY, function () {
$(
'#player .media-control-layer .media-control-right-panel[data-media-control]'
)
.last()
.append(n),
(p.no_multicam_sidebyside || p.event.no_multicam_sidebyside) &&
($('.pip-both').hide(0), $('.pip-container').css('top', '-137px'));
var e = 0 == getCurrentViewNum() ? 'first' : 'second',
t = $('.pip-btn').attr(
'class',
i ? 'pip-mode pip-btn active' : 'pip-mode pip-btn'
),
r = $('.pip-menu-btn').attr(
'class',
i ? 'pip-menu-btn active' : 'pip-menu-btn'
);
$('.pip-' + e).attr('class', 'pip-mode pip-' + e + ' active'),
r.on('click', function () {
$('.pip-container').toggleClass('hidden');
}),
t.on('click', function () {
f();
}),
$('.pip-both').on('click', function () {
p.block_switch || p.event.block_switch || (E(), w());
}),
$('.pip-first').on('click', function () {
p.block_switch ||
p.event.block_switch ||
(0 !== getCurrentViewNum() && (O(0), w()));
}),
$('.pip-second').on('click', function () {
p.block_switch ||
p.event.block_switch ||
(1 != getCurrentViewNum() && (O(1), w()));
}),
s.listenTo(
player.core.mediaControl,
Clappr.Events.MEDIACONTROL_HIDE,
function () {
$('.pip-container').addClass('hidden');
}
);
});
}
function S() {
'multicam' === n && 0 === r
? ($('.pip-first').attr('class', 'pip-mode pip-first active'),
$('.pip-second').attr('class', 'pip-mode pip-second'),
$('.pip-both').attr('class', 'pip-mode pip-both'))
: 'multicam' === n && 1 === r
? ($('.pip-first').attr('class', 'pip-mode pip-first'),
$('.pip-second').attr('class', 'pip-mode pip-second active'),
$('.pip-both').attr('class', 'pip-mode pip-both'))
: ($('.pip-first').attr('class', 'pip-mode pip-first'),
$('.pip-second').attr('class', 'pip-mode pip-second'),
$('.pip-both').attr('class', 'pip-mode pip-both active'));
}
function C() {
if (!p.block_switch && !p.event.block_switch) {
var e = l[0].style.left,
t = d[0].style.left;
l.css('left', t),
d.css('left', e),
(a = (a + 1) % 2),
(r = (r + 1) % 2),
p.no_multicam_sidebyside ||
p.event.no_multicam_sidebyside ||
1 !== a ||
$player2.show(0, function () {
$('#player2').off('click'), $('#player2').on('click', T);
}),
S();
}
}
function T() {
'normal' === n ? O() : E(), w();
}
function x() {
var e = $('[data-player]').first();
$('#left-overlay, #right-overlay').css({
width: e.width() / 2 + 'px',
height: e.height() + 'px',
top: 0,
}),
$('#left-overlay').css({ left: 0 }),
$('#right-overlay').css({ left: e.width() / 2 + 'px' });
}
function P() {
$('#left-overlay, #right-overlay').css('display', 'none');
}
function E() {
A();
var e = l.css('left'),
t = d.css('left');
(g.primary.left = '0px' === e || 0 == e ? 0 : '-100%'),
(g.secondary.left = '0px' === t || 0 == t ? 0 : '-100%'),
(n = 'normal'),
$('#player2').hide(),
l.css({ left: 0, width: '100%' }),
$('#left-overlay, #right-overlay').css('display', 'block'),
x(),
$('#player-divider').css('display', 'block'),
s.isPlaying() || s.play(),
u.pause(),
(r = 2),
S();
}
function O(e) {
(n = 'multicam'),
(a = 0),
s.isPlaying() && i && ((_ = !1), u.play()),
0 === e
? (l.css({ width: '200%', left: 0 }),
d.css({ width: '200%', left: '-100%' }))
: (l.css({ width: '200%', left: '-100%' }),
d.css({ width: '200%', left: 0 })),
$('#player-divider').css({ display: 'none' });
var t = $('#player2');
p.block_switch ||
p.event.block_switch ||
(t.off('click'), t.on('click', C)),
i && t.show(),
w(),
P(),
(r = e),
i && (clearInterval(v), (v = setInterval(L, 500))),
S();
}
function N() {
$('.resize-side-handle').show(),
$('.resize-handle').show(),
$('.close-secondary-player-btn').show();
}
function I() {
$('.resize-side-handle').hide(),
$('.resize-handle').hide(),
$('.close-secondary-player-btn').hide();
}
function e() {
s.play(), 'multicam' === n && i && ((_ = !1), u.play());
}
function A() {
clearInterval(v);
}
function L() {
1 < s.getCurrentTime() - u.getCurrentTime() && R();
}
function R(e) {
clearTimeout(t),
_
? ((e = e || s.getCurrentTime()), u.seek(e))
: (t = setTimeout(function () {
R(e);
}, 50));
}
function F() {
w();
var e = setInterval(w, 10);
setTimeout(function () {
clearInterval(e);
}, 400);
}
function M() {
s.listenTo(s, Clappr.Events.PLAYER_PAUSE, function () {
u.pause();
}),
s.listenTo(s.core.getCurrentPlayback(), Clappr.Events.PLAYBACK_PLAY, e),
s.listenTo(s, Clappr.Events.PLAYER_FULLSCREEN, function (e) {
setTimeout(w, 100);
}),
s.listenTo(s, Clappr.Events.PLAYER_SEEK, function (e) {
R(e);
});
}
interact('#player2')
.draggable({
inertia: !0,
restrict: {
restriction: 'parent',
endOnly: !0,
elementRect: { top: 0, left: 0, bottom: 1, right: 1 },
},
autoScroll: !1,
})
.on('dragmove', function (e) {
var t = e.target,
r = (parseFloat(t.getAttribute('data-x')) || 0) + e.dx,
n = (parseFloat(t.getAttribute('data-y')) || 0) + e.dy;
(r = Math.round(r)),
(n = Math.round(n)),
(t.style.webkitTransform = t.style.transform =
'translate(' + r + 'px, ' + n + 'px)'),
t.setAttribute('data-x', r),
t.setAttribute('data-y', n);
})
.resizable({
preserveAspectRatio: !0,
edges: { left: !0, right: !0, bottom: !0, top: !0 },
margin: 15,
})
.on('resizemove', function (e) {
var t = e.target,
r = $(t).find('.video-custom-wrap')[0],
n = parseFloat(t.getAttribute('data-x')) || 0,
s = parseFloat(t.getAttribute('data-y')) || 0,
i = parseInt(t.style.height.replace('px', '')) / 9,
a = Math.round(e.rect.height / 9),
o = 9 * a,
l = 16 * a - 1,
p = a / (i / h);
if (!(o < 90 || 0.5 < p) && ((h = p), i !== a)) {
var d = i - a;
e.edges.top && e.edges.left
? ((n += 16 * d), (s += 9 * d))
: e.edges.top && e.edges.right
? (s += 9 * d)
: e.edges.bottom && e.edges.left
? (n += 16 * d)
: !e.edges.top || e.edges.left || e.edges.right
? !e.edges.right || e.edges.top || e.edges.bottom
? !e.edges.bottom || e.edges.left || e.edges.right
? !e.edges.left ||
e.edges.top ||
e.edges.bottom ||
((n += 16 * d), (s += (9 * d) / 2))
: (n += (16 * d) / 2)
: (s += (9 * d) / 2)
: ((n += (16 * d) / 2), (s += 9 * d)),
(n = Math.round(n)),
(s = Math.round(s)),
(t.style.width = l + 'px'),
(t.style.height = o + 'px'),
(r.style.width = l + 'px'),
(r.style.height = o + 'px'),
(t.style.webkitTransform = t.style.transform =
'translate(' + n + 'px,' + s + 'px)'),
t.setAttribute('data-x', n),
t.setAttribute('data-y', s),
y();
}
})
.on('dragstart resizestart', function (e) {
$(e.target).css('pointer-events', 'none'),
$('#player').css('pointer-events', 'none');
})
.on('dragend resizeend', function (e) {
$(e.target).css('pointer-events', 'all'),
$('#player').css('pointer-events', 'all');
}),
$(document).ready(function () {
var e, t, r, n, s;
($player2 = $('#player2')),
(l = $('#player').find('video')).css({ width: '200%', left: 0 }),
(e = {
source: c,
parentId: '#player2',
autoPlay: !1,
width: 512,
height: 288,
mute: !0,
persistConfig: !1,
disableVideoTagContextMenu: !0,
allowUserInteraction: !1,
chromeless: !0,
hlsjsConfig: {},
}),
(t = new Clappr.Player(e)),
(d = $('#player2').find('video')).css({ width: '200%', left: '-100%' }),
(u = t).on(Clappr.Events.PLAYER_PLAY, function () {
_ = !0;
}),
u.on(Clappr.Events.PLAYER_STOP, function () {
_ = !0;
}),
$('#player')
.find('video')
.wrap('<div class="video-custom-wrap"></div>'),
(r = $('div[data-player]').first()),
$('.video-custom-wrap')
.first()
.append('<div id="player-divider"></div>'),
p.block_switch ||
p.event.block_switch ||
(r.append('<div id="left-overlay"></div>'),
r.append('<div id="right-overlay"></div>'),
$('#left-overlay').on('click', function (e) {
e.stopPropagation(), O(0);
}),
$('#right-overlay').on('click', function (e) {
e.stopPropagation(), O(1);
})),
(n = $('#player2')).append(
'<span class="resize-side-handle handle-top"></span>'
),
n.append('<span class="resize-side-handle handle-right"></span>'),
n.append('<span class="resize-side-handle handle-bottom"></span>'),
n.append('<span class="resize-side-handle handle-left"></span>'),
n.append('<span class="resize-handle handle-bottom-right"></span>'),
n.append('<span class="resize-handle handle-bottom-left"></span>'),
n.append('<span class="resize-handle handle-top-right"></span>'),
n.append('<span class="resize-handle handle-top-left"></span>'),
$('.handle-left, .handle-right').on('mouseenter', function () {
this.style.cursor = 'ew-resize';
}),
$('.handle-top, .handle-bottom').on('mouseenter', function () {
this.style.cursor = 'ns-resize';
}),
$('.handle-top-left, .handle-bottom-right').on(
'mouseenter',
function () {
this.style.cursor = 'nwse-resize';
}
),
$('.handle-top-right, .handle-bottom-left').on(
'mouseenter',
function () {
this.style.cursor = 'nesw-resize';
}
),
(s = $(
'<div class="close-secondary-player-btn"><svg x="0" y="0" width="16" height="16" viewBox="0 0 41.756 41.756"><g><path d="M27.948,20.878L40.291,8.536c1.953-1.953,1.953-5.119,0-7.071c-1.951-1.952-5.119-1.952-7.07,0L20.878,13.809L8.535,1.465 c-1.951-1.952-5.119-1.952-7.07,0c-1.953,1.953-1.953,5.119,0,7.071l12.342,12.342L1.465,33.22c-1.953,1.953-1.953,5.119,0,7.071 C2.44,41.268,3.721,41.755,5,41.755c1.278,0,2.56-0.487,3.535-1.464l12.343-12.342l12.343,12.343 c0.976,0.977,2.256,1.464,3.535,1.464s2.56-0.487,3.535-1.464c1.953-1.953,1.953-5.119,0-7.071L27.948,20.878z" fill="#FFFFFF"/></g></svg></div>'
)).on('click', function (e) {
e.stopPropagation(), f();
}),
$('#player2').append(s),
w();
var i = $('[data-player]').first().width() - $player2.width(),
a = $('[data-player]').first().height() - $player2.height() - 75;
$player2[0].setAttribute('data-x', i),
$player2[0].setAttribute('data-y', a),
$player2.css({ transform: 'translate(' + i + 'px, ' + a + 'px)' }),
$player2.on('mouseenter', N),
$player2.on('mouseleave', I),
M(),
1 == o
? O(0)
: 2 == o
? O(1)
: (p.event.autorun && !1 !== p.autorun) || p.autorun
? E()
: $('.player-poster[data-poster]').on('click', E),
(sh_chat || p.event.chat_open || p.chat_open) && F(),
k();
}),
$(window).on('resize', w),
$('#cnt').on('click', F),
(window.changeSecondaryPlayerSource = function (e) {
u.configure({ source: p.src }),
(_ = !1),
u.play(),
u.listenToOnce(u, Clappr.Events.PLAYER_PLAY, function () {
M(),
$('#player')
.find('video')
.wrap('<div class="video-custom-wrap"></div>'),
(d = $('#player2').find('video').first()),
$('.video-custom-wrap')
.first()
.append('<div id="player-divider"></div>'),
0 === (e = e || 0) || 1 === e
? ($('#player2').off('click', C),
O(e),
(a = 0),
s.play(),
R(),
i && $('#player2').show())
: (E(), b()),
$('#left-overlay').detach().appendTo($('div[data-player]').first()),
$('#right-overlay')
.detach()
.appendTo($('div[data-player]').first()),
$('.resize-handle, .resize-side-handle')
.detach()
.appendTo($('#player2'));
});
}),
(window.setupPiPControls = k),
(window.hideSecondViewPlayer = function () {
A(), (_ = !1), u.stop(), E(), $('#player2').hide(), P();
}),
(window.getCurrentViewNum = function () {
return r;
}),
(window.getSecondaryPlayer = function () {
return u;
}),
(window.updatePrimaryVideo = function () {
l = $('#player').find('video').first();
});
}),
Object.assign ||
Object.defineProperty(Object, 'assign', {
enumerable: !1,
configurable: !0,
writable: !0,
value: function (e, t) {
'use strict';
if (null == e)
throw new TypeError('Cannot convert first argument to object');
for (var r = Object(e), n = 1; n < arguments.length; n++) {
var s = arguments[n];
if (null != s)
for (
var i = Object.keys(Object(s)), a = 0, o = i.length;
a < o;
a++
) {
var l = i[a],
p = Object.getOwnPropertyDescriptor(s, l);
void 0 !== p && p.enumerable && (r[l] = s[l]);
}
}
return r;
},
}),
Array.prototype.includes ||
Object.defineProperty(Array.prototype, 'includes', {
value: function (e, t) {
if (null == this) throw new TypeError('"this" is null or not defined');
var r = Object(this),
n = r.length >>> 0;
if (0 == n) return !1;
var s,
i,
a = 0 | t,
o = Math.max(0 <= a ? a : n - Math.abs(a), 0);
for (; o < n; ) {
if (
(s = r[o]) === (i = e) ||
('number' == typeof s &&
'number' == typeof i &&
isNaN(s) &&
isNaN(i))
)
return !0;
o++;
}
return !1;
},
});
var WIDTH_BREAKPOINT_ON_SHOW_NAVIGATION_EPISODES = 720;
function createFacebookPixelScript(e) {
var t = document.createDocumentFragment(),
r = document.createElement('script');
r.innerHTML =
"!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init', '" +
e +
"');fbq('track', 'PageView');";
var n = document.createElement('noscript'),
s = document.createElement('img');
return (
(s.width = 1),
(s.height = 1),
(s.style.display = 'none'),
(s.src = 'https://www.facebook.com/tr?id=' + e + '&ev=PageView&noscript=1'),
n.appendChild(s),
t.appendChild(r),
t.appendChild(n),
t
);
}
function createYandexMetrikaScript(e) {
var t = document.createDocumentFragment(),
r = document.createElement('script');
r.innerHTML =
'(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");ym(' +
e +
', "init", {clickmap:true,trackLinks:true,accurateTrackBounce:true});';
var n = document.createElement('noscript');
return (
n.appendChild(document.createElement('div')),
(n.firstElementChild.innerHTML =
'<img src="https://mc.yandex.ru/watch/' +
e +
'" style="position:absolute; left:-9999px;" alt="" />'),
t.appendChild(r),
t.appendChild(n),
t
);
}
function createGoogleAnalyticsScript(e) {
var t = document.createDocumentFragment(),
r = document.createElement('script');
(r.src = 'https://www.googletagmanager.com/gtag/js?id=' + e), (r.async = !0);
var n = document.createElement('script');
return (
(n.innerHTML =
"window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '" +
e +
"');"),
t.appendChild(r),
t.appendChild(n),
t
);
}
function send_stat() {
$.ajax({
url: prefix + 'dev.facecast.io/player_stat_collector.php',
method: 'POST',
data: {
dmesg: dmsg,
guid: p.guid,
key: p.key,
code: code,
event_id: p.event.id,
servers: servers,
url: url,
},
error: function () {},
success: function (e) {},
});
}
function redraw_labels() {
!no_label &&
p.event &&
(1 == p.event.is_live
? ($('.awa, .rec').hide(), $('.live-text').show())
: ($('.live-text, .awa, .rec, .vcnt').hide(),
p.event.duration < 15 && $('.awa').show()));
}
function hb_schedule() {
p.hb_s ||
((p.hb_s = 1),
p.event.stat_hb_delay || (p.event.stat_hb_delay = 30),
setInterval(function () {
hb();
}, 1e3 * p.event.stat_hb_delay));
}
function check_live(e) {
var t = Date.now();
p.event &&
p.duration_check &&
p.event.duration &&
p.event.duration != e &&
(0 == p.event.is_live &&
p.player_loaded &&
(player.play(), dmesg('Stream go live, run player')),
(p.event.is_live = 1)),
t > p.duration_check + 1e4 &&
!p.isMobile &&
(p.duration_livecheck == e &&
(1 == p.event.is_live && dmesg('Event become offline'),
(p.event.is_live = 0)),
(p.duration_livecheck = e),
(p.duration_check = t)),
p.duration_check || ((p.duration_check = t), (p.duration_livecheck = e)),
redraw_labels();
}
no_animation && $spinner.hide(),
no_label && $('.name, .description, .description-date').hide(),
no_date && $('.description-date-wrap .description-date').hide(),
(p.ref = document.referrer),
(p.locale = navigator.language || navigator.languages[0]),
(p.sid = getCookie('sid')),
determineUserLang(),
parseQueryString(),
'jzv4nr' == code &&
(window.location.href =
'https://videoforevent.com/reso' + (p.key ? '?fc_key=' + p.key : '')),
p.css && document.write('<link rel="stylesheet" href="' + p.css + '">'),
p.isMobile && document.write('<link rel="stylesheet" href="mobile.css">'),
$(document).ready(function () {
dmesg(
'Start <a target="_blank" href="' +
document.location +
'">' +
document.location +
'</a>'
),
dmesg(window.navigator.platform + ' / ' + window.navigator.userAgent),
dmesg('GUID = ' + p.guid),
p.ref &&
dmesg(
'ref = <a target="_blank" href="' + p.ref + '">' + p.ref + '</a>'
),
-1 < (window.location.href + p.ref).indexOf('fcdebug') &&
$('#fcdebug').show(),
!p.key &&
p.ref &&
-1 < p.ref.indexOf('fc_key') &&
(p.key = getJsonFromUrl(p.ref).fc_key),
get_urls(),
'ru' !== p.lang
? ch_lang()
: $('#LNIframe .names .name-wrap .name').text('Загрузка...'),
window.addEventListener
? window.addEventListener('message', msg_receive)
: window.attachEvent('onmessage', msg_receive),
setTimeout(function () {
send_stat();
}, 15e3),
p.isMobile;
});
var onHlsFragCh = function (e, t) {
p.player_frag_url &&
p.player_frag_url != t.frag.url &&
(0 == p.event.is_live && dmesg('Stream become live'),
(p.event.is_live = 1),
(p.event.duration = 16),
dmesg(
'Playing chunk ' +
t.frag.url.substring(t.frag.url.lastIndexOf('/') + 1, 990)
),
redraw_labels()),
(p.player_frag_url = t.frag.url);
};
function duration(e) {
var i = 0;
if (
((e = e && e.replace('live=' + p.live_duration, '')),
p.player_loaded ||
p.duration_src ||
!e ||
(dmesg('Getting master playlist'),
$('.awa, .rec').hide(),
$.ajax({
type: 'GET',
url: e,
crossDomain: !0,
cache: !0,
dataType: 'text',
error: function () {
hb_schedule();
},
success: function (e) {
e && 0 < e.length
? (e.split('\n').forEach(function (e) {
-1 == e.indexOf('#') && 2 < e.length && (p.duration_src = e);
}),
(p.duration_src = p.duration_src
? p.src.substring(0, p.src.lastIndexOf('/') + 1) +
p.duration_src.replace('?live=' + p.live_duration, '')
: void 0),
dmesg('Getting Q Playlist = ' + p.duration_src),
p.duration_src ? duration() : hb_schedule())
: hb_schedule();
},
})),
!p.player_loaded &&
p.duration_src &&
p.event &&
$.ajax({
type: 'GET',
url: p.duration_src,
crossDomain: !0,
cache: !0,
dataType: 'text',
error: function () {
hb_schedule();
},
success: function (e) {
hb_schedule();
var t,
r = e.split('\n'),
n = 0,
s = 0;
r.forEach(function (e) {
0 == e.indexOf('#EXTINF:') &&
0 < (t = e.substr(8, e.lenght).replace(',', '')).length &&
((i += parseFloat(t)), n++),
0 == e.indexOf('#EXT-X-ENDLIST') && (s = 1);
}),
dmesg(
'Playlist parsed (' +
n +
' chunks), duration: ' +
Math.floor(i) +
' sec'
),
s &&
p.event &&
!p.isMobile &&
((p.ended = 1), (p.event.is_live = 0)),
check_live(i),
(p.event.duration = i),
p.player_loaded || try_load();
},
}),
p.player_loaded &&
1 == p.event.use_dvr &&
!p.ended &&
player.isPlaying &&
player.isPlaying() &&
((i = player.getDuration()),
dmesg('Get duration from player, ' + p.event.duration + ' sec'),
check_live(i),
(p.event.duration = i),
hb_schedule()),
p.player_loaded && 0 == p.event.use_dvr)
) {
var t = Date.now();
player.isPlaying() ||
((p.player_frag_listener = void 0), (p.duration_check = t)),
!p.player_frag_listener &&
player.isPlaying() &&
'object' == typeof player.core.getCurrentPlayback()._hls &&
'function' == typeof player.core.getCurrentPlayback()._hls.on &&
(player.core
.getCurrentPlayback()
._hls.on('hlsFragChanged', onHlsFragCh),
(p.player_frag_listener = 1),
(p.duration_check = t)),
t > p.duration_check + 15e3 &&
!p.isMobile &&
(p.frag_livecheck == p.player_frag_url &&
(1 == p.event.is_live && dmesg('Stream become offline'),
(p.event.is_live = 0)),
(p.frag_livecheck = p.player_frag_url),
(p.duration_check = t)),
redraw_labels(),
hb_schedule();
}
hb_schedule();
}
function msg_receive(e) {
if (e && e.data && e.data.indexOf && 0 < e.data.indexOf(code)) {
var t = JSON.parse(e.data);
t &&
t.frame == code &&
(dmesg('Message: ' + e.data),
t.src && 0 == t.src.indexOf('http') && player && player.load(t.src),
'play' == t.exec && player && player.play(),
'pause' == t.exec && player && player.pause(),
'stop' == t.exec && player && player.stop(),
'mute' == t.exec && player && player.mute(),
'setVolume' != t.exec ||
!player ||
('number' != typeof t.volume && 'string' != typeof t.volume) ||
player.setVolume(parseInt(t.volume)),
'unmute' == t.exec && player && player.unmute(),
'seek' != t.exec ||
('number' != typeof t.seektime && 'string' != typeof t.seektime) ||
!player ||
player.seek(parseFloat(t.seektime)),
'switch_lang' == t.exec &&
'number' == typeof t.lang_id &&
player &&
1 == p.event.mlang &&
switch_track(t.lang_id),
'get' == t.exec && p.src && send_player_stat_message('get'),
'update_storage' == t.exec && updateStorage(t.data));
}
}
function send_player_stat_message(e) {
if (window.parent) {
var t = {
origin: 'Facecast_player',
source_frame: code,
src: p.src,
event_id: p.event.id,
server: url.media,
multitrack: p.event.multitrack,
current_lang: p.current_lang,
use_dvr: p.event.use_dvr,
isPlaying: !1,
event: e,
};
p.run1 &&
((t.currentTime = player.getCurrentTime()),
(t.duration = player.getDuration()),
(t.isPlaying = player.isPlaying())),
p.seek_to && ((t.seek_to = p.seek_to), (p.seek_to = void 0)),
window.parent.postMessage(JSON.stringify(t), '*');
}
}
function updateStorage(t) {
Object.keys(t).forEach(function (e) {
storageData[e] = t[e];
});
}
function determineUserLang() {
var e = ['ru'];
-1 == $.inArray(p.locale.substring(0, 2).toLowerCase(), e) &&
-1 == $.inArray(p.locale.substring(3, 5).toLowerCase(), e) &&
(p.lang = 'en');
}
function parseQueryString() {
for (
var e = new ParsedQueryString(), t = e.params(!1), r = 0;
r < t.length;
r++
) {
var n = t[r],
s = e.param(n);
('true' !== s && 'false' !== s) || (s = 'true' === s),
'src' !== n.toLowerCase() && ((n = escapeHtml(n)), (s = escapeHtml(s))),
'srv' === n.toLowerCase() && s && (p.srv_query = 1),
(p[n] = s),
dmesg('URL: ' + n + ' = ' + e.param(n));
}
}
function escapeHtml(e) {
var t = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;',
};
return String(e).replace(/[&<>"'`=\/]/g, function (e) {
return t[e];
});
}
function getCookie(e) {
for (
var t = e + '=', r = document.cookie.split(';'), n = 0;
n < r.length;
n++
) {
for (var s = r[n]; ' ' == s.charAt(0); ) s = s.substring(1);
if (0 == s.indexOf(t)) return s.substring(t.length, s.length);
}
return '';
}
function ch_lang() {
$('#LNIframe .names .name-wrap .name').text('Loading...'),
$('.title').html('Authentication'),
$('.validation_title').html('phone verification'),
$('.validation_code').html('Enter the code received via SMS'),
$('.alert_window_popup_title').html('Successful registration'),
$('.viewer_presence_window_popup_title').html('Presence confirmation'),
$(
'.viewer_presence_window_popup .alert_window_body .alert_window_msg'
).html('Confirm your presence'),
$('.alert_window_popup .alert_window_body .alert_window_msg').html(
'You are registered for the event.'
),
$('.sbtn-alert-confirm').val('Watch'),
$('.event_code').html('Enter password'),
$('.name').html('Loading...'),
$('.sbtn4, .sbtn').val('Log in'),
$('.sbtn-validation').val('submit'),
$('.sbtn-validation-change-phone').html('change phone'),
$('.sbtn-validation-repeat').html('send the code again'),
$('.sbtn42').val('Buy ticket'),
$('#live-text').html('Live'),
$('.rec').html('Record'),
$('.awa').html('Awaiting for start...'),
$('.disable').html('Event is locked'),
$('.broadcast_end').html('Stream is offline'),
$('.userreg__body__accept label').html(
"I accept the personal data processing <a href='//facecast.net/legal/' target='_blank'>agreement</a>"
),
$('.userreg__window > .userreg__header > .userreg__header__title').html(
'Registration at the event'
),
$('.userreg__body__name > h3').html('Name'),
$('.userreg__body__phone > h3').html('Phone'),
$('#userreg-btn').val('Register'),
$('.userreg__warning').html(
'* Enter your existing email address. You will use this to get your code for watching.'
),
$('.userreg_phone_warning').html(
'** Enter your existing phone number, a confirmation code will be sent to it.'
),
$('.userreg__code__title').html('Have the code?'),
$('.userreg__window #userreg-auth-btn').val('Watch'),
$('.userreg-goback').html('Have a code?'),
$(
'.userreg__window-short > .userreg__header > .userreg__header__title'
).html('Watch'),
$('.userreg__window-short #userreg-auth-btn').val('Watch'),
$('#userreg-reg-btn-short').val('Register'),
$(
'.userreg__window-short > .userreg > div > .userreg__form > .userreg__code'
).html('Enter code'),
$('.us-body > h3').html('Enter the code received by email');
}
function ch_player_lang() {
$('#level-selector-id > div.label').html('Quality'),
$(
'#player > div:nth-child(3) > div.media-control.live.media-control > div.media-control-layer > div.media-control-right-panel > div.settings_menu > div > div:nth-child(1) > div.label'
).html('Video quality'),
$('#player-reload').html('Reload'),
$('#audio-tracks-id .label').text('Audio track');
}
function try_load() {
if (!p.player.loaded) {
if (
(dmesg('Try load. ' + p.autorun + ' ' + p.event.is_live),
setTimeout(try_load, 5e3),
!p.src)
)
return;
!p.auth_hb_token &&
p.key &&
2 != p.event.view_mode_id &&
7 != p.event.view_mode_id &&
p.auth_hb_req &&
auth_hb_init(),
!p.chat &&
p.event.chat &&
(show_chat_button(),
(!sh_chat && '1' != p.event.chat_open) || show_chat()),
(p.event.date_plan_start_ts - new Date().getTime() / 1e3 < 1 ||
p.event.is_live) &&
($spinner.show(), countdown_stop()),
0 < p.event.duration &&
p.event.duration < 15 &&
(countdown_stop(), $spinner.show()),
15 < p.event.duration && countdown_stop(),
0 == p.event.is_live &&
0 == p.event.use_dvr &&
15 <= p.event.duration &&
$spinner.hide(),
1 == p.event.is_live &&
0 == p.event.use_dvr &&
15 <= p.event.duration &&
($spinner.hide(), $('.broadcast_end').hide()),
5 <= p.event.duration && 1 != p.event.has_disabled && Player('load'),
redraw_labels();
}
}
function init_src() {
if (!p.event.id)
return (
dmesg(
'Eventdata return event error: ' + p.event.error + '. Stop executing',
3
),
((e = new Image()).src = 'https://www.cdn.facecast.net/' + p.def_poster),
(e.onload = function () {
$('#player').css('background-image', 'url(' + e.src + ')');
}),
$spinner.hide(),
void $('.name').html('Ошибка: ' + p.event.error)
);
var e,
t = new Image();
((e = new Image()).src =
'https://www.cdn.facecast.net/f/7/' +
p.event.image_id +
'-preview22.' +
p.event.poster_extension),
(e.onload = function () {
$('#player').css('background-image', 'url(' + e.src + ')'),
(t.src =
'https://www.cdn.facecast.net/f/7/' +
p.event.image_id +
'-preview19.' +
p.event.poster_extension),
(t.onload = function () {
$('#player').css('background-image', 'url(' + t.src + ')');
});
}),
(e.onerror = function () {
(t.src =
'https://www.cdn.facecast.net/f/7/' +
p.event.image_id +
'-preview19.' +
p.event.poster_extension),
(t.onload = function () {
$('#player').css('background-image', 'url(' + t.src + ')');
});
}),
(p.poster =
'https://www.cdn.facecast.net/f/7/' +
p.event.image_id +
'-preview19.' +
p.event.poster_extension),
(document.title = p.event.has_whitelabel
? p.event.name
: p.event.name + ' - Facecast'),
$('.name').html(p.event.name),
'-' == p.event.name && $('.name').hide(),
$('.description').html(p.event.description.trim()),
p.event.description.trim()
? no_label || $('.description').show().css('display', 'block')
: $('.description-wrap').hide(0),
$('.description-date').html(p.event.date_plan_start),
date_format(),
$(window).on('resize', reload_background),
$('.player_wrap').on('resize', reload_background),
reload_background();
}
function run_player() {
dmesg('Start loading player', 1),
1 != p.autorun && (p.autorun = !1),
p.event &&
(1 === p.event.has_polls
? (window.eDataUpdateInterval = setInterval(
get_event,
1e3 * p.poll_hb_delay
))
: (window.eDataUpdateInterval = setInterval(
get_event,
1e3 * p.event.hb_delay
)));
var t,
e =
'https://facecast.net?utm_source=facecast&utm_medium=player&utm_campaign=logo&utm_content=' +
((window.location != window.parent.location
? document.referrer
: document.location.href) || '') +
'&utm_term=' +
(p.utm_term || ''),
r = !(p.event && p.event.has_whitelabel),
n = {
controls: Clappr.Browser.isMobile || Clappr.Browser.isiOS,
playInline: !0,
recycleVideo: Clappr.Browser.isiOS,
hlsjsConfig: {
abrMaxWithRealBitrate: !0,
startLevel: parseInt(p.startLevel, 10),
capLevelToPlayerSize: !0,
initialLiveManifestSize: 3,
liveSyncDurationCount: 4,
xhrSetup: function (e, t) {
if (p.srv) {
var r = new URL(t),
n = r.pathname;
if (
p &&
p.event &&
(2 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id ||
7 == +p.event.view_mode_id) &&
p.auth
) {
var s = n.split(p.auth.cdn_src);
(n = 1 < s.length ? s[1] : n.split(p.auth.edge_src)[1]),
(n = servers.filter(function (e) {
return -1 !== e.src.indexOf(p.srv);
})[0].cdn
? '/' + p.auth.cdn_src + n
: '/' + p.auth.edge_src + n);
}
(t = r.protocol + '//' + p.srv.split('.')[0] + '.facecast.net' + n),
(t += ['?live=' + p.live_duration, ''][p.event.use_dvr]);
}
e.open('GET', t, !0),
(e.onerror = function () {
p.edgetest_in_progress ||
p.speedtest_in_progress ||
(dmesg('XHR error. Starting speedtest...'),
(p.edgetest_trigger = 'xhr'),
edgetest());
});
},
},
};
try {
t = JSON.parse(p.event.episodes);
} catch (e) {
t = [];
}
var s = (t = t.map(function (e) {
return {
name: 'ru' === p.lang ? e.ru : e.en ? e.en : e.ru,
fragments: (e.fragments || []).map(function (e) {
return {
name: 'ru' === p.lang ? e.ru : e.en ? e.en : e.ru,
time: e.time,
};
}),
time: e.time,
};
})).reduce(function (e, t) {
return e.concat(
[{ name: t.name, time: t.time }].concat(_toConsumableArray(t.fragments))
);
}, []),
i = [];
try {
i = JSON.parse(p.event.banner_urls);
} catch (e) {}
var a = {
source:
p.event && 1 == p.event.mlang ? multitrack_master_playlist() : p.src,
parentId: '#player',
autoPlay: p.autorun,
exitFullscreenOnEnd: !!Clappr.Browser.isiOS,
plugins: {
core: [
SettingsMenu,
LevelSelector,
NavigationEpisodes,
MediaControlEpisodes,
EventsTracker,
AdvBanners,
],
},
eventsTracker: {
labelName: 'event_id',
label: p.event && p.event.id,
allowed: ['seek'],
},
advertisingBanners: {
bannerUrls: i,
loop:
!p.event ||
'number' != typeof p.event.banner_loop ||
Boolean(p.event.banner_loop),
bannerShowTime:
p.event && 'number' == typeof p.event.banner_show_time
? p.event.banner_show_time
: 10,
bannerShowDelay:
p.event && 'number' == typeof p.event.banner_show_delay
? p.event.banner_show_delay
: 60,
closable:
!p.event ||
'number' != typeof p.event.banner_closable ||
Boolean(p.event.banner_closable),
alignX: (p.event && p.event.banner_align) || 'center',
alignY: (p.event && p.event.banner_valign) || 'bottom',
},
playback: n,
VastAdsConfig: { AdXMLUrl: p.event && p.event.vast_url },
mediaControlEpisodes: { episodes: p && p.event ? s : [] },
navigationEpisodes: {
episodes: t,
width: 320,
breakpoint: 800,
immediatelyOpen: p && p.event && p.event.episodes_open,
},
width: '100%',
height: '100%',
poster: p.poster || p.def_poster,
disableVideoTagContextMenu: !0,
mute: !0,
persistConfig: !1,
language: p.lang,
logo: {
href: p.event && p.event.logo_path ? p.event.logo_click_url || '' : e,
src:
p.event && p.event.logo_path ? '//' + p.event.logo_path : '/v/logo.svg',
enabled: r,
},
hideMediaControl:
p.hideMediaControl || Clappr.Browser.isMobile || Clappr.Browser.isiOS,
gaAccount: p.ga || 'UA-53479775-3',
hlsjsConfig: {},
disableErrorScreen: !0,
events: {
onPlay: function () {
if (!p.run1) {
clappr_debug && Clappr.Log.setLevel(0),
dmesg('Player start playing video', 1),
$('.media-control[data-media-control]').css({ 'z-index': 0 }),
(p.run1 = 1);
try {
p.volume = readStorage('@facecast.net/player/volume');
} catch (e) {}
1 == p.event.mlang && render_track_button(),
hb(),
p.volume || (p.volume = 90),
p.muted && (p.volume = 0),
(function e() {
var t = player.getVolume();
t < p.volume
? (player.setVolume(t + 1),
(p.wait_for_volume = !0),
setTimeout(function () {
e();
}, 3))
: (p.wait_for_volume = !1);
})(),
'ru' != p.lang &&
setTimeout(function () {
ch_player_lang();
}, 1e3),
$('#player-reload').click(function () {
(p.autorun = !0),
player.configure({ autoPlay: !0 }),
reload_player();
}),
p.event.use_dvr || $('.media-control-center-panel').hide(),
js_after_playerload(),
p.event &&
p.event.mlang &&
p.event.is_live &&
0 == p.isMobile &&
player.seek(player.getDuration());
}
send_player_stat_message('play');
},
onPause: function () {
send_player_stat_message('pause');
},
onSeek: function (e) {
(p.seek_to = e), send_player_stat_message('seek');
},
onReady: function () {
dmesg('Player ready', 1);
try {
1 !== p.event.is_live &&
readStorage('@facecast.net/player/' + code + '/time') &&
(dmesg('Found time to seek in LocalStore, processing playlists'),
$.ajax({
type: 'GET',
url: p.src,
crossDomain: !0,
cache: !1,
dataType: 'text',
success: function (e) {
var t;
e &&
0 < e.length &&
(e.split('\n').forEach(function (e) {
-1 == e.indexOf('#') && 2 < e.length && (t = e);
}),
(p.duration_src =
p.src.substring(0, p.src.lastIndexOf('/') + 1) +
t.replace('?live=' + p.live_duration, '')),
dmesg('seekTo: p.duration.src = ' + p.duration_src),
$.ajax({
type: 'GET',
url: p.duration_src,
crossDomain: !0,
dataType: 'text',
success: function (e) {
var t,
r = e.split('\n'),
n = 0,
s = Number(
readStorage('@facecast.net/player/' + code + '/time')
);
r.forEach(function (e) {
0 == e.indexOf('#EXTINF:') &&
0 <
(t = e.substr(8, e.lenght).replace(',', ''))
.length &&
(n += parseFloat(t)),
0 == e.indexOf('#EXT-X-ENDLIST') &&
s &&
s < n - 60 &&
(dmesg('seekTo: X-ENDLIST found, seek'),
player.seek(s));
});
},
}));
},
}));
} catch (e) {}
if (
($spinner.hide(),
(p.player.loaded = !0),
(function () {
if (p.logo_src) {
((logo_image = new Image()).onload = function () {
parseFloat(p.logo_width) && parseFloat(p.logo_height)
? ((p.logo_width = parseFloat(p.logo_width)),
(p.logo_height = parseFloat(p.logo_height)))
: ((p.logo_width = logo_image.naturalWidth),
(p.logo_height = logo_image.naturalHeight)),
(p.logo_aspect_ratio = p.logo_width / p.logo_height),
resize_logo();
}),
$('#player [data-player]')
.first()
.prepend(
'<a class="logo" href="' +
p.logo_url +
'" target="_blank"></a>'
);
var e = $('[data-player] > .logo');
'top-right' === p.logo_position
? e.css({
top: '50px',
right: '30px',
'justify-content': 'flex-start',
})
: 'top-left' === p.logo_position
? e.css({
top: '50px',
left: '30px',
'justify-content': 'flex-start',
})
: 'bottom-left' === p.logo_position
? e.css({
bottom: '50px',
left: '30px',
'justify-content': 'flex-end',
})
: e.css({
bottom: '50px',
right: '30px',
'justify-content': 'flex-end',
}),
e.prepend(
'<img class="logo-image" src="' + p.logo_src + '" />'
);
var t = debounce(resize_logo, 25);
$(window).on('resize', t),
$('#player [data-player]').first().on('resize', t),
(logo_image.src = p.logo_src),
(p.logo_max_height = parseInt(p.logo_max_height) || 15),
e.css({
height: p.logo_max_height + '%',
opacity: p.logo_opacity || 1,
});
}
})(),
$('.description').on('click', function () {
$('.description').hide(), player.play();
}),
$('#player').first().append($('.comment_arrow')),
$('#player').first().append($('.lang_arrow')),
$('#player').first().append($('.lang_holder')),
p && p.event && p.event.has_episodes)
) {
var e = document.createElement('div');
(e.className = 'trigger-episode-button'),
e.addEventListener(
'click',
function (e) {
chatOpen && show_chat(),
this.getPlugin('episodes-navigation-container').slide(),
reload_background(),
setTimeout(
player.getPlugin('episodes-media-control').rerender,
1e3
);
}.bind(this)
),
e.appendChild(
document.createTextNode(
'en' === p.lang ? 'Episodes' : 'Р­РїРёР·РѕРґС‹'
)
),
$('#player').append(e);
var t = document.querySelector('.comment_arrow');
t && 'block' === t.style.display
? (e.style.marginTop = '-129px')
: (e.style.marginTop = 0);
}
$('#player').first().append($('#hypercomments_widget')),
$('#player').css({
'background-image': 'none',
'background-color': 'white',
}),
reload_background(),
setInterval(function () {
try {
p.run1 &&
!p.wait_for_volume &&
readStorage('@facecast.net/player/volume') !=
player.getVolume() &&
writeStorage('@facecast.net/player/volume', player.getVolume());
} catch (e) {}
}, 500),
setTimeout(function () {
fullscreenEnabled() &&
($('[data-fullscreen]').on('click', function (e) {
e.stopPropagation(),
isFullscreen()
? (cancelFullscreen(),
p.fullscreenalert && console.log('LeaveFullscreen'))
: (p.fullscreenalert && console.log('EnterFullscreen'),
requestFullscreen($('#player')[0]),
reload_background());
}),
$('.container[data-container]')
.first()
.on('dblclick doubleTap', function (e) {
e.stopPropagation();
}),
$('#player video')
.first()
.on('dblclick doubleTap', function (e) {
e.stopPropagation(),
isFullscreen()
? cancelFullscreen()
: (requestFullscreen($('#player')[0]),
reload_background());
}));
}, 1e3);
},
onTimeUpdate: function (e) {
try {
'flashls' !== player.core.getCurrentPlayback().name &&
writeStorage(
'@facecast.net/player/' + code + '/time',
Math.max(0, Math.round(e.current) - 2)
);
} catch (e) {}
},
},
};
p.event &&
0 != +p.event.use_dvr &&
(a.plugins.core.push(PlaybackRatePlugin),
(a.playbackRateConfig = {
defaultValue: '1.0',
options: [
{ value: '0.5', label: '0.5x' },
{ value: '0.75', label: '0.75x' },
{ value: '1.0', label: '1x' },
{ value: '1.1', label: '1.1x' },
{ value: '1.25', label: '1.25x' },
{ value: '1.5', label: '1.5x' },
{ value: '2.0', label: '2x' },
],
})),
p.event && p.event.vast_url && VastAds && a.plugins.core.unshift(VastAds),
(p.chromeless || Clappr.Browser.isMobile || Clappr.Browser.isiOS) &&
((a.chromeless = !0), (a.allowUserInteraction = !0)),
p &&
p.event &&
p.event.has_custom_counters &&
(p.event.yandex_metrika_id &&
!p.no_yandex_metrica &&
document.head.appendChild(
createYandexMetrikaScript(p.event.yandex_metrika_id)
),
p.event.google_analytics_id &&
document.head.appendChild(
createGoogleAnalyticsScript(p.event.google_analytics_id)
),
p.event.facebook_pixel_id &&
document.head.appendChild(
createFacebookPixelScript(p.event.facebook_pixel_id)
)),
(player = new Clappr.Player(a));
var o = null,
l = player.core.plugins.find(function (e) {
return 'playback_rate' == e.name;
});
player.listenTo(player, Clappr.Events.PLAYER_PLAY, function (e) {
o && clearInterval(o),
(o = setInterval(function () {
l &&
1 < +l.selectedRate &&
+(player.getDuration() - player.getCurrentTime()) < 10 &&
l.setSelectedRate('1.0');
}, 1e3));
}),
player.on(Clappr.Events.PLAYER_PAUSE, function (e) {
clearInterval(o), (o = null);
}),
player.on(Clappr.Events.PLAYER_STOP, function (e) {
clearInterval(o), (o = null);
}),
p && p.event && p.event.has_banners
? 'number' != typeof p.event.has_banners
? window.player.getPlugin('adv-banners').disable()
: Boolean(p.event.has_banners)
? window.player.getPlugin('adv-banners').enable()
: window.player.getPlugin('adv-banners').disable()
: window.player.getPlugin('adv-banners').disable(),
((p.event &&
p.event.has_multicam &&
(void 0 === p.multicam || !1 !== p.multicamJSON.parse(p.multicam))) ||
(void 0 !== p.multicam && JSON.parse(p.multicam))) &&
!p.isMobile &&
(window.initializeDoublePlayer(
player,
(p.event && !!p.event.has_multicam) || !!JSON.parse(p.multicam)
),
(multicamOn = !1)),
document.addEventListener('keydown', function (e) {
e.shiftKey &&
(39 === e.which && player.seek(player.getCurrentTime() + 5),
37 === e.which && player.seek(player.getCurrentTime() - 5));
}),
$('div[data-player]')
.first()
.append(
'<div id="thumbnail-player-track"><div id="thumbnail-player"><div class="thumbnail-times"><span class="thumbnail-seek-time"></span><span class="thumbnail-duration"></span></div></div></div>'
),
clappr_debug &&
player.once(Clappr.Events.PLAYER_PLAY, function () {
$('body').append(
'<div id="chunkContainer"><span>Current chunk: </span><span id="chunkNum">N\\A</span></div>'
);
var n = /\/(\d+.ts)/;
'object' == typeof player.core.getCurrentPlayback()._hls &&
'function' == typeof player.core.getCurrentPlayback()._hls.on &&
player.core
.getCurrentPlayback()
._hls.on('hlsFragChanged', function (e, t) {
var r = t.frag.url.match(n);
$('#chunkNum').text(r[r.length - 1]), console.log(t.frag.url);
});
});
var d = $('[data-controls]'),
c = ($('.bar-container[data-seekbar]'), $('.bar-hover')),
u = $('#thumbnail-player-track');
u.css('bottom', d.height() + c.height() + 'px');
var _ = $('.thumbnail-seek-time'),
g = $('.thumbnail-duration'),
v = $('#thumbnail-player'),
h = $('.thumbnail-times'),
m = v.height() + 10,
f = $('#hypercomments_widget');
f.on('mousemove', function () {
player.core.mediaControl.show();
});
var w = !1;
function y() {
var e = $('div[data-player]').height(),
r = {
playerWidth: 300 <= $('div[data-player]').width(),
playerHeight: 240 <= e,
internetSpeed: 1 < url.server.speed,
supportedBrowser: !mobileBrowserRegex.test(navigator.userAgent),
noFlash: 'flashls' !== player.core.getCurrentPlayback().name,
dvrEnabled: p.event && 0 !== p.event.use_dvr,
inSingleView: !(
(p.event &&
p.event.has_multicam &&
(void 0 === p.multicam ||
!1 !== p.multicamJSON.parse(p.multicam))) ||
(void 0 !== p.multicam && JSON.parse(p.multicam))
),
},
t = !!p.preview || (p.event && !!p.event.preview && !(!1 === p.preview)),
n = (p.event && !1 === p.event.preview && !p.preview) || !1 === p.preview;
return (
(Object.keys(r).reduce(function (e, t) {
return e && r[t];
}, !0) ||
t) &&
!n
);
}
function b() {
var s, i;
$('#thumbnail-zone').css('height', d.height() + c.height() + m),
$('[data-settings-menu]').on('click', function (e) {
(settingsOpen =
'none' !== $('[data-settings-menu] .container').css('display')),
l();
}),
$('[data-playback-rate-select]').on('click', function (e) {
(speedSelectOpen =
'none' !== $('[data-playback-rate-select] ul').css('display')),
l();
}),
$('#player > [data-player] > .media-control > .seek-time').addClass(
'hidden'
),
u.css('bottom', d.height() + c.height() + 'px');
var a = !1,
o = !0;
(thumbnailPlayer = createThumbnailPlayer()),
v.on('click', function () {
var e = thumbnailPlayer.getCurrentTime();
player.seek(e);
}),
thumbnailPlayer.on(Clappr.Events.PLAYER_ENDED, function () {
(o = !0), l();
});
var r = !1;
function n(e) {
!e.pageX && window.event && (e.pageX = window.event.pageX),
!e.pageY && window.event && (e.pageY = window.event.pageY),
e.pageY < u[0].offsetTop &&
(l(), (speedSelectOpen = settingsOpen = !1));
}
function l() {
clearInterval(i),
a &&
((a = !1),
$('#thumbnail-player-track').css({
'pointer-events': 'none',
opacity: 0,
}),
thumbnailPlayer &&
(s = setTimeout(function () {
thumbnailPlayer &&
thumbnailPlayer.isPlaying() &&
thumbnailPlayer.stop(),
(o = !0);
}, 3e3)),
v.fadeOut(350),
h.fadeOut(350));
}
function p() {
_.html(
$(
'#player > [data-player] > .media-control > .seek-time span:first'
).html()
);
var e = $('.seek-time span:nth-child(2)');
g.html(e.html()), g.css('display', e.css('display'));
}
(bindThumbnailPlayer = function (e) {
var t;
e.listenTo(e, Clappr.Events.PLAYER_PLAY, function (e) {
$('[data-fragment-dot="true"]').on('mouseenter', l);
}),
e.listenTo(
e.core.mediaControl,
Clappr.Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR,
function (e) {
!settingsOpen &&
!speedSelectOpen &&
w &&
r &&
(function (e) {
clearTimeout(s),
(d = $('[data-controls]')),
$('.bar-container[data-seekbar]'),
$('#thumbnail-player-track').css({
height: m + 'px',
'pointer-events': 'all',
opacity: 1,
}),
(a = a || !0);
var t = $('div[data-player] .container').width() - v.width(),
r = Math.max(0, e.clientX - v.width() / 2);
(r = Math.min(r, t)), v.css({ left: r, top: '5px' });
var n = toSeconds($('.seek-time:last span:first').html());
o
? (thumbnailPlayer.play(),
thumbnailPlayer.once(
Clappr.Events.PLAYER_PLAY,
function () {
(o = !1), thumbnailPlayer.seek(n);
}
))
: thumbnailPlayer.seek(n);
clearInterval(i),
(i = setInterval(p, 500)),
v.fadeIn(250),
h.fadeIn(250);
})(e);
}
),
e.listenTo(
e.core.mediaControl,
Clappr.Events.MEDIACONTROL_SHOW,
function () {
r ||
(clearTimeout(t),
(t = setTimeout(function () {
r = !0;
}, 100)),
u.css({
bottom:
$('[data-controls]').height() +
$('.bar-hover').height() +
'px',
transition: 'opacity 250ms, bottom 400ms ease-in-out',
}));
}
),
e.listenTo(
e.core.mediaControl,
Clappr.Events.MEDIACONTROL_HIDE,
function (e) {
clearTimeout(t),
(r = !1),
u.css({
bottom: 0,
transition: 'opacity 250ms, bottom 300ms ease-out',
}),
(speedSelectOpen = settingsOpen = !1);
}
),
e.on(Clappr.Events.PLAYER_FULLSCREEN, l),
e.on(Clappr.Events.PLAYER_ENDED, l),
$(window).on('resize', debounce(l, 50)),
$('[data-player]').first().on('mouseleave', l),
u.on('mouseleave', n);
})(player);
}
!(function e() {
if (!url.server || !url.server.speed) return void setTimeout(e, 500);
w = y();
w && b();
})(),
$(window).on(
'resize',
debounce(function () {
(w = y()),
!thumbnailPlayer && w && b(),
$(window).width() < 800 &&
(player.core.mediaControl.isVisible() &&
f.css('height', 'calc(100% - 50px)'),
f.css(
'transition',
'right 400ms, opacity 400ms, height 380ms ease-in-out, width 400ms, background-color 400ms'
));
}, 50)
),
$('[data-settings-menu]').on('click', function (e) {
$(window).width() < 800 &&
((chatOpen = !1), $(window).trigger('chat_close'), reload_background());
}),
$('[data-playback-rate-select]').on('click', function () {
player.play(),
$(window).width() < 800 &&
((chatOpen = !1),
$(window).trigger('chat_close'),
reload_background());
}),
player.listenTo(
player.core.mediaControl,
Clappr.Events.MEDIACONTROL_SHOW,
function () {
$(window).width() < 800 &&
f.css({
height: 'calc(100% - 40px)',
transition:
'right 400ms, opacity 400ms, height 380ms ease-in-out, width 400ms, background-color 400ms',
});
}
),
player.listenTo(
player.core.mediaControl,
Clappr.Events.MEDIACONTROL_HIDE,
function () {
f.css('height', '100%'),
$(window).width() < 800 &&
f.css(
'transition',
'right 400ms, opacity 400ms, height 300ms ease-out, width 400ms, background-color 400ms'
);
}
);
}
function isFullscreen() {
return !!(
document.webkitFullscreenElement ||
document.webkitIsFullScreen ||
document.mozFullScreen ||
document.msFullscreenElement
);
}
function requestFullscreen(e) {
e.requestFullscreen
? e.requestFullscreen()
: e.webkitRequestFullscreen
? e.webkitRequestFullscreen()
: e.mozRequestFullScreen
? e.mozRequestFullScreen()
: e.msRequestFullscreen
? e.msRequestFullscreen()
: e.querySelector &&
e.querySelector('video') &&
e.querySelector('video').webkitEnterFullScreen &&
e.querySelector('video').webkitEnterFullScreen();
}
function cancelFullscreen() {
document.exitFullscreen
? document.exitFullscreen()
: document.webkitCancelFullScreen
? document.webkitCancelFullScreen()
: document.webkitExitFullscreen
? document.webkitExitFullscreen()
: document.mozCancelFullScreen
? document.mozCancelFullScreen()
: document.msExitFullscreen && document.msExitFullscreen();
}
function fullscreenEnabled() {
return !!(
document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled
);
}
function toSeconds(e) {
var t = e.split(':');
return 0 === t.length
? 0
: 1 === t.length
? +t[0]
: 2 === t.length
? 60 * t[0] + +t[1]
: 60 * t[0] * 60 + 60 * t[1] + +t[2];
}
function createThumbnailPlayer() {
var e = {
source: p.src,
parentId: '#thumbnail-player',
autoPlay: !1,
loop: !1,
width: '100%',
height: '100%',
disableVideoTagContextMenu: !0,
exitFullscreenOnEnd: !1,
mute: !0,
persistConfig: !1,
language: p.lang,
allowUserInteraction: !1,
hlsjsConfig: { capLevelToPlayerSize: !0, maxMaxBufferLength: 5 },
disableErrorScreen: !0,
},
t = new Clappr.Player(e);
return (t.options.chromeless = !0), t;
}
function createButtonComment(e) {
var t = document.createElement('div');
t.className = 'hc__custom-button-container';
var r = document.createElement('button');
return (
(r.className = 'hc__custom-button hc__custom-button--fullscreen-enable'),
(e =
e ||
function (e) {
e.preventDefault(), e.stopPropagation();
}),
r.addEventListener('click', e),
r.appendChild(
(function () {
var e = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
e.setAttributeNS(null, 'viewBox', '0 0 24 24'),
e.setAttributeNS(null, 'width', 24),
e.setAttributeNS(null, 'height', 24);
var t = document.createElementNS('http://www.w3.org/2000/svg', 'path');
return (
t.setAttributeNS(
null,
'd',
'M18,16V13H15V22H13V2H15V11H18V8L22,12L18,16M2,12L6,16V13H9V22H11V2H9V11H6V8L2,12Z'
),
e.appendChild(t),
e
);
})()
),
t.appendChild(r),
t
);
}
var commentsIsFullWidth = !1;
function show_chat() {
var n = !1;
if (!p.chat) {
load_chat(), (p.chat = 1);
var r = setInterval(function () {
var e = document.querySelector('#hypercomments_widget .hc__root');
if (e) {
var t = e.querySelector('.hcc.hc__menu__right');
t.parentNode.insertBefore(
createButtonComment(function (e) {
e.preventDefault(), e.stopPropagation(), (n = !n);
var t = document.querySelector('div[data-player]');
if (!(t = t || document.querySelector('#player'))) return !1;
n
? t.classList.remove('comments')
: 800 <= $(window).width() && t.classList.add('comments');
var r = document.querySelector('#hypercomments_widget');
n
? (r.style.setProperty('width', '100%'),
r.style.setProperty(
'background-color',
'rgba(250, 250, 255, 1)'
))
: (setTimeout(function () {
r.style.removeProperty('background-color');
}, 400),
r.style.removeProperty('width'));
}),
t
),
e.addEventListener('keydown', function (e) {
e.stopPropagation();
}),
e.addEventListener('keypress', function (e) {
e.stopPropagation();
}),
e.addEventListener('keyup', function (e) {
e.stopPropagation();
}),
clearInterval(r);
}
}, 500);
}
if (chatOpen) {
(chatOpen = !1), $(window).trigger('chat_close');
var e = document.querySelector('#hypercomments_widget');
e &&
(setTimeout(function () {
e.style.removeProperty('background-color');
}, 400),
e.style.removeProperty('width'));
} else (chatOpen = !0), $(window).trigger('chat_open');
player &&
player.getPlugin &&
player.getPlugin('episodes-navigation-container') &&
player.getPlugin('episodes-navigation-container').isOpened &&
player.getPlugin('episodes-navigation-container').slide(),
reload_background(),
player &&
player.getPlugin &&
player.getPlugin('episodes-media-control') &&
!isFullscreen() &&
setTimeout(player.getPlugin('episodes-media-control').rerender, 500),
player &&
'function' == typeof player.getPlugin &&
player.getPlugin('adv-banners') &&
setTimeout(player.getPlugin('adv-banners').recalculate, 500);
}
!(function () {
if (!window.p.legacy) {
var e = {
Amaya: 0,
'Android Browser': 4,
Arora: 0,
Avant: 0,
Baidu: 0,
Blazer: 0,
Bolt: 0,
Camino: 0,
Chimera: 0,
Chrome: 47,
Chromium: 49,
'Comodo Dragon': 0,
Conkeror: 0,
Dillo: 0,
Dolphin: 0,
Doris: 0,
Edge: 14,
Epiphany: 0,
Fennec: 0,
Firebird: 0,
Firefox: 52,
Flock: 0,
GoBrowser: 0,
iCab: 0,
'ICE Browser': 0,
IceApe: 0,
IceCat: 0,
IceDragon: 0,
Iceweasel: 0,
IE: 11,
'IE Mobile': 11,
Iron: 0,
Jasmine: 0,
'K-Meleon': 0,
Konqueror: 0,
Kindle: 0,
Links: 0,
Lunascape: 0,
Lynx: 0,
Maemo: 0,
Maxthon: 0,
Midori: 0,
Minimo: 0,
'MIUI Browser': 0,
Safari: 9,
'Mobile Safari': 9,
Mosaic: 0,
Mozilla: 52,
Netfront: 0,
Netscape: 0,
NetSurf: 0,
Nokia: 0,
OmniWeb: 0,
Opera: 36,
'Opera Mini': 43,
'Opera Mobi': 43,
'Opera Tablet': 43,
PhantomJS: 0,
Phoenix: 0,
Polaris: 0,
QQBrowser: 0,
RockMelt: 0,
'Samsung Browser': 0,
Silk: 0,
Skyfire: 0,
SeaMonkey: 0,
SlimBrowser: 0,
Swiftfox: 0,
Tizen: 0,
UCBrowser: 0,
Vivaldi: 0,
w3m: 0,
WeChat: 0,
Yandex: 17,
},
t = new UAParser().getBrowser();
try {
$.ajax({
url:
'https://logs-01.loggly.com/inputs/9decf10b-c070-4076-9e36-5f5543929a61/tag/http/',
data: JSON.stringify({
date: new Date(),
type: 'PLAYER:Browser',
browser: t,
location: window.location,
userAgent: navigator.userAgent,
}),
method: 'POST',
dataType: 'json',
success: function (e) {
return !0;
},
error: function (e) {
console.log('Network Error', e);
},
});
} catch (e) {}
if (
t.name &&
t.version &&
e[t.name] &&
t.version.split('.')[0] < e[t.name]
) {
var r = '#f25648',
n = '#ffffff',
s = '/outdatedbrowser/lang/' + p.lang + '.html',
i = document.getElementById('outdated');
(o = s),
!void (
(l = (function () {
var t = !1;
if (window.XMLHttpRequest) t = new XMLHttpRequest();
else if (window.ActiveXObject)
try {
t = new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
try {
t = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e) {
t = !1;
}
}
return t;
})()) &&
((l.onreadystatechange = function () {
var e, t;
(e = l),
(t = document.getElementById('outdated')),
4 == e.readyState &&
(200 == e.status || 304 == e.status
? (t.innerHTML = e.responseText)
: (t.innerHTML = a),
(function () {
var e = document.getElementById('btnCloseUpdateBrowser'),
t = document.getElementById('btnUpdateBrowser');
(i.style.backgroundColor = r),
(i.style.color = n),
(i.children[0].style.color = n),
(i.children[1].style.color = n),
(t.style.color = n),
t.style.borderColor && (t.style.borderColor = n);
(e.style.color = n),
(e.onmousedown = function () {
return !(i.style.display = 'none');
}),
(t.onmouseover = function () {
(this.style.color = r), (this.style.backgroundColor = n);
}),
(t.onmouseout = function () {
(this.style.color = n), (this.style.backgroundColor = r);
});
})());
}),
l.open('GET', o, !0),
l.send(null))
),
$('#outdated').css('display', 'block');
}
var a =
'<h6>Your browser is out-of-date!</h6><p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/">Update my browser now </a></p><p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>';
}
var o, l;
})();
var voted = !1,
currentPoll = null,
isShowResultActive = !1,
choiceChars = ['A', 'B', 'C', 'D', 'E', 'F', 'G'];
function createPollThanks() {
return (
'<div class="polls-overlay_voted"><div class="polls-overlay__title_voted"><h2>' +
('en' === p.lang ? 'Thank you!' : 'Спасибо!') +
'</h2></div><div class="polls-overlay__voted-message">' +
('en' === p.lang
? 'Your vote has been counted'
: 'Ваш голос засчитан') +
'</div><div class="polls-overlay__close-btn"><div class="voted-btn" onclick="checkShowResultsState(); event.stopPropagation()">' +
('en' === p.lang ? 'Close' : 'Закрыть') +
'</div></div></div>'
);
}
function createPollForm(e, t) {
p.lang;
return (
'<div class="polls-overlay row"><div class="polls-overlay__title col-md-12"><h2>' +
e.text +
'</h2></div><div class="polls-overlay__choices col-xs-12 row">' +
t +
'</div></div>'
);
}
function createPollChoice(e, t) {
return (
'<div class="choice col-md-12 row d-flex" onclick="votePoll(' +
e.poll_id +
', ' +
e.id +
', ' +
t +
'); event.stopPropagation()"><div class="choice__text col-lg-12 text-center" title="' +
e.text +
'">' +
e.text +
'</div></div>'
);
}
function createPollResult(e, t, r) {
return (
'<div class="polls-overlay polls-overlay_results"><div class="polls-overlay__title"><h2>' +
('en' == p.lang
? 'Voting results'
: 'Результаты голосования') +
'</h2></div><div class="polls-overlay__question"><h3>' +
e +
'</h3></div><div class="polls-overlay__choices col-xs-12">' +
t +
'</div><div class="polls-overlay__close-btn col-xs-12 d-flex justify-content-center align-items-center"><div class="voted-btn" onclick="closePollResultsForm(' +
r +
'); event.stopPropagation()">' +
('en' == p.lang ? 'Close' : 'Закрыть') +
'</div></div></div>'
);
}
function createPollResultChoice(e) {
return (
'<div class="choice col-xs-12"><div class="choice__label"><h1>' +
e.char +
'</h1></div><div class="choice__text" title="' +
e.text +
'">' +
e.text +
'</div><div class="choice__votes"><div class="percent">' +
e.percent +
'%</div><div class="bar" style="width: ' +
e.percent +
'%"></div></div></div>'
);
}
function createPollWidget(e, t) {
return (
'<div class="polls-overlay-widget"><div class="widget-close-btn" onclick="closePollWidget(' +
e +
'); event.stopPropagation()">вњ–</div><div class="widget-choices">' +
t +
'</div></div>'
);
}
function createPollWidgetChoices(e) {
var t = e.char,
r = e.percent / 2;
return (
'<div class="widget-choice" title="' +
e.text +
'"><div class="choice-bar" style="height: ' +
r +
'px"></div><div class="choice-char">' +
t +
'</div></div>'
);
}
function addPercentToChoices(e) {
var n = e.reduce(function (e, t) {
return e + Number(t.votes);
}, 0);
return (e = e.map(function (e, t) {
var r = parseInt((e.votes / (n / 100)).toFixed(2));
return (
isNaN(r) ? (e.percent = 0) : (e.percent = r), (e.char = choiceChars[t]), e
);
}));
}
function addCharToChoices(e) {
return (e = (e = e.sort(function (e, t) {
return e.id - t.id;
})).map(function (e, t) {
return (e.char = choiceChars[t]), e;
}));
}
function votePoll(e, t, r) {
pollVoteId.push(e),
writeStorage('pollVoteId' + p.event.code, JSON.stringify(pollVoteId)),
$('.polls-overlay__choices .choice').prop('disabled', !0),
$('.polls-overlay').remove(),
$.ajax({
url: '/poll/vote',
method: 'POST',
data: { pollId: e, choiceId: t },
success: function (e) {
$('#player .container').first().append(createPollThanks());
},
});
}
function checkShowResultsState() {
if (($('.polls-overlay_voted').remove(), currentPoll.poll_show_results)) {
voted = !0;
for (
var e = '',
t = addPercentToChoices(currentPoll.choices),
r = 0,
n = t.length;
r < n;
r++
) {
e += createPollWidgetChoices(t[r]);
}
var s = createPollWidget(currentPoll.id, e);
$('#player .container').first().append(s),
(isPollOverlayEnabled = !0),
checkCurrentPollState(currentPoll);
} else isPollOverlayEnabled = !1;
}
function closePollResultsForm(e) {
$('.polls-overlay').remove();
var t = [];
try {
t = JSON.parse(readStorage('pollResultId' + p.event.code)) || [];
} catch (e) {
t = [];
}
t.push(e),
writeStorage('pollResultId' + p.event.code, JSON.stringify(t)),
-1 === pollRecordResultId.indexOf(e) && pollRecordResultId.push(e),
(isShowResultActive = isPollOverlayEnabled = !1),
(currentPoll = null);
}
function closePollWidget(e) {
$('.polls-overlay-widget').remove();
var t = [];
try {
t = JSON.parse(readStorage('pollWidgetId' + p.event.code)) || [];
} catch (e) {
t = [];
}
t.push(e), writeStorage('pollWidgetId' + p.event.code, JSON.stringify(t));
}
function pollFormInit(e) {
for (
var t = (currentPoll = e).poll_show_results,
r = addCharToChoices(e.choices),
n = [],
s = 0,
i = r.length;
s < i;
s++
) {
var a = r[s];
n.push(createPollChoice(a, t));
}
var o = n.join('');
1 === p.event.is_live &&
($('.polls-overlay').remove(),
$('#player').prepend(createPollForm(e, o)),
$('.polls-overlay').flowtype({ minFont: 10, maxFont: 40, fontRatio: 50 }));
}
function showResultsForm(e, t, r) {
$('.polls-overlay-widget').remove(),
currentPoll && $('.polls-overlay').remove(),
isShowResultActive && $('.polls-overlay_results').remove();
for (var n = '', s = 0, i = t.length; s < i; s++) {
n += createPollResultChoice(t[s]);
}
$('#player .container').first().append(createPollResult(e, n, r)),
(isShowResultActive = !0);
}
function getCurrentTime(e, t) {
var r;
return (
(1 !=
+(r =
1 == +e.event.use_dvr
? parseInt(t.getCurrentTime())
: parseInt(e.event.duration)) &&
isFinite(r)) ||
(r = parseInt(e.event.edatadur)),
r
);
}
function checkCurrentPollState(t) {
var e = p.event.polls;
((t = e.filter(function (e) {
return e.id === t.id;
})[0]).choices = t.choices.sort(function (e, t) {
return e.id - t.id;
})),
(t.choices = addPercentToChoices(t.choices));
var r = parseInt(t.poll_show_stop);
if (isNaN(r)) {
for (var n = '', s = t.choices, i = 0, a = s.length; i < a; i++) {
n += createPollWidgetChoices(s[i]);
}
$('.widget-choices').empty(),
$('#player').find('.widget-choices').append(n);
}
isNaN(r) ||
isShowResultActive ||
(showResultsForm(t.text, t.choices, t.id), (isPollOverlayEnabled = !1)),
$('.polls-overlay').flowtype({ minFont: 10, maxFont: 40, fontRatio: 50 });
}
function checkPollsState(e) {
1 === p.event.is_live
? (function (e) {
if (
e.every(function (e) {
var t = parseInt(e.id),
r = parseInt(e.poll_show_start),
n = parseInt(e.poll_show_stop),
s = parseInt(e.poll_show_results),
i = getCurrentTime(p, player),
a = [],
o = [],
l = [];
try {
a = JSON.parse(readStorage('pollResultId' + p.event.code)) || [];
} catch (e) {
a = [];
}
try {
o = JSON.parse(readStorage('pollVoteId' + p.event.code)) || [];
} catch (e) {
o = [];
}
try {
l = JSON.parse(readStorage('pollWidgetId' + p.event.code)) || [];
} catch (e) {
l = [];
}
return p.isMobile && 1 == +p.event.is_live && 1 == +p.event.use_dvr
? !!(
(isNaN(r) && isNaN(n)) ||
(!isNaN(n) && 0 === s) ||
i < r ||
(!isNaN(n) && 1 === s && -1 !== a.indexOf(t)) ||
(!isNaN(n) && 1 === s && -1 === a.indexOf(t))
) ||
(!(
!isNaN(n) &&
1 === s &&
-1 === a.indexOf(t) &&
n <= i &&
i <= n + 60
) &&
(!!(
(isNaN(n) && 1 === s && -1 === o.indexOf(t) && i < r) ||
(isNaN(n) &&
1 === s &&
-1 !== o.indexOf(t) &&
-1 !== l.indexOf(t))
) ||
(!(
isNaN(n) &&
1 === s &&
-1 !== o.indexOf(t) &&
-1 === l.indexOf(t) &&
r <= i
) &&
((!isNaN(n) && i < r) ||
!isNaN(n) ||
-1 !== o.indexOf(e.id) ||
-1 !== a.indexOf(e.id) ||
(!isNaN(n) && i < n)))))
: !!(
(isNaN(r) && isNaN(n)) ||
(!isNaN(n) && 0 === s) ||
i < r ||
(!isNaN(n) && 1 === s && -1 !== a.indexOf(t)) ||
(!isNaN(n) && 1 === s && -1 === a.indexOf(t) && n + 60 < i)
) ||
(!(
!isNaN(n) &&
1 === s &&
-1 === a.indexOf(t) &&
n <= i &&
i <= n + 60
) &&
(!!(
(isNaN(n) && 1 === s && -1 === o.indexOf(t) && i < r) ||
(isNaN(n) &&
1 === s &&
-1 !== o.indexOf(t) &&
-1 !== l.indexOf(t))
) ||
(!(
isNaN(n) &&
1 === s &&
-1 !== o.indexOf(t) &&
-1 === l.indexOf(t) &&
r <= i
) &&
((!isNaN(n) && i < r) ||
(!isNaN(n) && n + 60 < i) ||
-1 !== o.indexOf(e.id) ||
-1 !== a.indexOf(e.id) ||
(!isNaN(n) && i < n)))));
})
)
return (
$('.polls-overlay').remove(),
$('.polls-overlay-widget').remove(),
(isPollOverlayEnabled = !1)
);
isPollOverlayEnabled && checkCurrentPollState(currentPoll);
for (var t = 0, r = e.length; t < r; t++) {
var n = e[t],
s = parseInt(n.id),
i = parseInt(n.poll_show_start),
a = parseInt(n.poll_show_stop),
o = parseInt(n.poll_show_results),
l = n.text,
d = n.choices,
c = getCurrentTime(p, player),
u = [],
_ = [],
g = [];
try {
u = JSON.parse(readStorage('pollResultId' + p.event.code)) || [];
} catch (e) {
u = [];
}
try {
_ = JSON.parse(readStorage('pollVoteId' + p.event.code)) || [];
} catch (e) {
_ = [];
}
try {
g = JSON.parse(readStorage('pollWidgetId' + p.event.code)) || [];
} catch (e) {
g = [];
}
if (
((I = s),
(A = c),
(L = i),
(R = a),
-1 === _.indexOf(I) && isNaN(R) && L <= A)
) {
if (p.isMobile) {
var v =
'en' == p.lang
? 'Take the survey.'
: 'Пройдите опрос.';
alert(v);
}
pollFormInit(n);
}
if (
((T = s),
(P = a),
(E = o),
(O = _),
(N = g),
i <= (x = c) &&
(isNaN(P) || x < P) &&
-1 !== O.indexOf(T) &&
1 === E &&
-1 === N.indexOf(T))
) {
0 !== $('.polls-overlay-widget').length &&
$('.polls-overlay-widget').remove();
for (
var h = '',
m = 0,
f = (d = addPercentToChoices(addCharToChoices(d))).length;
m < f;
m++
) {
h += createPollWidgetChoices(d[m]);
}
var w = createPollWidget(s, h);
$('#player .container').first().append(w);
}
(y = s),
(b = c),
(k = a),
(S = o),
(C = u),
!isNaN(k) &&
k <= b &&
b <= k + 60 &&
1 === S &&
-1 === C.indexOf(y) &&
showResultsForm(
l,
(d = addPercentToChoices(addCharToChoices(d))),
s
);
}
var y, b, k, S, C, T, x, P, E, O, N, I, A, L, R;
$('.polls-overlay').flowtype({
minFont: 10,
maxFont: 40,
fontRatio: 50,
});
})(e)
: (function (e) {
if (
e.every(function (e) {
var t = parseInt(e.id),
r = parseInt(e.poll_show_stop),
n = getCurrentTime(p, player);
return (
!(
-1 !== pollRecordResultId.indexOf(t) &&
!isNaN(r) &&
r <= n &&
n <= r + 60
) &&
(!(-1 === pollRecordResultId.indexOf(t) && !isNaN(r)) ||
!(!isNaN(r) && r <= n && n <= r + 60))
);
})
)
return (
$('.polls-overlay_results').remove(), (pollRecordResultId = [])
);
for (var t = 0, r = e.length; t < r; t++) {
var n = e[t],
s = parseInt(n.id),
i = parseInt(n.poll_show_start),
a = parseInt(n.poll_show_stop),
o = parseInt(n.poll_show_results),
l = getCurrentTime(p, player);
if (-1 === pollRecordResultId.indexOf(s) && 0 !== o && !isNaN(a)) {
var d = n.text,
c = addPercentToChoices(addCharToChoices(n.choices));
!isNaN(a) && a <= l && l <= a + 60
? showResultsForm(d, c, s)
: isNaN(a) && i <= l && showResultsForm(d, c, s);
}
}
})(e);
}
function pollOverlayInit() {
var e = p.event.polls;
!e ||
(0 === p.event.is_live && 0 === p.event.use_dvr) ||
(0 !== e.length && checkPollsState(e));
}
var s = {
balancerPlaylist:
'https://cdn.facecast.io/facecastnet/e5cbe7c1d0e1ebf3033ce63d06bb5d35000003b3da3908007b22554944223a2230222c22556e69717565223a66616c73652c2245787069726573223a343037303939353230307d/bciel4kx32klnmklnozalwxym6oevtbn.m3u8',
init: !1,
isInternetAccess: !1,
errCount: 0,
scsCount: 0,
reqestCount: 0,
};
(s.tmp = s.balancerPlaylist.split('/')),
(s.eventId = s.tmp[s.tmp.length - 1]),
(s.eventId = s.eventId.substr(0, s.eventId.lastIndexOf('.'))),
(s.tmp = void 0);
var e = [],
scs = [];
function init_stat() {}
function step() {
s.edgePlaylist
? s.masterPlaylist
? s.chunksPlaylistData
? s.chunkList && getChunk()
: getChunksPlaylist()
: getMasterPlaylist()
: getEdgeUrl();
}
function renew() {
(s.edgePlaylist = void 0),
(s.masterPlaylist = void 0),
(s.chunksPlaylistData = void 0),
(s.chunkList = void 0),
step();
}
function getServerName(e) {
if (e) return e.split('/')[2];
}
function getEdgeUrl() {
(s.edgeUrlRequestTime = new Date().getTime()),
s.reqestCount++,
$.ajax({
url: s.balancerPlaylist + '?redirect=false',
method: 'GET',
dataType: 'text',
error: function (t, r) {
(e[s.errCount] = {
functionName: 'getEdgeUrl',
statusCode: t.status,
requestTime: s.edgeUrlRequestTime,
requestDuration: new Date().getTime() - s.edgeUrlRequestTime,
requestId: s.requestId,
requestUrl: s.masterPlaylist,
server: getServerName(s.balancerPlaylist),
eventId: s.eventId,
requestCount: s.reqestCount,
}),
console.log(e[s.errCount]),
s.errCount++,
setTimeout(function () {
s.errDelay++, step();
}, 1e3 * s.errCount);
},
success: function (e, t, r) {
(s.edgePlaylist = e),
(s.requestId = r.getResponseHeader('x-requestid')),
(scs[s.scsCount] = {
functionName: 'getEdgeUrl',
statusCode: r.status,
requestTime: s.edgeUrlRequestTime,
requestDuration: new Date().getTime() - s.edgeUrlRequestTime,
requestId: s.requestId,
requestUrl: s.balancerPlaylist,
server: getServerName(s.balancerPlaylist),
eventId: s.eventId,
requestCount: s.reqestCount,
requestResult: e,
}),
console.log(scs[s.scsCount]),
s.scsCount++,
step();
},
});
}
function getMasterPlaylist() {
(s.masterPlaylistRequestTime = new Date().getTime()),
s.reqestCount++,
$.ajax({
url: s.edgePlaylist,
method: 'GET',
dataType: 'text',
error: function (t, r) {
(e[s.errCount] = {
functionName: 'getMasterPlaylist',
statusCode: t.status,
requestTime: s.masterPlaylistRequestTime,
requestDuration: new Date().getTime() - s.masterPlaylistRequestTime,
requestId: s.requestId,
requestUrl: s.edgePlaylist,
server: getServerName(s.edgePlaylist),
eventId: s.eventId,
requestCount: s.reqestCount,
}),
console.log(e[s.errCount]),
s.errCount++,
setTimeout(function () {
s.errDelay++, step();
}, 1e3 * s.errCount);
},
success: function (e, t, r) {
(s.masterPlaylist = e).split('\n').forEach(function (e) {
-1 == e.indexOf('#') && 2 < e.length && (s.chunksPlaylist = e);
}),
(s.chunksPlaylist =
s.edgePlaylist.substr(0, s.edgePlaylist.lastIndexOf('/') + 1) +
s.chunksPlaylist),
(scs[s.scsCount] = {
functionName: 'getMasterPlaylist',
statusCode: r.status,
requestTime: s.masterPlaylistRequestTime,
requestDuration: new Date().getTime() - s.masterPlaylistRequestTime,
requestId: s.requestId,
requestUrl: s.edgePlaylist,
server: getServerName(s.edgePlaylist),
eventId: s.eventId,
requestCount: s.reqestCount,
requestResult: s.chunksPlaylist,
}),
console.log(scs[s.scsCount]),
s.scsCount++,
step();
},
});
}
function getChunksPlaylist() {
(s.chunksPlaylistRequestTime = new Date().getTime()),
s.reqestCount++,
(s.chunk_path = s.chunksPlaylist.substr(
0,
s.chunksPlaylist.lastIndexOf('/') + 1
)),
$.ajax({
url: s.chunksPlaylist,
method: 'GET',
dataType: 'text',
error: function (t, r) {
(e[s.errCount] = {
functionName: 'getChunksPlaylist',
statusCode: t.status,
requestTime: s.chunksPlaylistRequestTime,
requestDuration: new Date().getTime() - s.chunksPlaylistRequestTime,
requestId: s.requestId,
requestUrl: s.chunksPlaylist,
server: getServerName(s.chunksPlaylist),
eventId: s.eventId,
requestCount: s.reqestCount,
}),
console.log(e[s.errCount]),
s.errCount++,
setTimeout(function () {
s.errDelay++, step();
}, 1e3 * s.errCount);
},
success: function (e, t, r) {
var n = (s.chunksPlaylistData = e).split('\n'),
i = [];
n.forEach(function (e) {
-1 == e.indexOf('#') && 2 < e.length && i.push(e);
}),
(s.chunkList = i),
(scs[s.scsCount] = {
functionName: 'getChunksPlaylist',
statusCode: r.status,
requestTime: s.chunksPlaylistRequestTime,
requestDuration: new Date().getTime() - s.chunksPlaylistRequestTime,
requestId: s.requestId,
requestUrl: s.chunksPlaylist,
server: getServerName(s.chunksPlaylist),
eventId: s.eventId,
requestCount: s.reqestCount,
requestResult: i.length + ' lines',
}),
console.log(scs[s.scsCount]),
s.scsCount++,
step();
},
});
}
function getChunk() {
(s.chunkRequestTime = new Date().getTime()), s.reqestCount++;
var t = Math.round(Math.random(1) * s.chunkList.length),
n = s.chunk_path + s.chunkList[t];
$.ajax({
url: n,
method: 'GET',
dataType: 'text',
error: function (t, r) {
(e[s.errCount] = {
functionName: 'getChunk',
statusCode: t.status,
requestTime: s.chunkRequestTime,
requestDuration: new Date().getTime() - s.chunkRequestTime,
requestId: s.requestId,
requestUrl: n,
server: getServerName(n),
eventId: s.eventId,
requestCount: s.reqestCount,
}),
console.log(e[s.errCount]),
s.errCount++,
setTimeout(function () {
s.errDelay++, step();
}, 1e3 * s.errCount);
},
success: function (e, t, r) {
(s.chunksDataSize = e.length),
(scs[s.scsCount] = {
functionName: 'getChunk',
statusCode: r.status,
requestTime: s.chunkRequestTime,
requestDuration: new Date().getTime() - s.chunkRequestTime,
requestId: s.requestId,
requestUrl: n,
server: getServerName(n),
eventId: s.eventId,
requestCount: s.reqestCount,
requestResult: e.length + ' bytes',
}),
console.log(scs[s.scsCount]),
s.scsCount++;
},
});
}
!(function () {
'use strict';
var e = prefix + 'collector.facecast.net/v1/register_visit',
t = prefix + 'collector.facecast.net/v1/register_visit_events',
r = 1e4,
n = 50,
s = 2e3,
i = !0,
a = !0,
o = !0,
l = !0,
d = null,
c = 10,
u = [],
_ = [],
g = [],
v = [];
function h() {
return ((65536 * (1 + Math.random())) | 0).toString(16).substring(1);
}
(window.visit_id =
h() + h() + '-' + h() + '-' + h() + '-' + h() + '-' + h() + h() + h()),
-1 == document.location.href.indexOf('no_analytics') &&
(clearTimeout(window.RVST),
(window.RVST = setTimeout(function t() {
p &&
p.event &&
(c = +p.event.analytics_push_interval
? +p.event.analytics_push_interval
: 10);
if (readStorage('reg_visits'))
try {
u = JSON.parse(readStorage('reg_visits'));
} catch (e) {
u = [];
}
else u = [];
u = u.filter(function (e) {
var t = g.map(function (e) {
return e.visit_id;
}),
r = g.map(function (e) {
return e.event_code;
}),
n = g.map(function (e) {
return e.viewer_id;
});
return (
-1 === t.indexOf(e.visit_id) ||
-1 === r.indexOf(e.event_code) ||
-1 === n.indexOf(e.viewer_id)
);
});
writeStorage('reg_visits', JSON.stringify(u));
g = [];
u.length &&
$.ajax({
url: e,
data: JSON.stringify(u),
method: 'POST',
success: function (e) {
u.forEach(function (e) {
g.push({
visit_id: e.visit_id,
event_code: e.event_code,
viewer_id: e.viewer_id,
});
}),
clearTimeout(window.RVST),
(window.RVST = setTimeout(t, 1e3 * c));
},
error: function (e) {
clearTimeout(window.RVST),
(window.RVST = setTimeout(t, 1e3 * c)),
console.log('Network Error', e);
},
});
u.length ||
(clearTimeout(window.RVEST), (window.RVEST = setTimeout(x, 1e3 * c)));
}, 1e3 * c)),
clearTimeout(window.RVEST),
(window.RVEST = setTimeout(x, 1e3 * c)),
clearTimeout(window.SVET),
(window.SVET = setTimeout(T, r)));
var m = {
time: String(null),
user_agent: navigator.userAgent,
platform: navigator.platform,
viewer_id: String(null),
visit_id: window.visit_id,
event_id: String(null),
event_code: String(null),
password: String(null),
url: String(null),
servers: null,
},
f = {
type: 'analytics',
trigger: String(null),
visit_id: window.visit_id,
viewer_id: String(null),
event_id: String(null),
event_code: String(null),
password: String(null),
resolution: null,
start: null,
end: null,
},
w = {
type: 'analytics',
trigger: 'WINDOW_CLOSED',
visit_id: window.visit_id,
viewer_id: String(null),
event_id: String(null),
event_code: String(null),
password: String(null),
resolution: null,
start: null,
end: null,
};
function y() {
if (void 0 !== player && void 0 !== p && void 0 !== p.event) {
if (
(7 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id) &&
!p.key
)
return void setTimeout(y, 1e3);
if (
((7 != +p.event.view_mode_id &&
4 != +p.event.view_mode_id &&
5 != +p.event.view_mode_id &&
6 != +p.event.view_mode_id) ||
!p.key ||
((m.password = p.key), (f.password = p.key), (w.password = p.key)),
get_event(),
(!(
-1 !==
[
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod',
].indexOf(navigator.platform) ||
(-1 !== navigator.userAgent.indexOf('Mac') &&
'ontouchend' in document)
) &&
+p.event.use_dvr) ||
p.event.has_polls ||
(clearInterval(window.eDataUpdateInterval),
(window.eDataUpdateInterval = setInterval(get_event, 3e4))),
(m.time = new Date().toISOString()),
(m.viewer_id = p.guid),
(m.event_id = p.event.id ? String(p.event.id) : String(null)),
(m.event_code = p.event.code ? String(p.event.code) : String(null)),
(m.url = url),
(m.servers = servers),
readStorage('reg_visits'))
)
try {
(u = JSON.parse(readStorage('reg_visits'))).push(m);
} catch (e) {
(u = []).push(m);
}
else (u = []).push(m);
writeStorage('reg_visits', JSON.stringify(u)),
(f.viewer_id = p.guid),
(w.viewer_id = p.guid),
(f.event_id = p.event.id ? String(p.event.id) : String(null)),
(w.event_id = p.event.id ? String(p.event.id) : String(null)),
(f.event_code = p.event.code ? String(p.event.code) : String(null)),
(w.event_code = p.event.code ? String(p.event.code) : String(null)),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_PLAY_INTENT, function (e) {
(f.trigger = 'PLAYER_PLAY'),
(i = !1),
setTimeout(function () {
i = !0;
}, 1e3);
}),
player.on(Clappr.Events.PLAYER_PAUSE, function (e) {
o &&
setTimeout(function () {
(d = 'PLAYER_PAUSE'), T();
}, 1e3);
}),
player.on(Clappr.Events.PLAYER_SEEK, function (e) {
l &&
((l = o = i = a = !1),
setTimeout(function () {
(d = 'PLAYER_SEEK'), (f.start = C()), (w.start = C()), k(), T();
}, 1e3),
setTimeout(function () {
l = o = i = a = !0;
}, s));
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_LEVEL_SWITCH_END, function (e) {
i &&
((o = a = !1),
setTimeout(function () {
(d = 'LEVEL_SWITCH'), k(), T();
}, 1e3),
setTimeout(function () {
o = a = !0;
}, s));
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_BUFFERING, function (e) {
a &&
((a = o = !1),
setTimeout(function () {
(d = 'BUFFERING'), T();
}, 1e3),
setTimeout(function () {
a = o = !0;
}, s));
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_STOP, function (e) {
setTimeout(function () {
(d = 'STOP'), T();
}, 1e3);
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_ERROR, function (e) {
setTimeout(function () {
(d = 'PLAYBACK_ERROR'), T();
}, 1e3);
}),
setTimeout(b, 1e3),
setTimeout(S, 1e3);
} else setTimeout(y, 1e3);
}
function b() {
if (player.core.mediaControl.container.isPlaying()) {
var e = C(),
t = player.getPlugin('level_selector');
t.currentLevel
? (f.resolution = t.currentLevel.level.height)
: (f.resolution = null),
null === f.start
? 0 != +e && ((f.start = +e), (f.end = +e + 1))
: 0 != +e &&
(+f.start >= +e
? ((f.start = +e), (f.end = +e + 1))
: (f.end = +e)),
setTimeout(b, n);
} else setTimeout(b, n);
}
function k() {
var e = C(),
t = player.getPlugin('level_selector');
t.currentLevel
? (f.resolution = t.currentLevel.level.height)
: (f.resolution = null),
null === f.start
? 0 != +e && ((f.start = +e), (f.end = +e + 1))
: 0 != +e &&
(+f.start >= +e ? ((f.start = +e), (f.end = +e + 1)) : (f.end = +e));
}
function S() {
var e = C(),
t = player.getPlugin('level_selector');
t.currentLevel
? (w.resolution = t.currentLevel.level.height)
: (w.resolution = null),
null === w.start
? 0 != +e && ((w.start = +e), (w.end = +e + 1))
: 0 != +e &&
(+w.start >= +e ? ((w.start = +e), (w.end = +e + 1)) : (w.end = +e)),
setTimeout(S, n);
}
function C() {
var e;
return (
isFinite(readStorage('duration')) && readStorage('duration'),
(1 !=
+(e =
1 == +p.event.use_dvr
? parseInt(player.getCurrentTime())
: parseInt(p.event.duration)) &&
isFinite(e) &&
+p.event.use_dvr) ||
(e = parseInt(readStorage('duration'))),
+e &&
p &&
p.event &&
+p.event.start_dvr_time &&
(e += +p.event.start_dvr_time),
e
);
}
function T() {
if (
!(function () {
+f.start && +f.end && f.start === +f.end && f.end++;
if (null === f.start || null === f.end) return (f.end = null), !1;
if (isNaN(f.start) || isNaN(f.end))
return (
isNaN(f.start) && ((f.start = null), (f.end = null)),
isNaN(f.end) && (f.end = null),
!1
);
return !0;
})()
)
return clearTimeout(window.SVET), void (window.SVET = setTimeout(T, r));
if (
(d && (f.trigger = d),
(null !== f.trigger && 'null' !== f.trigger) ||
(f.trigger = 'PLAYER_PLAY'),
readStorage('reg_visit_events'))
)
try {
(_ = JSON.parse(readStorage('reg_visit_events'))).push(f);
} catch (e) {
(_ = []).push(f);
}
else (_ = []).push(f);
writeStorage('reg_visit_events', JSON.stringify(_)),
(f.end = null),
(f.start = C()),
(w.start = C()),
(f.trigger = 'PLAYER_PLAY'),
(d = null),
clearTimeout(window.SVET),
(window.SVET = setTimeout(T, r));
}
function x() {
if (
(p &&
p.event &&
(c = +p.event.analytics_push_interval
? +p.event.analytics_push_interval
: 10),
readStorage('reg_visit_events'))
)
try {
_ = JSON.parse(readStorage('reg_visit_events'));
} catch (e) {
_ = [];
}
else _ = [];
(_ = _.filter(function (e) {
if (!e.trigger || 'null' === e.trigger) return !1;
var t = v.map(function (e) {
return e.visit_id;
}),
r = v.map(function (e) {
return e.event_code;
}),
n = v.map(function (e) {
return e.viewer_id;
}),
s = v.map(function (e) {
return e.start;
}),
i = v.map(function (e) {
return e.end;
});
return (
(-1 === t.indexOf(e.visit_id) ||
-1 === r.indexOf(e.event_code) ||
-1 === n.indexOf(e.viewer_id) ||
-1 === s.indexOf(e.start) ||
-1 === i.indexOf(e.end)) &&
!(172800 <= +e.start || 172800 <= +e.end)
);
})),
writeStorage('reg_visit_events', JSON.stringify(_)),
(v = []),
_.length &&
$.ajax({
url: t,
data: JSON.stringify(_),
method: 'POST',
success: function (e) {
_.forEach(function (e) {
v.push({
visit_id: e.visit_id,
event_code: e.event_code,
viewer_id: e.viewer_id,
start: e.start,
end: e.end,
});
}),
clearTimeout(window.RVEST),
(window.RVEST = setTimeout(x, 1e3 * c));
},
error: function (e) {
clearTimeout(window.RVEST),
(window.RVEST = setTimeout(x, 1e3 * c)),
console.log('Network Error', e);
},
}),
_.length ||
(clearTimeout(window.RVEST), (window.RVEST = setTimeout(x, 1e3 * c)));
}
$(document).ready(function () {
-1 == document.location.href.indexOf('no_analytics') &&
(y(),
(window.onbeforeunload = function () {
return (
(function () {
var e = [w];
{
if (navigator && 'function' == typeof navigator.sendBeacon)
return navigator.sendBeacon(t, JSON.stringify(e));
$.ajax({
url: t,
data: JSON.stringify(e),
method: 'POST',
dataType: 'json',
success: function (e) {
return !0;
},
error: function (e) {},
});
}
})(),
null
);
}));
});
})(),
(function () {
var e = prefix + 'collector.facecast.net/v1/register_user_activity',
r = prefix + 'collector.facecast.net/v1/register_user_activity',
a = null,
o = null,
l = null,
t = !1,
n = (window.SHOW_CLEARED = !1),
d = 10,
s = [],
i = [],
c = [],
u = [],
_ = !1,
g = null,
v = null,
h = null,
m = 0;
-1 == document.location.href.indexOf('no_presence_confirm') &&
(clearTimeout(window.SCPPT),
(window.SCPPT = setTimeout(S, 1e3 * d)),
clearTimeout(window.SCT),
(window.SCT = setTimeout(function t() {
P();
if (readStorage('pr_confirmed'))
try {
c = JSON.parse(readStorage('pr_confirmed'));
} catch (e) {
(c = []), writeStorage('pr_confirmed', JSON.stringify(c));
}
else (c = []), writeStorage('pr_confirmed', JSON.stringify(c));
c = c.filter(function (e) {
var t = u.map(function (e) {
return e.visit_id;
}),
r = u.map(function (e) {
return e.popup_id;
}),
n = u.map(function (e) {
return e.viewer_id;
});
return (
-1 === t.indexOf(e.visit_id) ||
-1 === r.indexOf(e.popup_id) ||
-1 === n.indexOf(e.viewer_id)
);
});
writeStorage('pr_confirmed', JSON.stringify(c));
u = [];
c.length &&
$.ajax({
url: r,
data: JSON.stringify(c),
method: 'POST',
success: function (e) {
c.forEach(function (e) {
u.push({
visit_id: e.visit_id,
popup_id: e.popup_id,
viewer_id: e.viewer_id,
});
}),
clearTimeout(window.SCT),
(window.SCT = setTimeout(t, 1e3 * d));
},
error: function (e) {
clearTimeout(window.SCT),
(window.SCT = setTimeout(t, 1e3 * d)),
console.log('Network Error', e);
},
});
c.length ||
(clearTimeout(window.SCT), (window.SCT = setTimeout(t, 1e3 * d)));
}, 1e3 * d)));
var f = {
time: String(null),
type: 'PRESENCE_CONFIRMATION',
user_agent: navigator.userAgent,
trigger: String(null),
viewer_id: String(null),
visit_id: String(null),
event_id: String(null),
event_code: String(null),
password: String(null),
popup_id: String(0),
interval: null,
position: null,
confirmed: Number(0),
};
function w() {
if (void 0 !== player && void 0 !== p && void 0 !== p.event) {
if (
7 != +p.event.view_mode_id &&
4 != +p.event.view_mode_id &&
5 != +p.event.view_mode_id &&
6 != +p.event.view_mode_id
)
return;
if (
(7 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id) &&
!p.event.has_viewer_presence_confirmation
)
return;
if (
(7 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id) &&
!p.key &&
p.event.has_viewer_presence_confirmation
)
return void setTimeout(w, 1e3);
(7 == +p.event.view_mode_id ||
4 == +p.event.view_mode_id ||
5 == +p.event.view_mode_id ||
6 == +p.event.view_mode_id) &&
p.key &&
p.event.has_viewer_presence_confirmation &&
(f.password = p.key),
(f.time = new Date().toISOString()),
(f.viewer_id = p.guid),
(f.event_id = p.event.id ? String(p.event.id) : String(null)),
(f.event_code = p.event.code ? String(p.event.code) : String(null)),
(f.visit_id = String(window.visit_id)),
(a =
+p.event.viewer_presence_confirmation_interval ||
+p.event.viewer_presence_confirmation_display_default_interval),
(o = +p.event.viewer_presence_confirmation_randomization_percentage
? (a *
p.event.viewer_presence_confirmation_randomization_percentage) /
100
: +p.event
.viewer_presence_confirmation_display_randomization_interval),
(l = +p.event.viewer_presence_confirmation_display_time),
(a = +a || 60),
(l = +l || 60),
(!+o || +a <= +o) && (o = a - 60),
clearTimeout(window.SPCPT),
(n = window.SHOW_CLEARED = !0),
player.on(Clappr.Events.PLAYER_PAUSE, function (e) {
_ ||
(clearTimeout(window.SPCPT),
(n = window.SHOW_CLEARED = !0),
x('PAUSE'),
v && (h = v - Date.now()));
}),
player.on(Clappr.Events.PLAYER_PLAY, function (e) {
+p.event.viewer_presence_confirmation_interval &&
((f.interval = +p.event.viewer_presence_confirmation_interval),
setTimeout(function () {
n && ((n = window.SHOW_CLEARED = !1), T('PLAY'));
}, 0));
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_PLAY_INTENT, function (e) {
+p.event.viewer_presence_confirmation_interval &&
((f.interval = +p.event.viewer_presence_confirmation_interval),
setTimeout(function () {
n &&
((n = window.SHOW_CLEARED = !1), T('PLAYBACK_PLAY_INTENT'));
}, 100));
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_PLAY, function (e) {
+p.event.viewer_presence_confirmation_interval &&
((f.interval = +p.event.viewer_presence_confirmation_interval),
setTimeout(function () {
n && ((n = window.SHOW_CLEARED = !1), T('PLAYBACK_PLAY'));
}, 100));
}),
player.core
.getCurrentPlayback()
.on(Clappr.Events.PLAYBACK_LEVEL_SWITCH_END, function (e) {
+p.event.viewer_presence_confirmation_interval &&
((f.interval = +p.event.viewer_presence_confirmation_interval),
setTimeout(function () {
n &&
player.isPlaying() &&
((n = window.SHOW_CLEARED = !1),
T('PLAYBACK_LEVEL_SWITCH_END'));
}, 100)),
(_ = !0),
setTimeout(function () {
_ = !1;
}, 2e3);
});
} else setTimeout(w, 1e3);
}
function y() {
if (player.isPlaying())
if (!p || !p.event || +p.event.use_dvr || +p.event.is_live)
if (
((f.trigger = 'SHOW'),
(f.confirmed = 0),
(f.time = new Date().toISOString()),
$('.viewer_presence_window_popup').css('display', 'flex').show(),
(f.popup_id = String(+f.popup_id + 1)),
(f.position = (function () {
isFinite(readStorage('duration')) &&
(LAST_DURATION = readStorage('duration'));
var e;
e =
1 == +p.event.use_dvr
? parseInt(player.getCurrentTime())
: parseInt(p.event.duration);
(1 != +e && isFinite(e) && +p.event.use_dvr) ||
(e = parseInt(readStorage('duration')));
+e &&
p &&
p.event &&
+p.event.start_dvr_time &&
(e += +p.event.start_dvr_time);
return e;
})()),
s.push(JSON.parse(JSON.stringify(f))),
writeStorage('pr_confirms', JSON.stringify(s)),
-1 !==
[
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod',
].indexOf(navigator.platform) ||
(-1 !== navigator.userAgent.indexOf('Mac') &&
'ontouchend' in document) ||
[
/Android/i,
/webOS/i,
/iPhone/i,
/iPad/i,
/iPod/i,
/BlackBerry/i,
/Windows Phone/i,
].some(function (e) {
return navigator.userAgent.match(e);
}) ||
C() ||
void 0 !== window.orientation)
) {
S();
var e = 'Confirm your presence';
p &&
'ru' === p.lang &&
(e =
'Подтвердите свое присутствие на мероприятии');
confirm(e);
k(), player.play();
} else {
$('.viewer_presence_window_popup').css('display', 'flex').show(),
clearTimeout(window.HPCPT),
C() ||
(window.HPCPT = setTimeout(function () {
(t = !0), b();
}, 1e3 * l));
try {
document.mozCancelFullScreen
? document.mozFullScreen && document.mozCancelFullScreen()
: document.webkitExitFullscreen
? document.webkitIsFullScreen && document.webkitExitFullscreen()
: document.msExitFullscreen
? document.msExitFullscreen()
: document.exitFullscreen
? document.fullScreen && document.exitFullscreen()
: alert('Контроль присутствия');
} catch (e) {
console.log(e);
}
}
else T('_showPresenceConfirmationPopup');
else T('_showPresenceConfirmationPopup');
}
function b() {
$('.viewer_presence_window_popup').hide(),
T('_hidePresenceConfirmationPopup'),
t || player.play();
}
function k() {
(f.trigger = 'CONFIRM'),
(f.confirmed = 1),
c.push(JSON.parse(JSON.stringify(f))),
writeStorage('pr_confirmed', JSON.stringify(c)),
(t = !1),
(f.position = null),
b();
}
function S() {
if ((P(), readStorage('pr_confirms')))
try {
s = JSON.parse(readStorage('pr_confirms'));
} catch (e) {
(s = []), writeStorage('pr_confirms', JSON.stringify(s));
}
else (s = []), writeStorage('pr_confirms', JSON.stringify(s));
(s = s.filter(function (e) {
var t = i.map(function (e) {
return e.visit_id;
}),
r = i.map(function (e) {
return e.popup_id;
}),
n = i.map(function (e) {
return e.viewer_id;
});
return (
-1 === t.indexOf(e.visit_id) ||
-1 === r.indexOf(e.popup_id) ||
-1 === n.indexOf(e.viewer_id)
);
})),
(i = []),
writeStorage('pr_confirms', JSON.stringify(s)),
s.length &&
$.ajax({
url: e,
data: JSON.stringify(s),
method: 'POST',
success: function (e) {
return (
s.forEach(function (e) {
i.push({
visit_id: e.visit_id,
popup_id: e.popup_id,
viewer_id: e.viewer_id,
});
}),
clearTimeout(window.SCPPT),
(window.SCPPT = setTimeout(S, 1e3 * d)),
!0
);
},
error: function (e) {
clearTimeout(window.SCPPT),
(window.SCPPT = setTimeout(S, 1e3 * d)),
console.log('Network Error', e);
},
}),
s.length ||
(clearTimeout(window.SCPPT), (window.SCPPT = setTimeout(S, 1e3 * d)));
}
function C() {
var e,
t = !1;
return (
(e = navigator.userAgent || navigator.vendor || window.opera),
(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
e
) ||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
e.substr(0, 4)
)) &&
(t = !0),
t
);
}
function T(e) {
clearTimeout(window.SPCPT), x(e);
var t = 0;
m ||
((t = readStorage('pr_confirmation_st_' + p.event.code + p.key)), m++);
var r,
n,
s,
i = 0;
(i = +t
? t - Date.now()
: 1e3 *
(a +
((r = +o),
(n = -o),
(n = Math.ceil(n)),
(r = Math.floor(r)),
Math.random() * (r - n) + n))),
!+t && h && (i = h),
(g = Date.now()),
(window.SPCPT = setTimeout(y, i)),
writeStorage(
'pr_confirmation_st_' + p.event.code + p.key,
+Date.now() + i
),
(v = +g + i),
(h = null),
(s = i),
(window._setVPCI = {
start_time: new Date(g),
timeout: s + ' ms',
trigger_time: new Date(v),
randomization: o,
interval: a,
display_time: l,
sending_interval: d,
});
}
function x(e) {
window._setVPCI = { time: new Date(), timeout: 'CLEARED BY ' + e };
}
function P() {
p &&
p.event &&
((a =
+p.event.viewer_presence_confirmation_interval ||
+p.event.viewer_presence_confirmation_display_default_interval),
(o = +p.event.viewer_presence_confirmation_randomization_percentage
? (a *
p.event.viewer_presence_confirmation_randomization_percentage) /
100
: +p.event
.viewer_presence_confirmation_display_randomization_interval),
(l = +p.event.viewer_presence_confirmation_display_time),
(a = +a || 60),
(l = +l || 60),
(!+o || +a <= +o) && (o = a - 60),
(d = +p.event.analytics_push_interval || 10));
}
$(document).ready(function () {
-1 == document.location.href.indexOf('no_presence_confirm') && w();
}),
(window.confirmViewerPresencePopup = k);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment