Eerste versie: IPTV-app met zenderfilter, tv-gids en eigen Homebrew-bron

This commit is contained in:
Frank committed 2026-10-27 19:41:57 +01:00
commit 94dffa122f
26 files changed
+1740

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
{
"id": "nl.eigen.iptv",
"version": "1.0.0",
"vendor": "Eigen",
"type": "web",
"main": "index.html",
"title": "Eigen IPTV",
"icon": "icon.png",
"largeIcon": "largeIcon.png",
"bgColor": "#000000",
"resolution": "1920x1080",
"disableBackHistoryAPI": true,
"transparent": false
}
+138
View File
@@ -0,0 +1,138 @@
* { box-sizing: border-box; }
html, body {
margin: 0; width: 1920px; height: 1080px; overflow: hidden;
background: #000; color: #eee;
font-family: "LG Smart UI", "Museo Sans", Arial, sans-serif; font-size: 30px;
}
.hidden { display: none !important; }
#video { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; background: #000; }
/* ---------- OSD ---------- */
#osd {
position: absolute; left: 80px; right: 80px; bottom: 60px; padding: 30px 40px;
background: rgba(10, 14, 22, .88); border-radius: 18px; border: 1px solid #2c3442;
}
.osd-top { display: flex; align-items: center; margin-bottom: 18px; }
.osd-num { font-size: 52px; font-weight: bold; color: #ffb000; min-width: 90px; }
.osd-logo { height: 64px; max-width: 160px; object-fit: contain; }
.osd-name { font-size: 46px; font-weight: bold; flex: 1; }
.osd-clock { font-size: 40px; color: #aaa; }
.osd-now, .osd-next { display: flex; align-items: baseline; font-size: 34px; }
.osd-next { color: #aab; margin-top: 10px; font-size: 30px; }
.osd-label { color: #ffb000; min-width: 110px; font-weight: bold; }
.osd-time { color: #9ab; min-width: 200px; }
.osd-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd-bar { height: 8px; background: #333; border-radius: 4px; margin: 12px 0 4px; }
#osd-progress { height: 100%; background: #ffb000; border-radius: 4px; width: 0; }
#numentry {
position: absolute; right: 80px; top: 60px; font-size: 90px; font-weight: bold;
color: #ffb000; background: rgba(0,0,0,.7); padding: 10px 40px; border-radius: 14px;
}
#message {
position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
max-width: 1400px; padding: 30px 50px; font-size: 36px; text-align: center;
background: rgba(20, 20, 20, .92); border: 2px solid #ffb000; border-radius: 16px;
}
/* ---------- panelen & schermen ---------- */
.panel {
position: absolute; left: 0; top: 0; bottom: 0; width: 700px; padding: 40px 30px;
background: rgba(8, 10, 16, .94); border-right: 2px solid #2c3442;
}
.panel-title { font-size: 44px; font-weight: bold; margin-bottom: 20px; }
.screen { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; background: #0b0e14; padding: 50px 80px; }
h1 { margin: 0 0 30px; font-size: 52px; }
.count { color: #ffb000; font-size: 34px; margin-left: 20px; }
.hint { position: absolute; left: 80px; right: 80px; bottom: 26px; color: #789; font-size: 26px; }
.panel .hint { left: 30px; right: 30px; }
.list-items { height: 880px; overflow: hidden; }
.li {
display: flex; align-items: center; padding: 12px 18px; border-radius: 10px;
border: 3px solid transparent; height: 88px;
}
.li .n { color: #ffb000; min-width: 64px; font-weight: bold; }
.li .t { flex: 1; overflow: hidden; }
.li .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .sub { color: #8a96a8; font-size: 24px; }
.li.playing .t div:first-child { color: #ffd060; }
.focus { border-color: #ffb000 !important; background: rgba(255, 176, 0, .14) !important; }
/* ---------- instellingen ---------- */
.form { max-width: 1300px; }
.row { display: flex; align-items: center; margin-bottom: 18px; }
.row label { width: 330px; color: #aab; }
.row input, .toggle {
flex: 1; font-size: 30px; padding: 14px 20px; background: #161b25; color: #fff;
border: 3px solid #2c3442; border-radius: 10px; outline: none;
}
.toggle { display: flex; padding: 8px; }
.toggle span { padding: 8px 22px; border-radius: 8px; color: #889; }
.toggle span.on { background: #ffb000; color: #000; font-weight: bold; }
.buttons { display: flex; margin-top: 34px; }
button {
font-size: 30px; padding: 18px 34px; background: #1e2532; color: #fff;
border: 3px solid #2c3442; border-radius: 12px; font-family: inherit;
}
.status { margin-top: 30px; font-size: 30px; color: #9fc; min-height: 80px; white-space: pre-line; }
.status.err { color: #ff8a80; }
/* ---------- zenders kiezen ---------- */
#pk-search {
width: 700px; font-size: 30px; padding: 14px 20px; background: #161b25; color: #fff;
border: 3px solid #2c3442; border-radius: 10px; outline: none; margin-bottom: 20px;
}
.pk-cols { display: flex; height: 780px; }
.pk-col { background: #11151d; border-radius: 12px; padding: 10px; overflow: hidden; }
.pk-groups { width: 560px; }
.pk-chans { flex: 1; }
.pk-item {
display: flex; align-items: center; height: 62px; padding: 0 16px;
border: 3px solid transparent; border-radius: 8px; white-space: nowrap; overflow: hidden;
}
.pk-item .box { width: 34px; color: #ffb000; font-size: 32px; }
.pk-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.pk-item .gc { color: #789; font-size: 24px; }
.pk-item.sel .nm { color: #ffd060; }
.pk-col.active .focus { background: rgba(255, 176, 0, .22) !important; }
.pk-col:not(.active) .focus { border-color: #7a6020 !important; background: transparent !important; }
/* ---------- gids ---------- */
#guide { padding: 30px 50px; }
.guide-detail { height: 230px; padding: 10px 10px 20px; border-bottom: 2px solid #2c3442; }
.gd-title { font-size: 44px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-meta { color: #ffb000; font-size: 28px; margin: 8px 0; }
.gd-desc { color: #bcc; font-size: 26px; line-height: 1.35; max-height: 110px; overflow: hidden; }
.guide-head { display: flex; height: 60px; align-items: flex-end; margin-top: 10px; }
.guide-day { width: 390px; color: #ffb000; font-size: 28px; padding-bottom: 8px; }
.guide-times { position: relative; flex: 1; height: 100%; }
.guide-times span { position: absolute; bottom: 8px; color: #9ab; font-size: 26px; }
.guide-rows { position: relative; height: 680px; }
.g-row { position: relative; display: flex; height: 85px; border-bottom: 1px solid #1e2430; }
.g-ch {
width: 390px; display: flex; align-items: center; padding: 0 12px;
background: #121722; white-space: nowrap; overflow: hidden;
}
.g-ch .n { color: #ffb000; min-width: 50px; font-weight: bold; }
.g-ch img { height: 46px; max-width: 80px; object-fit: contain; }
.g-ch .nm { overflow: hidden; text-overflow: ellipsis; }
.g-progs { position: relative; flex: 1; overflow: hidden; }
.g-p {
position: absolute; top: 4px; bottom: 4px; padding: 10px 14px; background: #1a2130;
border: 3px solid #0b0e14; border-radius: 8px; overflow: hidden; white-space: nowrap;
text-overflow: ellipsis; font-size: 26px;
}
.g-p.live { background: #233047; }
.g-p.empty { color: #667; background: #141923; }
.g-now { position: absolute; top: 0; bottom: 0; width: 3px; background: #ff3b30; z-index: 5; }
/* flex-gap bestaat pas vanaf Chromium 84; webOS 5 heeft 68, dus marges */
.osd-top > * + * { margin-left: 24px; }
.osd-now > * + *, .osd-next > * + * { margin-left: 22px; }
.li > * + * { margin-left: 18px; }
.toggle > * + * { margin-left: 14px; }
.buttons > * + * { margin-left: 24px; }
.pk-cols > * + * { margin-left: 30px; }
.pk-item > * + * { margin-left: 16px; }
.g-ch > * + * { margin-left: 12px; }
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

+104
View File
@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1920, height=1080">
<title>Eigen IPTV</title>
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<video id="video" autoplay playsinline></video>
<!-- zenderinfo bij zappen -->
<div id="osd" class="hidden">
<div class="osd-top">
<span id="osd-num" class="osd-num"></span>
<img id="osd-logo" class="osd-logo" alt="">
<span id="osd-name" class="osd-name"></span>
<span id="osd-clock" class="osd-clock"></span>
</div>
<div class="osd-now">
<span class="osd-label">Nu</span>
<span id="osd-now-time" class="osd-time"></span>
<span id="osd-now-title" class="osd-title"></span>
</div>
<div class="osd-bar"><div id="osd-progress"></div></div>
<div class="osd-next">
<span class="osd-label">Straks</span>
<span id="osd-next-time" class="osd-time"></span>
<span id="osd-next-title" class="osd-title"></span>
</div>
</div>
<div id="numentry" class="hidden"></div>
<div id="message" class="hidden"></div>
<!-- zenderlijst (OK-knop) -->
<div id="list" class="panel hidden">
<div class="panel-title">Zenders</div>
<div id="list-items" class="list-items"></div>
<div class="hint">OK kijken · Terug sluiten · Rood gids · Blauw instellingen</div>
</div>
<!-- tv-gids -->
<div id="guide" class="screen hidden">
<div id="guide-detail" class="guide-detail">
<div id="gd-title" class="gd-title"></div>
<div id="gd-meta" class="gd-meta"></div>
<div id="gd-desc" class="gd-desc"></div>
</div>
<div class="guide-head">
<div id="guide-day" class="guide-day"></div>
<div id="guide-times" class="guide-times"></div>
</div>
<div id="guide-rows" class="guide-rows"></div>
<div class="hint">◀ ▶ programma · ▲ ▼ zender · OK kijken · CH+/− pagina · Terug sluiten</div>
</div>
<!-- instellingen -->
<div id="settings" class="screen hidden">
<h1>Instellingen</h1>
<div class="form">
<div class="row"><label>Bron</label>
<div class="toggle" data-nav id="src-type"><span data-v="m3u">M3U-link</span><span data-v="xtream">Xtream Codes</span></div>
</div>
<div class="row only-m3u"><label>M3U-URL</label><input data-nav id="f-m3u" type="url" placeholder="http://…/playlist.m3u"></div>
<div class="row only-xtream"><label>Server</label><input data-nav id="f-server" type="url" placeholder="http://server:poort"></div>
<div class="row only-xtream"><label>Gebruikersnaam</label><input data-nav id="f-user" type="text"></div>
<div class="row only-xtream"><label>Wachtwoord</label><input data-nav id="f-pass" type="password"></div>
<div class="row only-xtream"><label>Streamformaat</label>
<div class="toggle" data-nav id="f-output"><span data-v="m3u8">HLS (m3u8)</span><span data-v="ts">MPEG-TS</span></div>
</div>
<div class="row"><label>EPG-URL (gids)</label><input data-nav id="f-epg" type="url" placeholder="leeg = automatisch"></div>
<div class="buttons">
<button data-nav id="b-load">Zenders laden en kiezen</button>
<button data-nav id="b-epg">Gids verversen</button>
<button data-nav id="b-back">Naar tv</button>
</div>
<div id="settings-status" class="status"></div>
</div>
<div class="hint">▲ ▼ ◀ ▶ navigeren · OK kiezen/typen · Terug naar tv</div>
</div>
<!-- zenders kiezen -->
<div id="picker" class="screen hidden">
<h1>Zenders kiezen <span id="pk-count" class="count"></span></h1>
<input id="pk-search" type="text" placeholder="Zoeken…">
<div class="pk-cols">
<div id="pk-groups" class="pk-col pk-groups"></div>
<div id="pk-chans" class="pk-col pk-chans"></div>
</div>
<div id="pk-hint" class="hint"></div>
</div>
<script src="vendor/pako_inflate.es5.min.js"></script>
<script src="vendor/mpegts.js"></script>
<script src="vendor/hls.light.min.js"></script>
<script src="js/util.js"></script>
<script src="js/sources.js"></script>
<script src="js/epg.js"></script>
<script src="js/player.js"></script>
<script src="js/views.js"></script>
<script src="js/main.js"></script>
</body>
</html>
+196
View File
@@ -0,0 +1,196 @@
/* Tv-gids (XMLTV). Grote gidsbestanden (tientallen MB, ook .gz) worden in stukjes gelezen,
en alleen programma's van je gekozen zenders worden bewaard. Zo blijft het geheugen van de tv klein. */
(function (App) {
'use strict';
var KEEP_BEFORE = 3 * 3600e3; // programma's tot 3 uur terug
var KEEP_AFTER = 2 * 86400e3; // en tot 2 dagen vooruit
var MAX_AGE = 6 * 3600e3; // gids na 6 uur verversen
var Epg = { data: {}, map: {}, at: 0, loading: false };
App.Epg = Epg;
/* "20261027203000 +0100" -> ms */
Epg.parseTime = function (s) {
var m = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})?\s*([+-]\d{2}):?(\d{2})?/.exec(String(s || '').trim());
if (!m) return NaN;
var t = Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +(m[6] || 0));
if (m[7]) {
var sign = m[7].charAt(0) === '-' ? -1 : 1;
var off = sign * (Math.abs(parseInt(m[7], 10)) * 60 + parseInt(m[8] || '0', 10));
t -= off * 60000;
}
return t;
};
function attr(tag, name) {
var m = new RegExp('\\s' + name + '\\s*=\\s*"([^"]*)"').exec(tag) || new RegExp('\\s' + name + "\\s*=\\s*'([^']*)'").exec(tag);
return m ? m[1] : '';
}
function inner(xml, name) {
var m = new RegExp('<' + name + '(?:\\s[^>]*)?>([\\s\\S]*?)</' + name + '>').exec(xml);
return m ? App.xmlText(m[1]) : '';
}
/* Leest XMLTV-tekst die in brokken binnenkomt */
function Scanner(wantedIds, wantedNames, now) {
this.buf = '';
this.wantedIds = wantedIds; // epg-id (kleine letters) -> true
this.wantedNames = wantedNames; // genormaliseerde naam -> [zendersleutel]
this.nameIds = {}; // epg-id gevonden via naam -> true
this.nameMap = {}; // zendersleutel -> epg-id
this.data = {};
this.kept = 0;
this.min = now - KEEP_BEFORE;
this.max = now + KEEP_AFTER;
}
Scanner.prototype.push = function (text) {
this.buf += text;
var buf = this.buf, pos = 0, ci = -2, pi = -2;
for (;;) {
// zoekresultaten hergebruiken: anders wordt de buffer per element opnieuw doorzocht
if (ci !== -1 && ci < pos) ci = buf.indexOf('<channel', pos);
if (pi !== -1 && pi < pos) pi = buf.indexOf('<programme', pos);
var start, isProg;
if (pi >= 0 && (ci < 0 || pi < ci)) { start = pi; isProg = true; }
else if (ci >= 0) { start = ci; isProg = false; }
else { this.buf = buf.slice(Math.max(pos, buf.length - 16)); return; }
var gt = buf.indexOf('>', start);
if (gt < 0) { this.buf = buf.slice(start); return; }
var open = buf.slice(start, gt + 1), elem, next;
if (buf.charAt(gt - 1) === '/') { elem = open; next = gt + 1; }
else {
var closeTag = isProg ? '</programme>' : '</channel>';
var end = buf.indexOf(closeTag, gt);
if (end < 0) { this.buf = buf.slice(start); return; }
next = end + closeTag.length;
elem = buf.slice(start, next);
}
if (isProg) this.programme(open, elem); else this.channel(open, elem);
pos = next;
}
};
Scanner.prototype.channel = function (open, elem) {
var id = attr(open, 'id').toLowerCase();
if (!id) return;
var re = /<display-name[^>]*>([\s\S]*?)<\/display-name>/g, m;
while ((m = re.exec(elem)) !== null) {
var keys = this.wantedNames[App.normName(App.xmlText(m[1]))];
if (!keys) continue;
for (var i = 0; i < keys.length; i++) if (!this.nameMap[keys[i]]) this.nameMap[keys[i]] = id;
this.nameIds[id] = true;
}
};
Scanner.prototype.programme = function (open, elem) {
var id = attr(open, 'channel').toLowerCase();
if (!this.wantedIds[id] && !this.nameIds[id]) return;
var s = Epg.parseTime(attr(open, 'start')), e = Epg.parseTime(attr(open, 'stop'));
if (isNaN(s)) return;
if (isNaN(e)) e = s + 30 * 60000;
if (e < this.min || s > this.max) return;
var desc = inner(elem, 'desc');
if (desc.length > 400) desc = desc.slice(0, 397) + '…';
(this.data[id] || (this.data[id] = [])).push([s, e, inner(elem, 'title') || '(zonder titel)', desc]);
this.kept++;
};
/* Haal de gids op voor de gekozen zenders */
Epg.load = function (url, channels, onProgress) {
if (!url) return Promise.reject(new Error('Geen EPG-URL bekend. Vul er een in bij Instellingen.'));
var wantedIds = {}, wantedNames = {};
channels.forEach(function (c) {
if (c.tvgId) wantedIds[c.tvgId.toLowerCase()] = true;
var n = App.normName(c.name);
(wantedNames[n] || (wantedNames[n] = [])).push(c.key);
});
var sc = new Scanner(wantedIds, wantedNames, Date.now());
var bytes = 0, decoder = new TextDecoder('utf-8'), inflator = null, first = true;
Epg.loading = true;
function feedRaw(chunk) {
bytes += chunk.length;
if (first) {
first = false;
if (chunk[0] === 0x1f && chunk[1] === 0x8b) {
inflator = new pako.Inflate();
inflator.onData = function (out) { sc.push(decoder.decode(out, { stream: true })); };
}
}
if (inflator) {
inflator.push(chunk, false);
if (inflator.err) throw new Error('Gids uitpakken mislukt: ' + inflator.msg);
} else sc.push(decoder.decode(chunk, { stream: true }));
if (onProgress) onProgress(bytes, sc.kept);
}
function finish() {
if (inflator) inflator.push(new Uint8Array(0), true);
sc.push(decoder.decode());
var map = {};
channels.forEach(function (c) {
var id = c.tvgId ? c.tvgId.toLowerCase() : '';
if (id && sc.data[id]) map[c.key] = id;
else if (sc.nameMap[c.key] && sc.data[sc.nameMap[c.key]]) map[c.key] = sc.nameMap[c.key];
});
Object.keys(sc.data).forEach(function (id) { sc.data[id].sort(function (a, b) { return a[0] - b[0]; }); });
Epg.data = sc.data; Epg.map = map; Epg.at = Date.now(); Epg.loading = false;
Epg.save();
return { programmes: sc.kept, matched: Object.keys(map).length, total: channels.length, mb: bytes / 1048576 };
}
return App.fetchWithTimeout(url, 300000).then(function (r) {
if (!r.ok) throw new Error('HTTP ' + r.status + ' bij gids');
if (r.body && r.body.getReader) {
var reader = r.body.getReader();
var pump = function () {
return reader.read().then(function (res) {
if (res.done) return finish();
feedRaw(res.value);
return pump();
});
};
return pump();
}
return r.arrayBuffer().then(function (buf) { feedRaw(new Uint8Array(buf)); return finish(); });
}).catch(function (e) { Epg.loading = false; throw e; });
};
Epg.save = function () {
var payload = { at: Epg.at, map: Epg.map, data: Epg.data };
if (App.store.set('epg', payload)) return;
// te groot: beschrijvingen weglaten
var slim = {};
Object.keys(Epg.data).forEach(function (id) {
slim[id] = Epg.data[id].map(function (p) { return [p[0], p[1], p[2], '']; });
});
App.store.set('epg', { at: Epg.at, map: Epg.map, data: slim });
};
Epg.restore = function () {
var c = App.store.get('epg', null);
if (!c || !c.data) return;
var min = Date.now() - KEEP_BEFORE;
Object.keys(c.data).forEach(function (id) {
c.data[id] = c.data[id].filter(function (p) { return p[1] > min; });
});
Epg.data = c.data; Epg.map = c.map || {}; Epg.at = c.at || 0;
};
Epg.isStale = function () { return !Epg.at || Date.now() - Epg.at > MAX_AGE; };
Epg.list = function (ch) {
var id = ch ? Epg.map[ch.key] : null;
return (id && Epg.data[id]) || [];
};
/* Huidig en volgend programma */
Epg.nowNext = function (ch, t) {
var l = Epg.list(ch);
t = t || Date.now();
for (var i = 0; i < l.length; i++) {
if (l[i][0] <= t && l[i][1] > t) return { now: l[i], next: l[i + 1] || null };
if (l[i][0] > t) return { now: null, next: l[i] };
}
return { now: null, next: null };
};
})(window.App);
+115
View File
@@ -0,0 +1,115 @@
/* Opstarten, zappen en de afstandsbediening. */
(function (App) {
'use strict';
var $ = App.$, K = App.KEY;
App.state = {
view: 'tv',
cfg: App.store.get('cfg', { type: 'm3u', output: 'm3u8' }),
channels: App.store.get('channels', []),
idx: App.store.get('idx', 0)
};
App.allChannels = null;
App.saveChannels = function () { App.store.set('channels', App.state.channels); };
App.epgUrl = function () {
var c = App.state.cfg;
if (c.epg) return c.epg;
if (c.type === 'xtream' && c.server && c.user) return App.xtreamEpgUrl(c);
return App.store.get('srcEpg', '');
};
App.loadEpg = function (onProgress) {
return App.Epg.load(App.epgUrl(), App.state.channels, onProgress);
};
function epgInBackground() {
if (App.Epg.loading || !App.state.channels.length || !App.epgUrl() || !App.Epg.isStale()) return;
App.loadEpg().then(function (r) {
console.log('gids geladen', r);
if (App.state.view === 'guide') App.Guide.render();
if (App.state.view === 'list') App.List.render();
}).catch(function (e) { console.warn('gids laden mislukt', e); });
}
/* Naar zender idx */
App.tune = function (idx, force) {
var st = App.state, n = st.channels.length;
if (!n) return;
idx = ((idx % n) + n) % n;
if (idx === st.idx && !force && App.Player.current()) { App.OSD.show(); return; }
st.idx = idx;
App.store.set('idx', idx);
App.Player.play(st.channels[idx]);
App.OSD.show();
};
/* Nummer intikken: na 2 seconden naar die zender */
var numBuf = '', numTimer = null;
function digit(d) {
numBuf = (numBuf + d).slice(-4);
var ne = $('numentry');
ne.textContent = numBuf; ne.classList.remove('hidden');
clearTimeout(numTimer);
numTimer = setTimeout(function () {
ne.classList.add('hidden');
var n = parseInt(numBuf, 10); numBuf = '';
if (n >= 1 && n <= App.state.channels.length) App.tune(n - 1);
else App.showMessage('Zender ' + n + ' bestaat niet.', 2000);
}, 2000);
}
var backArmed = 0;
function tvKey(k) {
if (k === K.UP || k === K.CH_UP) App.tune(App.state.idx + 1);
else if (k === K.DOWN || k === K.CH_DOWN) App.tune(App.state.idx - 1);
else if (k === K.OK) App.List.open();
else if (k === K.RED || k === K.GUIDE || k === K.RIGHT) App.Guide.open();
else if (k === K.GREEN || k === K.INFO || k === K.LEFT) { if (App.OSD.visible()) App.OSD.hide(); else App.OSD.show(8000); }
else if (k === K.BLUE) App.Settings.open();
else if (k >= 48 && k <= 57) digit(k - 48);
else if (App.isBack(k)) {
if (App.OSD.visible()) { App.OSD.hide(); return; }
if (Date.now() - backArmed < 3000) { App.Player.stop(); window.close(); return; }
backArmed = Date.now();
App.showMessage('Druk nogmaals op Terug om af te sluiten', 3000);
}
}
document.addEventListener('keydown', function (ev) {
var k = ev.keyCode, v = App.state.view;
var typing = document.activeElement && document.activeElement.tagName === 'INPUT';
// tijdens typen: gewone toetsen aan het invoerveld laten
if (typing && !(App.isBack(k) || k === K.OK || k === K.UP || k === K.DOWN)) return;
if (typing && k === K.BACKSPACE) return;
if (v === 'tv') tvKey(k);
else if (v === 'list') App.List.key(k);
else if (v === 'guide') App.Guide.key(k);
else if (v === 'settings') App.Settings.key(k);
else if (v === 'picker') App.Picker.key(k);
ev.preventDefault();
});
/* App naar de achtergrond: stream stoppen; terug: verder kijken */
document.addEventListener('visibilitychange', function () {
if (document.hidden) App.Player.stop();
else if (App.state.view === 'tv' && App.state.channels.length) App.tune(App.state.idx, true);
});
function boot() {
App.Player.init();
App.Epg.restore();
if (App.state.channels.length) {
App.state.view = 'tv';
App.tune(Math.min(App.state.idx, App.state.channels.length - 1), true);
} else {
App.Settings.open();
}
epgInBackground();
setInterval(epgInBackground, 30 * 60000);
setInterval(function () { if (App.OSD.visible()) $('osd-clock').textContent = App.fmtTime(Date.now()); }, 15000);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
})(window.App);
+98
View File
@@ -0,0 +1,98 @@
/* Afspelen. HLS (.m3u8) eerst via de ingebouwde speler van webOS, met hls.js als terugval.
MPEG-TS via mpegts.js. Bij een fout wordt automatisch de andere methode geprobeerd. */
(function (App) {
'use strict';
var video, hls = null, ts = null, current = null, attempt = 0, stallTimer = null;
function isHls(url) { return /\.m3u8(\?|$)/i.test(url); }
function isTs(url) { return /\.ts(\?|$)/i.test(url) || /\/live\/[^/]+\/[^/]+\/\d+$/.test(url); }
function teardown() {
clearTimeout(stallTimer);
if (hls) { try { hls.destroy(); } catch (e) { /* niets */ } hls = null; }
if (ts) { try { ts.pause(); ts.unload(); ts.detachMediaElement(); ts.destroy(); } catch (e) { /* niets */ } ts = null; }
video.removeAttribute('src');
try { video.load(); } catch (e) { /* niets */ }
}
/* Volgorde van methodes per soort stream */
function methods(url) {
var nativeHls = !!video.canPlayType('application/vnd.apple.mpegurl');
var hlsJs = window.Hls && Hls.isSupported();
var tsJs = window.mpegts && mpegts.getFeatureList().mseLivePlayback;
var list = [];
if (isHls(url)) {
if (nativeHls) list.push('native');
if (hlsJs) list.push('hlsjs');
} else if (isTs(url)) {
if (tsJs) list.push('mpegts');
list.push('native');
} else {
list.push('native');
if (hlsJs) list.push('hlsjs');
if (tsJs) list.push('mpegts');
}
return list;
}
function start(method, url) {
App.Player.method = method;
if (method === 'native') {
video.src = url;
video.play().catch(function () { /* autoplay-weigering negeren; error-event volgt bij echte fouten */ });
} else if (method === 'hlsjs') {
hls = new Hls({ lowLatencyMode: false, liveSyncDurationCount: 3, enableWorker: true });
hls.on(Hls.Events.ERROR, function (ev, data) { if (data.fatal) failed('hls.js: ' + data.details); });
hls.loadSource(url);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () { video.play().catch(function () {}); });
} else if (method === 'mpegts') {
ts = mpegts.createPlayer({ type: 'mpegts', isLive: true, url: url },
{ enableWorker: false, lazyLoad: false, liveBufferLatencyChasing: true, liveBufferLatencyMaxLatency: 6 });
ts.on(mpegts.Events.ERROR, function (type, detail) { failed('mpegts: ' + type + ' ' + detail); });
ts.attachMediaElement(video);
ts.load();
var p = ts.play(); if (p && p.catch) p.catch(function () {});
}
// na 15 s nog geen beeld: volgende methode proberen
clearTimeout(stallTimer);
stallTimer = setTimeout(function () { if (video.readyState < 2) failed('geen beeld na 15 s'); }, 15000);
}
function failed(reason) {
if (!current) return;
console.warn('afspelen mislukt (' + App.Player.method + '): ' + reason);
var list = methods(current.url);
attempt++;
teardown();
if (attempt < list.length) start(list[attempt], current.url);
else {
App.Player.method = null;
App.showMessage('Deze zender speelt niet af.\n' + reason, 6000);
}
}
App.Player = {
method: null,
init: function () {
video = App.$('video');
video.addEventListener('error', function () {
// alleen fouten van de huidige stream tellen (niet van een vorige die net is gestopt)
if (App.Player.method === 'native' && current && video.getAttribute('src') === current.url) {
failed('mediafout ' + (video.error ? video.error.code : '?'));
}
});
video.addEventListener('playing', function () { clearTimeout(stallTimer); App.hideMessage(); });
},
play: function (ch) {
teardown();
current = ch; attempt = 0;
var list = methods(ch.url);
if (!list.length) { App.showMessage('Dit streamformaat wordt niet ondersteund.', 5000); return; }
start(list[0], ch.url);
},
stop: function () { current = null; teardown(); },
current: function () { return current; }
};
})(window.App);
+105
View File
@@ -0,0 +1,105 @@
/* Zenders ophalen: M3U-afspeellijst of Xtream Codes-API. Alleen live-tv, geen films/series. */
(function (App) {
'use strict';
function chKey(c) { return c.tvgId ? 'id:' + c.tvgId.toLowerCase() : 'nm:' + App.normName(c.name) + '|' + (c.group || ''); }
App.chKey = chKey;
/* Zet een M3U-tekst om naar { epgUrl, channels[] } */
App.parseM3U = function (text) {
var lines = text.split(/\r?\n/);
var out = [], epgUrl = '', cur = null, grp = '';
for (var i = 0; i < lines.length; i++) {
var line = lines[i].trim();
if (!line) continue;
if (line.indexOf('#EXTM3U') === 0) {
var m = /(?:x-tvg-url|url-tvg)="([^"]+)"/.exec(line);
if (m) epgUrl = m[1].split(',')[0].trim();
} else if (line.indexOf('#EXTINF') === 0) {
var attrs = {}, re = /([\w-]+)="([^"]*)"/g, a;
while ((a = re.exec(line)) !== null) attrs[a[1].toLowerCase()] = a[2];
var comma = line.lastIndexOf('",');
var name = comma >= 0 ? line.slice(comma + 2) : line.slice(line.indexOf(',') + 1);
cur = {
name: (name || attrs['tvg-name'] || '').trim(),
tvgId: (attrs['tvg-id'] || '').trim(),
logo: attrs['tvg-logo'] || '',
group: attrs['group-title'] || ''
};
} else if (line.indexOf('#EXTGRP:') === 0) {
grp = line.slice(8).trim();
} else if (line.charAt(0) !== '#') {
if (cur) {
cur.url = line;
if (!cur.group) cur.group = grp || 'Overig';
if (!/\/(movie|series)\//i.test(line) && !/\.(mp4|mkv|avi)(\?|$)/i.test(line)) {
cur.key = chKey(cur);
out.push(cur);
}
}
cur = null; grp = '';
}
}
return { epgUrl: epgUrl, channels: dedupe(out) };
};
/* Twee zenders met dezelfde sleutel krijgen een volgnummer, zodat ze apart te kiezen zijn */
function dedupe(list) {
var seen = {};
list.forEach(function (c) {
if (seen[c.key]) { seen[c.key]++; c.key = c.key + '#' + seen[c.key]; } else seen[c.key] = 1;
});
return list;
}
function trimSlash(s) { return String(s || '').trim().replace(/\/+$/, ''); }
App.xtreamEpgUrl = function (cfg) {
return trimSlash(cfg.server) + '/xmltv.php?username=' + encodeURIComponent(cfg.user) +
'&password=' + encodeURIComponent(cfg.pass);
};
/* Xtream Codes: live-categorieën en -zenders via player_api.php (veel kleiner dan de m3u_plus-lijst) */
App.loadXtream = function (cfg) {
var base = trimSlash(cfg.server);
if (!/^https?:\/\//i.test(base)) base = 'http://' + base;
var api = base + '/player_api.php?username=' + encodeURIComponent(cfg.user) + '&password=' + encodeURIComponent(cfg.pass);
var ext = cfg.output === 'ts' ? 'ts' : 'm3u8';
return App.fetchText(api, 30000).then(function (t) {
var info = JSON.parse(t);
if (info && info.user_info && String(info.user_info.auth) === '0') throw new Error('Inloggen geweigerd: controleer gebruikersnaam en wachtwoord.');
return Promise.all([
App.fetchText(api + '&action=get_live_categories', 60000),
App.fetchText(api + '&action=get_live_streams', 120000)
]);
}).then(function (res) {
var cats = {}, list = [];
(JSON.parse(res[0]) || []).forEach(function (c) { cats[c.category_id] = c.category_name; });
(JSON.parse(res[1]) || []).forEach(function (s) {
var c = {
name: String(s.name || '').trim(),
tvgId: String(s.epg_channel_id || '').trim(),
logo: s.stream_icon || '',
group: cats[s.category_id] || 'Overig',
url: base + '/live/' + encodeURIComponent(cfg.user) + '/' + encodeURIComponent(cfg.pass) + '/' + s.stream_id + '.' + ext
};
c.key = 'xt:' + s.stream_id;
list.push(c);
});
return { epgUrl: App.xtreamEpgUrl(cfg), channels: list };
});
};
/* Haal de volledige lijst op volgens de instellingen */
App.loadSource = function (cfg) {
if (cfg.type === 'xtream') {
if (!cfg.server || !cfg.user) return Promise.reject(new Error('Vul server, gebruikersnaam en wachtwoord in.'));
return App.loadXtream(cfg);
}
if (!cfg.m3u) return Promise.reject(new Error('Vul de M3U-URL in.'));
return App.fetchText(cfg.m3u, 120000).then(function (t) {
if (t.indexOf('#EXTINF') < 0) throw new Error('Dit lijkt geen M3U-afspeellijst te zijn.');
return App.parseM3U(t);
});
};
})(window.App);
+83
View File
@@ -0,0 +1,83 @@
/* Hulpfuncties. Bewust ES2017 (geen ?. of ??): de BX draait webOS 5 met Chromium 68. */
var App = window.App || {};
window.App = App;
App.$ = function (id) { return document.getElementById(id); };
App.KEY = {
LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, OK: 13,
BACK: 461, ESC: 27, BACKSPACE: 8,
CH_UP: 33, CH_DOWN: 34,
RED: 403, GREEN: 404, YELLOW: 405, BLUE: 406,
INFO: 457, GUIDE: 458
};
App.isBack = function (k) { return k === App.KEY.BACK || k === App.KEY.ESC || k === App.KEY.BACKSPACE; };
App.pad = function (n) { return (n < 10 ? '0' : '') + n; };
App.fmtTime = function (ms) { var d = new Date(ms); return App.pad(d.getHours()) + ':' + App.pad(d.getMinutes()); };
App.DAYS = ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'];
App.MONTHS = ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'];
App.fmtDay = function (ms) {
var d = new Date(ms);
return App.DAYS[d.getDay()] + ' ' + d.getDate() + ' ' + App.MONTHS[d.getMonth()];
};
App.esc = function (s) {
return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) {
return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c];
});
};
/* XML-entiteiten en CDATA terug naar tekst */
App.xmlText = function (s) {
if (!s) return '';
s = s.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1');
return s.replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g, function (m, e) {
if (e === 'amp') return '&';
if (e === 'lt') return '<';
if (e === 'gt') return '>';
if (e === 'quot') return '"';
if (e === 'apos') return "'";
var code = e.charAt(1) === 'x' ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
try { return String.fromCodePoint(code); } catch (err) { return ''; }
}).trim();
};
/* Namen vergelijken: "NPO 1 HD" == "npo1" */
App.normName = function (s) {
return String(s || '').toLowerCase()
.replace(/\b(hd|fhd|uhd|4k|sd|hevc|h265|backup)\b/g, '')
.replace(/^[a-z]{2,3}\s*[:|]\s*/, '') // landprefix zoals "NL: " of "UK | "
.replace(/[^a-z0-9]/g, '');
};
/* localStorage met vangnet (vol of geblokkeerd) */
App.store = {
get: function (k, def) {
try { var v = localStorage.getItem('iptv.' + k); return v == null ? def : JSON.parse(v); }
catch (e) { return def; }
},
set: function (k, v) {
try { localStorage.setItem('iptv.' + k, JSON.stringify(v)); return true; }
catch (e) { console.warn('opslaan mislukt', k, e); return false; }
},
del: function (k) { try { localStorage.removeItem('iptv.' + k); } catch (e) { /* niets */ } }
};
App.fetchText = function (url, timeoutMs) {
return App.fetchWithTimeout(url, timeoutMs || 60000).then(function (r) {
if (!r.ok) throw new Error('HTTP ' + r.status + ' bij ' + url);
return r.text();
});
};
App.fetchWithTimeout = function (url, timeoutMs) {
var ctrl = typeof AbortController !== 'undefined' ? new AbortController() : null;
var t = setTimeout(function () { if (ctrl) ctrl.abort(); }, timeoutMs || 60000);
return fetch(url, ctrl ? { signal: ctrl.signal } : {}).then(function (r) {
clearTimeout(t); return r;
}, function (e) {
clearTimeout(t);
throw new Error((e && e.name === 'AbortError') ? 'Time-out bij ' + url : 'Kan ' + url + ' niet bereiken (' + e.message + ')');
});
};
+423
View File
@@ -0,0 +1,423 @@
/* Schermen: zenderinfo (OSD), zenderlijst, tv-gids, instellingen en zenders kiezen. */
(function (App) {
'use strict';
var $ = App.$, K = App.KEY;
/* ---------------- meldingen ---------------- */
var msgTimer = null;
App.showMessage = function (text, ms) {
var m = $('message');
m.textContent = text; m.classList.remove('hidden');
clearTimeout(msgTimer);
if (ms) msgTimer = setTimeout(App.hideMessage, ms);
};
App.hideMessage = function () { clearTimeout(msgTimer); $('message').classList.add('hidden'); };
/* ---------------- OSD ---------------- */
var osdTimer = null;
App.OSD = {
visible: function () { return !$('osd').classList.contains('hidden'); },
show: function (ms) {
var st = App.state, ch = st.channels[st.idx];
if (!ch) return;
$('osd-num').textContent = st.idx + 1;
$('osd-name').textContent = ch.name;
var logo = $('osd-logo');
if (ch.logo) { logo.src = ch.logo; logo.classList.remove('hidden'); } else logo.classList.add('hidden');
logo.onerror = function () { logo.classList.add('hidden'); };
$('osd-clock').textContent = App.fmtTime(Date.now());
var nn = App.Epg.nowNext(ch), now = Date.now();
if (nn.now) {
$('osd-now-time').textContent = App.fmtTime(nn.now[0]) + ' – ' + App.fmtTime(nn.now[1]);
$('osd-now-title').textContent = nn.now[2];
$('osd-progress').style.width = Math.min(100, Math.max(0, (now - nn.now[0]) / (nn.now[1] - nn.now[0]) * 100)) + '%';
} else {
$('osd-now-time').textContent = '';
$('osd-now-title').textContent = App.Epg.at ? 'Geen gidsinformatie' : 'Gids wordt geladen…';
$('osd-progress').style.width = '0';
}
$('osd-next-time').textContent = nn.next ? App.fmtTime(nn.next[0]) : '';
$('osd-next-title').textContent = nn.next ? nn.next[2] : '';
$('osd').classList.remove('hidden');
clearTimeout(osdTimer);
osdTimer = setTimeout(App.OSD.hide, ms || 5000);
},
hide: function () { clearTimeout(osdTimer); $('osd').classList.add('hidden'); }
};
/* ---------------- zenderlijst ---------------- */
var ROWS_LIST = 10;
App.List = {
sel: 0,
open: function () { App.OSD.hide(); this.sel = App.state.idx; $('list').classList.remove('hidden'); App.state.view = 'list'; this.render(); },
close: function () { $('list').classList.add('hidden'); App.state.view = 'tv'; },
render: function () {
var chs = App.state.channels, top = Math.max(0, Math.min(this.sel - 4, chs.length - ROWS_LIST)), html = '';
for (var i = top; i < Math.min(chs.length, top + ROWS_LIST); i++) {
var nn = App.Epg.nowNext(chs[i]);
html += '<div class="li' + (i === this.sel ? ' focus' : '') + (i === App.state.idx ? ' playing' : '') + '">' +
'<span class="n">' + (i + 1) + '</span><div class="t"><div>' + App.esc(chs[i].name) + '</div>' +
'<div class="sub">' + (nn.now ? App.fmtTime(nn.now[0]) + ' ' + App.esc(nn.now[2]) : '&nbsp;') + '</div></div></div>';
}
$('list-items').innerHTML = html;
},
key: function (k) {
var n = App.state.channels.length;
if (k === K.UP) this.sel = (this.sel - 1 + n) % n;
else if (k === K.DOWN) this.sel = (this.sel + 1) % n;
else if (k === K.CH_UP) this.sel = Math.max(0, this.sel - ROWS_LIST);
else if (k === K.CH_DOWN) this.sel = Math.min(n - 1, this.sel + ROWS_LIST);
else if (k === K.OK) { this.close(); App.tune(this.sel); return; }
else if (App.isBack(k) || k === K.LEFT) { this.close(); return; }
else if (k === K.RED || k === K.GUIDE) { this.close(); App.Guide.open(); return; }
else if (k === K.BLUE) { this.close(); App.Settings.open(); return; }
this.render();
}
};
/* ---------------- tv-gids ---------------- */
var HALF = 30 * 60000, WIN = 2 * 3600e3, ROWS_GUIDE = 8;
function floorHalf(t) { return Math.floor(t / HALF) * HALF; }
App.Guide = {
row: 0, top: 0, winStart: 0, focusTime: 0,
open: function () {
App.OSD.hide();
this.row = App.state.idx;
this.top = Math.max(0, this.row - 2);
this.winStart = floorHalf(Date.now());
this.focusTime = Date.now();
$('guide').classList.remove('hidden');
App.state.view = 'guide';
this.render();
},
close: function () { $('guide').classList.add('hidden'); App.state.view = 'tv'; },
/* programma's van een zender binnen het venster; lege stukken worden opgevuld */
blocks: function (ch) {
var l = App.Epg.list(ch), ws = this.winStart, we = ws + WIN, out = [];
for (var i = 0; i < l.length; i++) if (l[i][1] > ws && l[i][0] < we) out.push({ s: l[i][0], e: l[i][1], t: l[i][2], d: l[i][3] });
if (!out.length) out.push({ s: ws, e: we, t: 'Geen gidsinformatie', d: '', empty: true });
return out;
},
focused: function () {
var b = this.blocks(App.state.channels[this.row]), ft = this.focusTime;
for (var i = 0; i < b.length; i++) if (b[i].s <= ft && b[i].e > ft) return { list: b, i: i };
for (i = 0; i < b.length; i++) if (b[i].s > ft) return { list: b, i: i };
return { list: b, i: b.length - 1 };
},
key: function (k) {
var n = App.state.channels.length, f, p, minStart = floorHalf(Date.now()) - 2 * HALF, maxStart = Date.now() + 40 * 3600e3;
if (k === K.UP) this.row = Math.max(0, this.row - 1);
else if (k === K.DOWN) this.row = Math.min(n - 1, this.row + 1);
else if (k === K.CH_UP) this.row = Math.max(0, this.row - ROWS_GUIDE);
else if (k === K.CH_DOWN) this.row = Math.min(n - 1, this.row + ROWS_GUIDE);
else if (k === K.RIGHT) {
f = this.focused(); p = f.list[f.i + 1];
if (p && !p.empty) {
this.focusTime = p.s;
if (p.s >= this.winStart + WIN - HALF) this.winStart = Math.min(maxStart, floorHalf(p.s) - HALF);
} else if (this.winStart < maxStart) {
// geen volgend programma in beeld: venster een half uur opschuiven
this.winStart += HALF;
var nxt = this.firstAfter(f.list[f.i].e - 1);
this.focusTime = nxt ? nxt.s : Math.max(this.focusTime, this.winStart);
}
} else if (k === K.LEFT) {
f = this.focused(); p = f.i > 0 ? f.list[f.i - 1] : null;
if (p && !p.empty) {
this.focusTime = Math.max(p.s, this.winStart);
} else if (this.winStart > minStart) {
this.winStart -= HALF;
var prev = this.lastBefore(f.list[f.i].s);
this.focusTime = prev ? Math.max(prev.s, this.winStart) : this.winStart;
}
} else if (k === K.OK) { this.close(); App.tune(this.row); return; }
else if (App.isBack(k) || k === K.RED || k === K.GUIDE) { this.close(); return; }
else if (k === K.BLUE) { this.close(); App.Settings.open(); return; }
if (this.row < this.top) this.top = this.row;
if (this.row >= this.top + ROWS_GUIDE) this.top = this.row - ROWS_GUIDE + 1;
this.render();
},
firstAfter: function (t) {
var l = App.Epg.list(App.state.channels[this.row]);
for (var i = 0; i < l.length; i++) if (l[i][0] > t) return { s: l[i][0] };
return null;
},
lastBefore: function (t) {
var l = App.Epg.list(App.state.channels[this.row]);
for (var i = l.length - 1; i >= 0; i--) if (l[i][0] < t) return { s: l[i][0] };
return null;
},
render: function () {
var chs = App.state.channels, ws = this.winStart, now = Date.now();
var width = 1920 - 100 - 390, px = width / WIN, html = '', i;
$('guide-day').textContent = App.fmtDay(Math.max(ws, now));
var times = '';
for (i = 0; i < 4; i++) times += '<span style="left:' + Math.round(i * HALF * px) + 'px">' + App.fmtTime(ws + i * HALF) + '</span>';
$('guide-times').innerHTML = times;
var f = this.focused(), fp = f.list[f.i];
for (var r = this.top; r < Math.min(chs.length, this.top + ROWS_GUIDE); r++) {
var ch = chs[r], b = r === this.row ? f.list : this.blocks(ch);
html += '<div class="g-row"><div class="g-ch"><span class="n">' + (r + 1) + '</span>' +
(ch.logo ? '<img src="' + App.esc(ch.logo) + '" onerror="this.style.display=\'none\'">' : '') +
'<span class="nm">' + App.esc(ch.name) + '</span></div><div class="g-progs">';
for (i = 0; i < b.length; i++) {
var s = Math.max(b[i].s, ws), e = Math.min(b[i].e, ws + WIN);
var cls = 'g-p' + (b[i].empty ? ' empty' : '') + (b[i].s <= now && b[i].e > now ? ' live' : '') +
(r === this.row && i === f.i ? ' focus' : '');
html += '<div class="' + cls + '" style="left:' + Math.round((s - ws) * px) + 'px;width:' +
Math.max(4, Math.round((e - s) * px)) + 'px">' + App.esc(b[i].t) + '</div>';
}
if (now >= ws && now < ws + WIN) html += '<div class="g-now" style="left:' + Math.round((now - ws) * px) + 'px"></div>';
html += '</div></div>';
}
$('guide-rows').innerHTML = html;
$('gd-title').textContent = fp.t;
var meta = fp.empty ? chs[this.row].name : App.fmtTime(fp.s) + ' – ' + App.fmtTime(fp.e) + ' · ' + chs[this.row].name;
if (!fp.empty && fp.s <= now && fp.e > now) meta += ' · nog ' + Math.round((fp.e - now) / 60000) + ' min';
else if (!fp.empty && fp.s > now && new Date(fp.s).getDate() !== new Date(now).getDate()) meta += ' · ' + App.fmtDay(fp.s);
$('gd-meta').textContent = meta;
$('gd-desc').textContent = fp.d || '';
}
};
/* ---------------- instellingen ---------------- */
App.Settings = {
idx: 0,
open: function () {
App.OSD.hide();
var c = App.state.cfg;
$('f-m3u').value = c.m3u || ''; $('f-server').value = c.server || '';
$('f-user').value = c.user || ''; $('f-pass').value = c.pass || ''; $('f-epg').value = c.epg || '';
this.applyType();
$('settings').classList.remove('hidden');
App.state.view = 'settings';
this.idx = 0; this.render();
this.status(App.state.channels.length ? App.state.channels.length + ' zenders gekozen.' + this.epgInfo() : 'Vul je IPTV-gegevens in en kies "Zenders laden en kiezen".');
},
close: function () {
if (document.activeElement && document.activeElement.blur) document.activeElement.blur();
$('settings').classList.add('hidden');
},
epgInfo: function () {
if (!App.Epg.at) return '\nGids: nog niet geladen.';
return '\nGids: bijgewerkt om ' + App.fmtTime(App.Epg.at) + ', ' + Object.keys(App.Epg.map).length + ' van de ' + App.state.channels.length + ' zenders met gids.';
},
status: function (t, err) { var s = $('settings-status'); s.textContent = t; s.className = 'status' + (err ? ' err' : ''); },
applyType: function () {
var c = App.state.cfg, x = c.type === 'xtream';
Array.prototype.forEach.call(document.querySelectorAll('.only-m3u'), function (e) { e.classList.toggle('hidden', x); });
Array.prototype.forEach.call(document.querySelectorAll('.only-xtream'), function (e) { e.classList.toggle('hidden', !x); });
Array.prototype.forEach.call($('src-type').children, function (e) { e.classList.toggle('on', e.getAttribute('data-v') === (c.type || 'm3u')); });
Array.prototype.forEach.call($('f-output').children, function (e) { e.classList.toggle('on', e.getAttribute('data-v') === (c.output || 'm3u8')); });
},
items: function () {
return Array.prototype.filter.call(document.querySelectorAll('#settings [data-nav]'), function (e) { return e.offsetParent !== null; });
},
render: function () {
var it = this.items();
this.idx = Math.max(0, Math.min(this.idx, it.length - 1));
it.forEach(function (e, i) { e.classList.toggle('focus', i === this.idx); }, this);
},
readFields: function () {
var c = App.state.cfg;
c.m3u = $('f-m3u').value.trim(); c.server = $('f-server').value.trim();
c.user = $('f-user').value.trim(); c.pass = $('f-pass').value; c.epg = $('f-epg').value.trim();
App.store.set('cfg', c);
},
key: function (k) {
var it = this.items(), cur = it[this.idx], ae = document.activeElement;
if (ae && ae.tagName === 'INPUT' && ae.closest('#settings')) {
// aan het typen: alleen Terug, OK, omhoog/omlaag onderscheppen
if (App.isBack(k) || k === K.OK) { ae.blur(); this.readFields(); return; }
if (k === K.UP || k === K.DOWN) { ae.blur(); this.readFields(); } else return;
}
var isBtn = cur && cur.tagName === 'BUTTON';
if (k === K.DOWN) {
if (isBtn) return;
this.idx++;
} else if (k === K.UP) {
if (isBtn) { var firstBtn = it.indexOf($('b-load')); this.idx = firstBtn - 1; }
else this.idx--;
} else if (k === K.LEFT || k === K.RIGHT) {
if (isBtn) this.idx += (k === K.RIGHT ? 1 : -1);
else if (cur && cur.classList.contains('toggle')) this.toggle(cur);
if (it[this.idx] && it[this.idx].tagName !== 'BUTTON' && isBtn) this.idx -= (k === K.RIGHT ? 1 : -1);
} else if (k === K.OK) {
if (!cur) return;
if (cur.tagName === 'INPUT') { cur.focus(); return; }
if (cur.classList.contains('toggle')) { this.toggle(cur); return; }
if (cur.id === 'b-load') return this.loadChannels();
if (cur.id === 'b-epg') return this.refreshEpg();
if (cur.id === 'b-back') return this.toTv();
} else if (App.isBack(k)) {
return this.toTv();
}
this.render();
},
toggle: function (el) {
var c = App.state.cfg;
if (el.id === 'src-type') c.type = c.type === 'xtream' ? 'm3u' : 'xtream';
if (el.id === 'f-output') c.output = c.output === 'ts' ? 'm3u8' : 'ts';
App.store.set('cfg', c);
this.applyType(); this.render();
},
toTv: function () {
this.readFields();
if (!App.state.channels.length) { this.status('Kies eerst zenders met "Zenders laden en kiezen".', true); return; }
this.close();
App.state.view = 'tv';
App.tune(Math.min(App.state.idx, App.state.channels.length - 1), true);
},
loadChannels: function () {
var self = this;
this.readFields();
this.status('Zenders ophalen…');
App.loadSource(App.state.cfg).then(function (res) {
App.allChannels = res.channels;
App.store.set('srcEpg', res.epgUrl || '');
// gekozen zenders bijwerken met de nieuwste stream-URL en logo
var byKey = {};
res.channels.forEach(function (c) { byKey[c.key] = c; });
App.state.channels.forEach(function (c) { var n = byKey[c.key]; if (n) { c.url = n.url; c.logo = n.logo; c.tvgId = n.tvgId; } });
App.saveChannels();
self.status(res.channels.length + ' live-zenders gevonden.');
self.close();
App.Picker.open();
}).catch(function (e) { self.status('Ophalen mislukt: ' + e.message, true); });
},
refreshEpg: function () {
var self = this;
this.readFields();
if (!App.state.channels.length) { this.status('Kies eerst zenders, dan kan de gids geladen worden.', true); return; }
this.status('Gids laden…');
App.loadEpg(function (bytes, kept) {
self.status('Gids laden… ' + (bytes / 1048576).toFixed(1) + ' MB gelezen, ' + kept + ' programma\'s bewaard');
}).then(function (r) {
self.status('Gids geladen: ' + r.programmes + ' programma\'s, ' + r.matched + ' van de ' + r.total + ' zenders gevonden in de gids.');
}).catch(function (e) { self.status('Gids laden mislukt: ' + e.message, true); });
}
};
/* ---------------- zenders kiezen ---------------- */
var ROWS_PK = 11;
App.Picker = {
col: 'groups', gi: 0, ci: 0, groups: [], chans: [], query: '',
open: function () {
this.col = 'groups'; this.gi = 0; this.ci = 0; this.query = '';
$('pk-search').value = '';
this.buildGroups();
$('picker').classList.remove('hidden');
App.state.view = 'picker';
var self = this;
$('pk-search').oninput = function () { self.query = this.value.trim().toLowerCase(); self.ci = 0; self.filter(); self.render(); };
this.filter(); this.render();
},
close: function () {
$('pk-search').blur();
$('picker').classList.add('hidden');
App.saveChannels();
App.Settings.open();
App.Settings.status(App.state.channels.length + ' zenders gekozen. De gids wordt nu geladen…');
App.Settings.refreshEpg();
},
buildGroups: function () {
var counts = {}, order = [];
(App.allChannels || []).forEach(function (c) {
if (!counts[c.group]) { counts[c.group] = 0; order.push(c.group); }
counts[c.group]++;
});
this.groups = [{ name: '★ Mijn zenders', id: 'sel' }, { name: 'Alle zenders', id: 'all', n: (App.allChannels || []).length }]
.concat(order.map(function (g) { return { name: g, id: 'g', n: counts[g] }; }));
},
isSel: function (key) {
var l = App.state.channels;
for (var i = 0; i < l.length; i++) if (l[i].key === key) return i;
return -1;
},
filter: function () {
var g = this.groups[this.gi], q = this.query, all = App.allChannels || [];
var list = g.id === 'sel' ? App.state.channels.slice() : (g.id === 'all' || q ? all : all.filter(function (c) { return c.group === g.name; }));
if (q) list = list.filter(function (c) { return c.name.toLowerCase().indexOf(q) >= 0; });
this.chans = list;
this.ci = Math.max(0, Math.min(this.ci, list.length - 1));
},
toggle: function (c) {
var i = this.isSel(c.key);
if (i >= 0) App.state.channels.splice(i, 1);
else App.state.channels.push({ key: c.key, name: c.name, url: c.url, logo: c.logo, group: c.group, tvgId: c.tvgId });
},
key: function (k) {
var ae = document.activeElement;
if (ae === $('pk-search')) {
if (App.isBack(k) || k === K.OK || k === K.DOWN) { ae.blur(); this.col = 'chans'; this.render(); }
return;
}
if (this.col === 'search') {
if (k === K.OK) { $('pk-search').focus(); return; }
if (k === K.DOWN) this.col = 'groups';
else if (App.isBack(k)) return this.close();
this.render(); return;
}
var g = this.groups[this.gi];
if (this.col === 'groups') {
if (k === K.UP) { if (this.gi === 0) this.col = 'search'; else { this.gi--; this.ci = 0; this.filter(); } }
else if (k === K.DOWN) { if (this.gi < this.groups.length - 1) { this.gi++; this.ci = 0; this.filter(); } }
else if (k === K.RIGHT || k === K.OK) { if (this.chans.length) this.col = 'chans'; }
else if (k === K.CH_UP) { this.gi = Math.max(0, this.gi - ROWS_PK); this.ci = 0; this.filter(); }
else if (k === K.CH_DOWN) { this.gi = Math.min(this.groups.length - 1, this.gi + ROWS_PK); this.ci = 0; this.filter(); }
else if (App.isBack(k)) return this.close();
} else {
var c = this.chans[this.ci];
if (k === K.UP) { if (this.ci === 0) this.col = 'search'; else this.ci--; }
else if (k === K.DOWN) this.ci = Math.min(this.chans.length - 1, this.ci + 1);
else if (k === K.CH_UP) this.ci = Math.max(0, this.ci - ROWS_PK);
else if (k === K.CH_DOWN) this.ci = Math.min(this.chans.length - 1, this.ci + ROWS_PK);
else if (k === K.LEFT) this.col = 'groups';
else if (k === K.OK && c) { this.toggle(c); if (g.id === 'sel') this.filter(); }
else if ((k === K.YELLOW || k === K.BLUE) && g.id === 'sel' && !this.query && c) {
// volgorde aanpassen in "Mijn zenders"
var l = App.state.channels, to = this.ci + (k === K.YELLOW ? -1 : 1);
if (to >= 0 && to < l.length) { var tmp = l[to]; l[to] = l[this.ci]; l[this.ci] = tmp; this.ci = to; this.filter(); }
}
else if (App.isBack(k)) return this.close();
}
this.render();
},
render: function () {
var self = this, html = '', i, top;
$('pk-count').textContent = '(' + App.state.channels.length + ' gekozen)';
$('pk-search').classList.toggle('focus', this.col === 'search');
this.groups[0].n = App.state.channels.length;
top = Math.max(0, Math.min(this.gi - 5, this.groups.length - ROWS_PK));
for (i = top; i < Math.min(this.groups.length, top + ROWS_PK); i++) {
var g = this.groups[i];
html += '<div class="pk-item' + (i === this.gi ? ' focus' : '') + '"><span class="nm">' + App.esc(g.name) + '</span><span class="gc">' + (g.n || 0) + '</span></div>';
}
$('pk-groups').innerHTML = html;
$('pk-groups').classList.toggle('active', this.col === 'groups');
html = '';
top = Math.max(0, Math.min(this.ci - 5, this.chans.length - ROWS_PK));
var sel = this.groups[this.gi].id === 'sel';
for (i = top; i < Math.min(this.chans.length, top + ROWS_PK); i++) {
var c = this.chans[i], on = self.isSel(c.key) >= 0;
html += '<div class="pk-item' + (on ? ' sel' : '') + (i === this.ci && this.col === 'chans' ? ' focus' : '') + '">' +
'<span class="box">' + (sel ? (i + 1) : (on ? '☑' : '☐')) + '</span><span class="nm">' + App.esc(c.name) + '</span>' +
'<span class="gc">' + App.esc(this.query || this.groups[this.gi].id !== 'g' ? c.group : '') + '</span></div>';
}
if (!this.chans.length) html = '<div class="pk-item"><span class="nm">' + (sel ? 'Nog geen zenders gekozen. Kies links een groep.' : 'Geen zenders gevonden.') + '</span></div>';
$('pk-chans').innerHTML = html;
$('pk-chans').classList.toggle('active', this.col === 'chans');
$('pk-hint').textContent = sel
? 'OK verwijderen · Geel omhoog · Blauw omlaag · ▲ bovenaan = zoeken · Terug klaar'
: 'OK aan/uit · ◀ ▶ kolom · CH+/− pagina · ▲ bovenaan = zoeken · Terug klaar';
}
};
})(window.App);
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

+28
View File
@@ -0,0 +1,28 @@
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
That work is also covered by the Apache 2 License, following copyright:
Copyright (c) 2013-2015 Brightcove
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+21
View File
@@ -0,0 +1,21 @@
(The MIT License)
Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+2
View File
@@ -0,0 +1,2 @@
!function e(t){var r,i;r=this,i=function(){"use strict";function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function i(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){var r,n,s;r=e,n=t,s=i[t],(n=a(n))in r?Object.defineProperty(r,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[n]=s})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,a(i.key),i)}}function s(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},o.apply(this,arguments)}function l(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function h(e,t,r){return h=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,r){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return r&&d(a,r.prototype),a},h.apply(null,arguments)}function f(e){var t="function"==typeof Map?new Map:void 0;return f=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return h(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),d(r,e)},f(e)}function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var v={exports:{}};!function(e,t){var r,i,a,n,s;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var a=s.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");return a.path=s.normalizePath(a.path),s.buildURLFromParts(a)}var n=s.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=s.normalizePath(n.path),s.buildURLFromParts(n)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=i.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(u.netLoc=o.netLoc,"/"!==n.path[0]))if(n.path){var d=o.path,h=d.substring(0,d.lastIndexOf("/")+1)+n.path;u.path=s.normalizePath(h)}else u.path=o.path,n.params||(u.params=o.params,n.query||(u.query=o.query));return null===u.path&&(u.path=r.alwaysNormalize?s.normalizePath(n.path):n.path),s.buildURLFromParts(u)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s}(v);var g=v.exports,m=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},p=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=y},y=Number.MAX_SAFE_INTEGER||9007199254740991,E=function(e){return e.MEDIA_ATTACHING="hlsMediaLine truncated
//# sourceMappingURL=hls.light.min.js.map
+9
View File
@@ -0,0 +1,9 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mpegts=t():e.mpegts=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(n,a,function(t){return e[t]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=14)}([function(e,t,i){"use strict";var n=i(6),a=i.n(n),r=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&(console.info?console.info(n):console.log(n))},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&(console.warn?console.warn(n):console.log(n))},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",n),e.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",n),e.ENABLE_VERBOSE&&console.log(n)},e}();r.GLOBAL_TAG="mpegts.js",r.FORCE_GLOBAL_TAG=!1,r.ENABLE_ERROR=!0,r.ENABLE_INFO=!0,r.ENABLE_WARN=!0,r.ENABLE_DEBUG=!0,r.ENABLE_VERBOSE=!0,r.ENABLE_CALLBACK=!1,r.emitter=new a.a,t.a=r},function(e,t,i){"use strict";t.a={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},function(e,t,i){"use strict";i.d(t,"c",(function(){return a})),i.d(t,"b",(function(){return r})),i.d(t,"a",(function(){return s}));var n=i(3),a={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},r={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},s=function(){function e(e){this._type=e||"undefined",this._status=a.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=a.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===a.kConnecting||this._status===a.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:fuLine truncated
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/var n;n=function(){"use strict";function e(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=0,r=void 0,s=void 0,o=function(e,t){f[a]=e,f[a+1]=t,2===(a+=2)&&(s?s(p):b())},d="undefined"!=typeof window?window:void 0,_=d||{},h=_.MutationObserver||_.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),u="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function l(){var e=setTimeout;return function(){return e(p,1)}}var f=new Array(1e3);function p(){for(var e=0;e<a;e+=2)(0,f[e])(f[e+1]),f[e]=void 0,f[e+1]=void 0;a=0}var m,g,v,y,b=void 0;function S(e,t){var i=this,n=new this.constructor(R);void 0===n[A]&&P(n);var a=i._state;if(a){var r=arguments[a-1];o((function(){return I(a,n,r,i._result)}))}else C(i,n,e,t);return n}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(R);return L(t,e),t}c?b=function(){return t.nextTick(p)}:h?(g=0,v=new h(p),y=document.createTextNode(""),v.observe(y,{characterData:!0}),b=function(){y.data=g=++g%2}):u?((m=new MessageChannel).port1.onmessage=p,b=function(){return m.port2.postMessage(0)}):b=void 0===d?function(){try{var e=Function("return this")().require("vertx");return void 0!==(r=e.runOnLoop||e.runOnContext)?function(){r(p)}:l()}catch(e){return l()}}():l();var A=Math.random().toString(36).substring(2);function R(){}function T(t,i,n){i.constructor===t.constructor&&n===S&&i.constructor.resolve===E?function(e,t){1===t._state?k(e,t._result):2===t._state?D(e,t._result):C(t,void 0,(function(t){return L(e,t)}),(function(t){return D(e,t)}))}(t,i):void 0===n?k(t,i):e(n)?function(e,t,i){o((function(e){var n=!1,a=function(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}(i,t,(function(i){n||(n=!0,t!==i?L(e,i):k(e,i))}),(function(t){n||(n=!0,D(e,t))}),e._label);!n&&a&&(n=!0,D(e,a))}),e)}(t,i,n):k(t,i)}function L(e,t){if(e===t)D(e,new TypeError("You cannot resolve a promise with itself"));else if(a=typeof(n=t),null===n||"object"!==a&&"function"!==a)k(e,t);else{var i=void 0;try{i=t.then}catch(t){return void D(e,t)}T(e,t,i)}var n,a}function w(e){e._onerror&&e._onerror(e._result),B(e)}function k(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&o(B,e))}function D(e,t){void 0===e._state&&(e._state=2,e._result=t,o(w,e))}function C(e,t,i,n){var a=e._subscribers,r=a.length;e._onerror=null,a[r]=t,a[r+1]=i,a[r+2]=n,0===r&&e._state&&o(B,e)}function B(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,a=void 0,r=e._result,s=0;s<t.length;s+=3)n=t[s],a=t[s+i],n?I(i,n,a,r):a(r);e._subscribers.length=0}}function I(t,i,n,a){var r=e(n),s=void 0,o=void 0,d=!0;if(r){try{s=n(a)}catch(e){d=!1,o=e}if(i===s)return void D(i,new TypeError("A promises callback cannot return that same promise."))}else s=a;void 0!==i._state||(r&&d?L(i,s):!1===d?D(i,o):1===t?k(i,s):2===t&&D(i,s))}var O=0;function P(e){e[A]=O++,e._state=void 0,e._result=void 0,e._subscribers=[]}var M=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(R),this.promise[A]||P(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&k(this.promise,this._result))):D(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===E){var a=void 0,r=void 0,s=!1;try{a=e.then}catch(e){s=!0,r=e}if(a===S&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof a)this._remaining--,this._result[t]=e;else if(i===x){var o=new i(R);s?D(o,r):T(o,e,a),this._willSettleAt(o,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,i){var n=this.promise;void 0===n._state&&(this._remaining--,2===e?D(n,i):this._result[t]=i),0===this._remaining&&k(n,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;C(e,void 0,(function(e){return i._settledAt(1,t,e)}),(function(e){return i._settledAt(2,t,e)}))},e}(),x=function(){function t(e){this[A]=O++,this._result=this._state=void 0,this._subscribers=[],R!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){L(e,t)}),(function(t){D(e,t)}))}catch(t){D(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var i=this.constructor;returLine truncated
//# sourceMappingURL=mpegts.js.map
+2
View File
@@ -0,0 +1,2 @@
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(this,(function(e){"use strict";var t=function(e,t,i,n){for(var a=65535&e|0,r=e>>>16&65535|0,o=0;0!==i;){i-=o=i>2e3?2e3:i;do{r=r+(a=a+t[n++]|0)|0}while(--o);a%=65521,r%=65521}return a|r<<16|0},i=new Uint32Array(function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}()),n=function(e,t,n,a){var r=i,o=a+n;e^=-1;for(var s=a;s<o;s++)e=e>>>8^r[255&(e^t[s])];return-1^e},a=16209,r=function(e,t){var i,n,r,o,s,l,f,d,h,c,u,w,b,m,k,_,v,g,p,y,x,E,R,A,Z=e.state;i=e.next_in,R=e.input,n=i+(e.avail_in-5),r=e.next_out,A=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),l=Z.dmax,f=Z.wsize,d=Z.whave,h=Z.wnext,c=Z.window,u=Z.hold,w=Z.bits,b=Z.lencode,m=Z.distcode,k=(1<<Z.lenbits)-1,_=(1<<Z.distbits)-1;e:do{w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),v=b[u&k];t:for(;;){if(u>>>=g=v>>>24,w-=g,0===(g=v>>>16&255))A[r++]=65535&v;else{if(!(16&g)){if(0==(64&g)){v=b[(65535&v)+(u&(1<<g)-1)];continue t}if(32&g){Z.mode=16191;break e}e.msg="invalid literal/length code",Z.mode=a;break e}p=65535&v,(g&=15)&&(w<g&&(u+=R[i++]<<w,w+=8),p+=u&(1<<g)-1,u>>>=g,w-=g),w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),v=m[u&_];i:for(;;){if(u>>>=g=v>>>24,w-=g,!(16&(g=v>>>16&255))){if(0==(64&g)){v=m[(65535&v)+(u&(1<<g)-1)];continue i}e.msg="invalid distance code",Z.mode=a;break e}if(y=65535&v,w<(g&=15)&&(u+=R[i++]<<w,(w+=8)<g&&(u+=R[i++]<<w,w+=8)),(y+=u&(1<<g)-1)>l){e.msg="invalid distance too far back",Z.mode=a;break e}if(u>>>=g,w-=g,y>(g=r-o)){if((g=y-g)>d&&Z.sane){e.msg="invalid distance too far back",Z.mode=a;break e}if(x=0,E=c,0===h){if(x+=f-g,g<p){p-=g;do{A[r++]=c[x++]}while(--g);x=r-y,E=A}}else if(h<g){if(x+=f+h-g,(g-=h)<p){p-=g;do{A[r++]=c[x++]}while(--g);if(x=0,h<p){p-=g=h;do{A[r++]=c[x++]}while(--g);x=r-y,E=A}}}else if(x+=h-g,g<p){p-=g;do{A[r++]=c[x++]}while(--g);x=r-y,E=A}for(;p>2;)A[r++]=E[x++],A[r++]=E[x++],A[r++]=E[x++],p-=3;p&&(A[r++]=E[x++],p>1&&(A[r++]=E[x++]))}else{x=r-y;do{A[r++]=A[x++],A[r++]=A[x++],A[r++]=A[x++],p-=3}while(p>2);p&&(A[r++]=A[x++],p>1&&(A[r++]=A[x++]))}break}}break}}while(i<n&&r<s);i-=p=w>>3,u&=(1<<(w-=p<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=r<s?s-r+257:257-(r-s),Z.hold=u,Z.bits=w},o=15,s=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),l=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),f=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),d=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),h=function(e,t,i,n,a,r,h,c){var u,w,b,m,k,_,v,g,p,y=c.bits,x=0,E=0,R=0,A=0,Z=0,S=0,T=0,O=0,U=0,D=0,I=null,B=new Uint16Array(16),N=new Uint16Array(16),C=null;for(x=0;x<=o;x++)B[x]=0;for(E=0;E<n;E++)B[t[i+E]]++;for(Z=y,A=o;A>=1&&0===B[A];A--);if(Z>A&&(Z=A),0===A)return a[r++]=20971520,a[r++]=20971520,c.bits=1,0;for(R=1;R<A&&0===B[R];R++);for(Z<R&&(Z=R),O=1,x=1;x<=o;x++)if(O<<=1,(O-=B[x])<0)return-1;if(O>0&&(0===e||1!==A))return-1;for(N[1]=0,x=1;x<o;x++)N[x+1]=N[x]+B[x];for(E=0;E<n;E++)0!==t[i+E]&&(h[N[t[i+E]]++]=E);if(0===e?(I=C=h,_=20):1===e?(I=s,C=l,_=257):(I=f,C=d,_=0),D=0,E=0,x=R,k=r,S=Z,T=0,b=-1,m=(U=1<<Z)-1,1===e&&U>852||2===e&&U>592)return 1;for(;;){v=x-T,h[E]+1<_?(g=0,p=h[E]):h[E]>=_?(g=C[h[E]-_],p=I[h[E]-_]):(g=96,p=0),u=1<<x-T,R=w=1<<S;do{a[k+(D>>T)+(w-=u)]=v<<24|g<<16|p|0}while(0!==w);for(u=1<<x-1;D&u;)u>>=1;if(0!==u?(D&=u-1,D+=u):D=0,E++,0==--B[x]){if(x===A)break;x=t[i+h[E]]}if(x>Z&&(D&m)!==b){for(0===T&&(T=Z),k+=R,O=1<<(S=x-T);S+T<A&&!((O-=B[S+T])<=0);)S++,O<<=1;if(U+=1<<S,1===e&&U>852||2===e&&U>592)return 1;a[b=D&m]=Z<<24|S<<16|k-r|0}}return 0!==D&&(a[k+D]=x-T<<24|64<<16|0),c.bits=Z,0},c={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},u=c.Z_FINISH,w=c.Z_BLOCK,b=c.Z_TREES,m=c.Z_OK,k=c.Z_STREAM_END,_=c.Z_NEED_DICT,v=c.Z_STREAM_ERROR,g=c.Z_DATA_ERROR,p=c.Z_MEM_ERROR,y=c.Z_BUF_ERROR,x=c.Z_DEFLATED,E=16180,R=16190,A=16191,Z=16192,S=16194,T=16199,O=16200,U=16206,D=16209,I=function(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)};function B(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=Line truncated