Upload index.html
Browse files- index.html +165 -2
index.html
CHANGED
|
@@ -786,6 +786,15 @@
|
|
| 786 |
.jmx-ad-b{width:100%;overflow:hidden;border-radius:10px;background:rgba(255,255,255,.04)}
|
| 787 |
.jmx-ad-b iframe{border:0;display:block;transform-origin:0 0;background:transparent}
|
| 788 |
.jmx-noad .jmx-sb{display:none!important}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
.vwrap video{width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:contain}
|
| 790 |
.vwrap:fullscreen,.vwrap:-webkit-full-screen{aspect-ratio:auto;max-height:none;height:100%}
|
| 791 |
.vwrap .seek-zone{top:0;bottom:64px}
|
|
@@ -2810,7 +2819,7 @@ const I18N_EXTRA7 = {"sw": {"not_live_msg": "Haipatikani kwa LIVE", "vol_warn":
|
|
| 2810 |
Object.keys(I18N_EXTRA7).forEach(l => { I18N[l] = Object.assign(I18N[l] || {}, I18N_EXTRA7[l]); });
|
| 2811 |
const I18N_EXTRA8 = {"sw": {"dq_paused_resume": "Imesimamishwa — gusa ↻ kuendelea"}, "en": {"dq_paused_resume": "Paused — tap ↻ to resume"}, "ar": {"dq_paused_resume": "متوقف مؤقتاً — اضغط ↻ للمتابعة"}, "fr": {"dq_paused_resume": "En pause — touchez ↻ pour reprendre"}};
|
| 2812 |
Object.keys(I18N_EXTRA8).forEach(l => { I18N[l] = Object.assign(I18N[l] || {}, I18N_EXTRA8[l]); });
|
| 2813 |
-
const I18N_EXTRA10 = {"sw": {"ad_label": "Tangazo"}, "en": {"ad_label": "Ad"}, "ar": {"ad_label": "إعلان"}, "fr": {"ad_label": "Publicité"}};
|
| 2814 |
Object.keys(I18N_EXTRA10).forEach(l => { I18N[l] = Object.assign(I18N[l] || {}, I18N_EXTRA10[l]); });
|
| 2815 |
function T(k, v) { return t(k, v); }
|
| 2816 |
// Maandishi yaliyoandikwa kwenye HTML kupitia data-i18n / data-i18n-ph / data-i18n-title
|
|
@@ -3282,6 +3291,153 @@ function jmxSocialBar(){
|
|
| 3282 |
jmxSyncAds();
|
| 3283 |
const sc = document.createElement('script'); sc.async = true; sc.setAttribute('data-cfasync', 'false'); sc.src = JMX_ADS.social.src; document.body.appendChild(sc);
|
| 3284 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3285 |
function renderRails(sections, gridMode = false) {
|
| 3286 |
railsEl.innerHTML = '';
|
| 3287 |
if (isKidsMode()) sections = sections.map(sec => ({ ...sec, items: kidsModeFilter(sec.items) })).filter(sec => sec.items.length);
|
|
@@ -3879,7 +4035,8 @@ function playTranslatedUrl(url, title, playlist, meta) {
|
|
| 3879 |
if (playlist) setPlayerPlaylist(playlist); // kichupo cha pembeni: vipindi / sehemu
|
| 3880 |
ensureSound(v);
|
| 3881 |
v.addEventListener('ended', () => { const c = window.__pcPlaylist; if (c && typeof c.next === 'function') c.next(); });
|
| 3882 |
-
|
|
|
|
| 3883 |
// Route ya player: #/translated/ID/play?se=..&ep=..
|
| 3884 |
try {
|
| 3885 |
const id = currentTranslatedDetail && currentTranslatedDetail.id;
|
|
@@ -6006,6 +6163,7 @@ function stopMediaOnly(){
|
|
| 6006 |
currentBlobUrls = [];
|
| 6007 |
}
|
| 6008 |
function stopPlayer(){
|
|
|
|
| 6009 |
playerEl.classList.remove('mini');
|
| 6010 |
clearUpNext();
|
| 6011 |
if (document.pictureInPictureElement) { document.exitPictureInPicture().catch(()=>{}); }
|
|
@@ -6024,6 +6182,7 @@ function stopPlayer(){
|
|
| 6024 |
}
|
| 6025 |
function openPlayerShell(title){
|
| 6026 |
liveFb = null;
|
|
|
|
| 6027 |
stopPlayer();
|
| 6028 |
ptitle.textContent = title;
|
| 6029 |
playerEl.classList.add('on');
|
|
@@ -6900,6 +7059,8 @@ async function playMovieDetail(d, se, ep){
|
|
| 6900 |
Router.go('/watch/' + d.id + (se != null && ep != null ? '?se=' + se + '&ep=' + ep : ''));
|
| 6901 |
openPlayerShell(d.title + (ep != null ? (' - S' + se + 'E' + ep) : ''));
|
| 6902 |
if (se != null && ep != null) setPlayerPlaylist(buildMoviePlaylist(d, se, ep));
|
|
|
|
|
|
|
| 6903 |
try {
|
| 6904 |
let pr;
|
| 6905 |
if (se != null && ep != null) {
|
|
@@ -6911,8 +7072,10 @@ async function playMovieDetail(d, se, ep){
|
|
| 6911 |
pr = parsePlayResult(await rpc('movies.play', args));
|
| 6912 |
}
|
| 6913 |
if (!pr) throw new Error(T('err_no_stream'));
|
|
|
|
| 6914 |
await playResultInPlayer(pr, d.title, { id: d.id, se, ep, title: d.title, poster: d.poster || d.backdrop || null });
|
| 6915 |
} catch (e) {
|
|
|
|
| 6916 |
statusMsg('<span style="color:#ffb4ab">' + T('err_failed', { e: esc(e.message) }) + '</span>');
|
| 6917 |
}
|
| 6918 |
}
|
|
|
|
| 786 |
.jmx-ad-b{width:100%;overflow:hidden;border-radius:10px;background:rgba(255,255,255,.04)}
|
| 787 |
.jmx-ad-b iframe{border:0;display:block;transform-origin:0 0;background:transparent}
|
| 788 |
.jmx-noad .jmx-sb{display:none!important}
|
| 789 |
+
.jmx-pre{position:absolute;inset:0;z-index:30;background:#000;display:flex;align-items:center;justify-content:center}
|
| 790 |
+
.jmx-pre video{width:100%;height:100%;object-fit:contain;background:#000}
|
| 791 |
+
.jmx-pre-top{position:absolute;left:0;right:0;top:0;display:flex;justify-content:space-between;align-items:center;padding:10px 12px;background:linear-gradient(rgba(0,0,0,.65),transparent);font-size:12px;color:#fff;pointer-events:none}
|
| 792 |
+
.jmx-pre-btns{position:absolute;right:10px;bottom:14px;display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
|
| 793 |
+
.jmx-pre-btn{border:1px solid rgba(255,255,255,.4);background:rgba(0,0,0,.7);color:#fff;border-radius:999px;padding:8px 14px;font-size:13px;font-weight:700;cursor:pointer}
|
| 794 |
+
.jmx-pre-btn[hidden]{display:none}
|
| 795 |
+
.jmx-pre-btn:focus{outline:2px solid var(--accent2);outline-offset:2px}
|
| 796 |
+
.jmx-pre-bar{position:absolute;left:0;right:0;bottom:0;height:3px;background:rgba(255,255,255,.2)}
|
| 797 |
+
.jmx-pre-bar i{display:block;height:100%;width:0;background:var(--accent)}
|
| 798 |
.vwrap video{width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:contain}
|
| 799 |
.vwrap:fullscreen,.vwrap:-webkit-full-screen{aspect-ratio:auto;max-height:none;height:100%}
|
| 800 |
.vwrap .seek-zone{top:0;bottom:64px}
|
|
|
|
| 2819 |
Object.keys(I18N_EXTRA7).forEach(l => { I18N[l] = Object.assign(I18N[l] || {}, I18N_EXTRA7[l]); });
|
| 2820 |
const I18N_EXTRA8 = {"sw": {"dq_paused_resume": "Imesimamishwa — gusa ↻ kuendelea"}, "en": {"dq_paused_resume": "Paused — tap ↻ to resume"}, "ar": {"dq_paused_resume": "متوقف مؤقتاً — اضغط ↻ للمتابعة"}, "fr": {"dq_paused_resume": "En pause — touchez ↻ pour reprendre"}};
|
| 2821 |
Object.keys(I18N_EXTRA8).forEach(l => { I18N[l] = Object.assign(I18N[l] || {}, I18N_EXTRA8[l]); });
|
| 2822 |
+
const I18N_EXTRA10 = {"sw": {"ad_label": "Tangazo", "ad_skip": "Ruka ›", "ad_skip_in": "Ruka baada ya {n}s", "ad_open": "Fungua tangazo ↗"}, "en": {"ad_label": "Ad", "ad_skip": "Skip ›", "ad_skip_in": "Skip in {n}s", "ad_open": "Open ad ↗"}, "ar": {"ad_label": "إعلان", "ad_skip": "تخطي ›", "ad_skip_in": "تخطي بعد {n} ث", "ad_open": "فتح الإعلان ↗"}, "fr": {"ad_label": "Publicité", "ad_skip": "Passer ›", "ad_skip_in": "Passer dans {n}s", "ad_open": "Ouvrir la pub ↗"}};
|
| 2823 |
Object.keys(I18N_EXTRA10).forEach(l => { I18N[l] = Object.assign(I18N[l] || {}, I18N_EXTRA10[l]); });
|
| 2824 |
function T(k, v) { return t(k, v); }
|
| 2825 |
// Maandishi yaliyoandikwa kwenye HTML kupitia data-i18n / data-i18n-ph / data-i18n-title
|
|
|
|
| 3291 |
jmxSyncAds();
|
| 3292 |
const sc = document.createElement('script'); sc.async = true; sc.setAttribute('data-cfasync', 'false'); sc.src = JMX_ADS.social.src; document.body.appendChild(sc);
|
| 3293 |
}
|
| 3294 |
+
// ── Video Ads (pre-roll, VAST) — HilltopAds ──
|
| 3295 |
+
// Tangazo la video huchezwa kabla ya filamu/series. Likishindikana kwa sababu yoyote (mtandao, CORS, tupu, muda), filamu inaanza moja kwa moja.
|
| 3296 |
+
// Zima: JM_CONFIG.ADS_ENABLED = false kwenye config.js, au JMX_VAST.url = ''. Hali ya Mtoto haionyeshi matangazo.
|
| 3297 |
+
const JMX_VAST = {
|
| 3298 |
+
url: 'https://sadpicture.com/dMmlFsz.dhGcNovMZkGwUp/teFmT9hugZPUjl/kUPMT-c/1IM/TQAmxdN/j_kYt/NqzCUsxNM/DREX3AMdwv',
|
| 3299 |
+
fetchMs: 6000, // muda wa juu wa kupata VAST XML
|
| 3300 |
+
startMs: 9000, // muda wa juu wa video ya tangazo kuanza kucheza
|
| 3301 |
+
minGapMs: 4 * 60 * 1000, // usionyeshe tangazo tena ndani ya dakika 4
|
| 3302 |
+
skipAfter: 5, // sekunde ya kuruhusu "Ruka" kama VAST haijaweka skipoffset
|
| 3303 |
+
maxWrap: 4,
|
| 3304 |
+
};
|
| 3305 |
+
let __jmxPre = null; // tangazo linaloendelea sasa: { end(reason) }
|
| 3306 |
+
let __jmxPlayTok = 0; // kutambua kama mtumiaji alibadilisha filamu wakati tangazo linaendelea
|
| 3307 |
+
function jmxPrerollAbort(){ try { if (__jmxPre) __jmxPre.end('aborted'); } catch (_) {} }
|
| 3308 |
+
function jmxVastSecs(s){
|
| 3309 |
+
s = (s || '').trim();
|
| 3310 |
+
const m = /^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(s);
|
| 3311 |
+
return m ? (+m[1]) * 3600 + (+m[2]) * 60 + parseFloat(m[3]) : null;
|
| 3312 |
+
}
|
| 3313 |
+
function jmxPing(u, code){
|
| 3314 |
+
if (!u) return;
|
| 3315 |
+
try {
|
| 3316 |
+
u = u.replace(/\[(CACHEBUSTING|TIMESTAMP|RANDOM)\]/g, () => String(Date.now()) + Math.floor(Math.random() * 1e6)).replace(/\[ERRORCODE\]/g, String(code || 900));
|
| 3317 |
+
const i = new Image(); i.referrerPolicy = 'no-referrer-when-downgrade'; i.src = u;
|
| 3318 |
+
} catch (_) {}
|
| 3319 |
+
}
|
| 3320 |
+
async function jmxVastLoad(url, depth, acc){
|
| 3321 |
+
const ctl = new AbortController(), to = setTimeout(() => ctl.abort(), JMX_VAST.fetchMs);
|
| 3322 |
+
let txt;
|
| 3323 |
+
try {
|
| 3324 |
+
const r = await fetch(url, { signal: ctl.signal, credentials: 'omit' });
|
| 3325 |
+
if (!r.ok) throw new Error('http ' + r.status);
|
| 3326 |
+
txt = await r.text();
|
| 3327 |
+
} finally { clearTimeout(to); }
|
| 3328 |
+
const doc = new DOMParser().parseFromString(txt, 'text/xml');
|
| 3329 |
+
if (doc.getElementsByTagName('parsererror').length) throw new Error('xml');
|
| 3330 |
+
const ad = doc.getElementsByTagName('Ad')[0];
|
| 3331 |
+
if (!ad) throw new Error('empty');
|
| 3332 |
+
const tx = el => ((el && el.textContent) || '').trim();
|
| 3333 |
+
const all = tag => Array.from(ad.getElementsByTagName(tag));
|
| 3334 |
+
all('Impression').forEach(e => { const u = tx(e); if (u) acc.imps.push(u); });
|
| 3335 |
+
all('Error').forEach(e => { const u = tx(e); if (u) acc.errs.push(u); });
|
| 3336 |
+
all('ClickTracking').forEach(e => { const u = tx(e); if (u) acc.clickTr.push(u); });
|
| 3337 |
+
all('Tracking').forEach(e => { const ev = e.getAttribute('event'), u = tx(e); if (ev && u) (acc.track[ev] = acc.track[ev] || []).push(u); });
|
| 3338 |
+
if (ad.getElementsByTagName('Wrapper')[0]) {
|
| 3339 |
+
const next = tx(ad.getElementsByTagName('VASTAdTagURI')[0]);
|
| 3340 |
+
if (!next || depth >= JMX_VAST.maxWrap) throw new Error('wrapper');
|
| 3341 |
+
return jmxVastLoad(next, depth + 1, acc);
|
| 3342 |
+
}
|
| 3343 |
+
const lin = all('Linear')[0];
|
| 3344 |
+
if (!lin) throw new Error('no_linear');
|
| 3345 |
+
const files = all('MediaFile').map(e => ({
|
| 3346 |
+
url: tx(e), type: (e.getAttribute('type') || '').toLowerCase(), w: +e.getAttribute('width') || 0,
|
| 3347 |
+
prog: !/streaming/i.test(e.getAttribute('delivery') || 'progressive'),
|
| 3348 |
+
})).filter(f => f.url && /video\/(mp4|webm)/.test(f.type) && f.prog);
|
| 3349 |
+
if (!files.length) throw new Error('no_media');
|
| 3350 |
+
const can = f => { try { return !!document.createElement('video').canPlayType(f.type); } catch (_) { return true; } };
|
| 3351 |
+
const ok = files.filter(can); const pool = ok.length ? ok : files;
|
| 3352 |
+
pool.sort((a, b) => Math.abs((a.w || 640) - 720) - Math.abs((b.w || 640) - 720));
|
| 3353 |
+
acc.media = pool[0].url;
|
| 3354 |
+
acc.click = tx(all('ClickThrough')[0]) || '';
|
| 3355 |
+
acc.dur = jmxVastSecs(tx(all('Duration')[0]));
|
| 3356 |
+
acc.skipoff = lin.getAttribute('skipoffset') || '';
|
| 3357 |
+
return acc;
|
| 3358 |
+
}
|
| 3359 |
+
function jmxPreroll(){
|
| 3360 |
+
if (!JMX_VAST.url || !jmxAdsOn() || playerEl.classList.contains('mini')) return Promise.resolve('skipped');
|
| 3361 |
+
try { const last = +localStorage.getItem('jm_preroll_at') || 0; if (Date.now() - last < JMX_VAST.minGapMs) return Promise.resolve('skipped'); } catch (_) {}
|
| 3362 |
+
jmxPrerollAbort();
|
| 3363 |
+
return new Promise(resolve => {
|
| 3364 |
+
let ov = null, av = null, vast = null, done = false, fired = {}, timers = [], mo = null;
|
| 3365 |
+
const track = (ev) => { if (vast && vast.track[ev]) vast.track[ev].forEach(u => jmxPing(u)); };
|
| 3366 |
+
const once = (ev) => { if (fired[ev]) return; fired[ev] = 1; track(ev); };
|
| 3367 |
+
const end = (reason) => {
|
| 3368 |
+
if (done) return; done = true;
|
| 3369 |
+
timers.forEach(clearTimeout); timers.forEach(clearInterval);
|
| 3370 |
+
try { if (mo) mo.disconnect(); } catch (_) {}
|
| 3371 |
+
try { if (av) { av.pause(); av.removeAttribute('src'); av.load(); } } catch (_) {}
|
| 3372 |
+
try { if (ov && ov.parentNode) ov.parentNode.removeChild(ov); } catch (_) {}
|
| 3373 |
+
if (__jmxPre && __jmxPre.end === end) __jmxPre = null;
|
| 3374 |
+
resolve(reason);
|
| 3375 |
+
};
|
| 3376 |
+
__jmxPre = { end };
|
| 3377 |
+
(async () => {
|
| 3378 |
+
try {
|
| 3379 |
+
vast = await jmxVastLoad(JMX_VAST.url, 0, { imps: [], errs: [], clickTr: [], track: {}, media: '', click: '', dur: null, skipoff: '' });
|
| 3380 |
+
} catch (e) { return end('failed'); }
|
| 3381 |
+
if (done) return;
|
| 3382 |
+
if (!stage || !playerEl.classList.contains('on')) return end('failed');
|
| 3383 |
+
ov = document.createElement('div'); ov.className = 'jmx-pre';
|
| 3384 |
+
ov.innerHTML = '<video playsinline webkit-playsinline preload="auto"></video>' +
|
| 3385 |
+
'<div class="jmx-pre-top"><span>' + esc(T('ad_label')) + '</span><span class="jmx-pre-t"></span></div>' +
|
| 3386 |
+
'<div class="jmx-pre-btns"><button type="button" class="jmx-pre-btn jmx-pre-mute" hidden>🔇</button>' +
|
| 3387 |
+
'<button type="button" class="jmx-pre-btn jmx-pre-open" hidden>' + esc(T('ad_open')) + '</button>' +
|
| 3388 |
+
'<button type="button" class="jmx-pre-btn jmx-pre-skip" hidden></button></div>' +
|
| 3389 |
+
'<div class="jmx-pre-bar"><i></i></div>';
|
| 3390 |
+
stage.appendChild(ov);
|
| 3391 |
+
av = ov.querySelector('video');
|
| 3392 |
+
const tEl = ov.querySelector('.jmx-pre-t'), skipB = ov.querySelector('.jmx-pre-skip'), openB = ov.querySelector('.jmx-pre-open'),
|
| 3393 |
+
muteB = ov.querySelector('.jmx-pre-mute'), bar = ov.querySelector('.jmx-pre-bar i');
|
| 3394 |
+
// Kulinda: kitu kikifuta stage au mtumiaji akifunga player, tangazo linaisha
|
| 3395 |
+
mo = new MutationObserver(() => { if (!playerEl.classList.contains('on') || !ov.isConnected) end(ov.isConnected ? 'aborted' : 'done'); });
|
| 3396 |
+
mo.observe(playerEl, { attributes: true, attributeFilter: ['class'] });
|
| 3397 |
+
timers.push(setTimeout(() => { if (!fired.__playing) { vast.errs.forEach(u => jmxPing(u, 402)); end('failed'); } }, JMX_VAST.startMs));
|
| 3398 |
+
av.addEventListener('error', () => { vast.errs.forEach(u => jmxPing(u, 405)); end('failed'); });
|
| 3399 |
+
av.addEventListener('playing', () => {
|
| 3400 |
+
if (fired.__playing) return; fired.__playing = 1;
|
| 3401 |
+
try { localStorage.setItem('jm_preroll_at', String(Date.now())); } catch (_) {}
|
| 3402 |
+
vast.imps.forEach(u => jmxPing(u)); once('creativeView'); once('start');
|
| 3403 |
+
if (vast.click) openB.hidden = false;
|
| 3404 |
+
});
|
| 3405 |
+
av.addEventListener('pause', () => { if (!av.ended && fired.__playing) track('pause'); });
|
| 3406 |
+
av.addEventListener('play', () => { if (fired.__playing) track('resume'); });
|
| 3407 |
+
av.addEventListener('ended', () => { once('complete'); end('done'); });
|
| 3408 |
+
muteB.onclick = () => { av.muted = !av.muted; muteB.textContent = av.muted ? '🔇' : '🔊'; track(av.muted ? 'mute' : 'unmute'); };
|
| 3409 |
+
openB.onclick = () => {
|
| 3410 |
+
vast.clickTr.forEach(u => jmxPing(u));
|
| 3411 |
+
try { window.open(vast.click, '_blank', 'noopener'); } catch (_) {}
|
| 3412 |
+
try { av.pause(); } catch (_) {}
|
| 3413 |
+
};
|
| 3414 |
+
skipB.onclick = () => { if (skipB.disabled) return; track('skip'); end('done'); };
|
| 3415 |
+
const tick = () => {
|
| 3416 |
+
if (!ov.isConnected) return end('done');
|
| 3417 |
+
const d = isFinite(av.duration) && av.duration > 0 ? av.duration : (vast.dur || 0), c = av.currentTime || 0;
|
| 3418 |
+
if (d) {
|
| 3419 |
+
bar.style.width = Math.min(100, c / d * 100) + '%';
|
| 3420 |
+
const left = Math.max(0, Math.ceil(d - c)); tEl.textContent = Math.floor(left / 60) + ':' + String(left % 60).padStart(2, '0');
|
| 3421 |
+
if (c >= d * .25) once('firstQuartile'); if (c >= d * .5) once('midpoint'); if (c >= d * .75) once('thirdQuartile');
|
| 3422 |
+
}
|
| 3423 |
+
let so = jmxVastSecs(vast.skipoff);
|
| 3424 |
+
if (so == null && /%$/.test(vast.skipoff) && d) so = d * parseFloat(vast.skipoff) / 100;
|
| 3425 |
+
if (so == null) so = JMX_VAST.skipAfter;
|
| 3426 |
+
if (d && so >= d) so = Math.max(0, d - 1);
|
| 3427 |
+
skipB.hidden = false;
|
| 3428 |
+
if (c >= so) { skipB.disabled = false; skipB.textContent = T('ad_skip'); skipB.classList.add('ready'); }
|
| 3429 |
+
else { skipB.disabled = true; skipB.textContent = T('ad_skip_in', { n: Math.ceil(so - c) }); }
|
| 3430 |
+
};
|
| 3431 |
+
timers.push(setInterval(tick, 250));
|
| 3432 |
+
av.src = vast.media;
|
| 3433 |
+
av.muted = false;
|
| 3434 |
+
const pr = av.play();
|
| 3435 |
+
if (pr && pr.catch) pr.catch(() => { av.muted = true; muteB.hidden = false; muteB.textContent = '🔇'; av.play().catch(() => { vast.errs.forEach(u => jmxPing(u, 400)); end('failed'); }); });
|
| 3436 |
+
// Kama sauti ilikubaliwa onyesha kitufe cha sauti pia
|
| 3437 |
+
setTimeout(() => { if (!done) muteB.hidden = false; muteB.textContent = av.muted ? '🔇' : '🔊'; }, 800);
|
| 3438 |
+
})();
|
| 3439 |
+
});
|
| 3440 |
+
}
|
| 3441 |
function renderRails(sections, gridMode = false) {
|
| 3442 |
railsEl.innerHTML = '';
|
| 3443 |
if (isKidsMode()) sections = sections.map(sec => ({ ...sec, items: kidsModeFilter(sec.items) })).filter(sec => sec.items.length);
|
|
|
|
| 4035 |
if (playlist) setPlayerPlaylist(playlist); // kichupo cha pembeni: vipindi / sehemu
|
| 4036 |
ensureSound(v);
|
| 4037 |
v.addEventListener('ended', () => { const c = window.__pcPlaylist; if (c && typeof c.next === 'function') c.next(); });
|
| 4038 |
+
// Tangazo la video kwanza (likishindikana/likiruka, filamu inaanza mara moja)
|
| 4039 |
+
jmxPreroll().then(r => { if (r !== 'aborted' && v.isConnected) v.src = url; });
|
| 4040 |
// Route ya player: #/translated/ID/play?se=..&ep=..
|
| 4041 |
try {
|
| 4042 |
const id = currentTranslatedDetail && currentTranslatedDetail.id;
|
|
|
|
| 6163 |
currentBlobUrls = [];
|
| 6164 |
}
|
| 6165 |
function stopPlayer(){
|
| 6166 |
+
jmxPrerollAbort();
|
| 6167 |
playerEl.classList.remove('mini');
|
| 6168 |
clearUpNext();
|
| 6169 |
if (document.pictureInPictureElement) { document.exitPictureInPicture().catch(()=>{}); }
|
|
|
|
| 6182 |
}
|
| 6183 |
function openPlayerShell(title){
|
| 6184 |
liveFb = null;
|
| 6185 |
+
jmxPrerollAbort();
|
| 6186 |
stopPlayer();
|
| 6187 |
ptitle.textContent = title;
|
| 6188 |
playerEl.classList.add('on');
|
|
|
|
| 7059 |
Router.go('/watch/' + d.id + (se != null && ep != null ? '?se=' + se + '&ep=' + ep : ''));
|
| 7060 |
openPlayerShell(d.title + (ep != null ? (' - S' + se + 'E' + ep) : ''));
|
| 7061 |
if (se != null && ep != null) setPlayerPlaylist(buildMoviePlaylist(d, se, ep));
|
| 7062 |
+
const adTok = ++__jmxPlayTok;
|
| 7063 |
+
const adP = jmxPreroll(); // tangazo la video linaanza sambamba na kutafuta mtiririko wa filamu
|
| 7064 |
try {
|
| 7065 |
let pr;
|
| 7066 |
if (se != null && ep != null) {
|
|
|
|
| 7072 |
pr = parsePlayResult(await rpc('movies.play', args));
|
| 7073 |
}
|
| 7074 |
if (!pr) throw new Error(T('err_no_stream'));
|
| 7075 |
+
if ((await adP) === 'aborted' || adTok !== __jmxPlayTok || !playerEl.classList.contains('on')) return;
|
| 7076 |
await playResultInPlayer(pr, d.title, { id: d.id, se, ep, title: d.title, poster: d.poster || d.backdrop || null });
|
| 7077 |
} catch (e) {
|
| 7078 |
+
jmxPrerollAbort();
|
| 7079 |
statusMsg('<span style="color:#ffb4ab">' + T('err_failed', { e: esc(e.message) }) + '</span>');
|
| 7080 |
}
|
| 7081 |
}
|