stremiok 2.3.6 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +6 -3
- package/config.xml +2 -1
- package/css/style.css +1 -0
- package/index.html +43 -43
- package/js/lang/ar.js +61 -3
- package/js/lang/ca.js +2030 -0
- package/js/lang/de.js +61 -3
- package/js/lang/es.js +61 -3
- package/js/lang/fi.js +61 -3
- package/js/lang/fr.js +61 -3
- package/js/lang/he.js +61 -3
- package/js/lang/hi.js +61 -3
- package/js/lang/it.js +61 -3
- package/js/lang/ja.js +61 -3
- package/js/lang/ko.js +61 -3
- package/js/lang/languages.js +1 -0
- package/js/lang/pl.js +61 -3
- package/js/lang/pt-BR.js +61 -3
- package/js/lang/ru.js +61 -3
- package/js/lang/tr.js +61 -3
- package/js/lang/zh-CN.js +61 -3
- package/js/local.js +63 -18
- package/js/netfolders.js +76 -8
- package/js/player-audio.js +16 -8
- package/js/player-controls.js +68 -0
- package/js/player-core.js +98 -8
- package/js/player-lang.js +16 -0
- package/js/player-store.js +7 -2
- package/js/player-subs.js +267 -17
- package/js/plugins.js +43 -7
- package/js/stremio.js +54 -6
- package/js/view-core.js +2 -2
- package/js/view-detail.js +10 -3
- package/js/view-settings.js +167 -15
- package/js/ytplay.js +39 -6
- package/package.json +1 -1
- package/service/index.js +1660 -57
- package/tizenbrew.html +1 -1
package/js/netfolders.js
CHANGED
|
@@ -16,7 +16,17 @@ var NetFolders = (function () {
|
|
|
16
16
|
function onChange(fn) { _listeners.push(fn); }
|
|
17
17
|
function emit() { _listeners.slice().forEach(function (fn) { try { fn(); } catch (e) {} }); }
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// A folder: WebDAV (http(s)://…/, the kind unsaid) or a Windows / NAS share (kind 'smb',
|
|
20
|
+
// smb://host/share/: through StremioK's service, its files played through it too).
|
|
21
|
+
// Or a DLNA media server (kind 'dlna': known by dlna://<its id>/, asked at its control link,
|
|
22
|
+
// f.control; no sign-in).
|
|
23
|
+
function isSmb(f) { return !!f && f.kind === 'smb'; }
|
|
24
|
+
function isDlna(f) { return !!f && f.kind === 'dlna'; }
|
|
25
|
+
function valid(f) {
|
|
26
|
+
if (!f || typeof f.id !== 'string' || !/^[a-z0-9]{4,16}$/.test(f.id) || typeof f.url !== 'string') { return false; }
|
|
27
|
+
if (isDlna(f)) { return /^dlna:\/\/[a-z0-9]{4,40}\/$/.test(f.url) && typeof f.control === 'string' && /^https?:\/\/[^\s@]+$/i.test(f.control); }
|
|
28
|
+
return isSmb(f) ? /^smb:\/\/[^\/\s@]+\/[^\/\\?#]+\/$/i.test(f.url) : /^https?:\/\/[^\s@]+\/$/i.test(f.url);
|
|
29
|
+
}
|
|
20
30
|
function all() { return U.listOf(U.store.get(KEY, []), MAX, valid); }
|
|
21
31
|
function save(list) { U.store.set(KEY, list); emit(); }
|
|
22
32
|
function folders() { return all().filter(function (f) { return !f.off; }); }
|
|
@@ -36,6 +46,8 @@ var NetFolders = (function () {
|
|
|
36
46
|
function baseOf(v) { return ('' + v).trim().replace(/\/*$/, '/'); }
|
|
37
47
|
// A name to show: its last folder, and its server ("media on 192.168.0.50").
|
|
38
48
|
function nameOf(url) {
|
|
49
|
+
var sm = /^smb:\/\/([^\/:]+)(?::\d+)?\/([^\/]+)\/$/i.exec(url || '');
|
|
50
|
+
if (sm) { return U.t('{folder} on {host}', { folder: sm[2], host: sm[1] }); }
|
|
39
51
|
var m = /^https?:\/\/([^\/:]+)(?::\d+)?(\/.*)?$/i.exec(url) || [], segs = (m[2] || '/').split('/').filter(Boolean), last = segs.length ? segs[segs.length - 1] : '';
|
|
40
52
|
try { last = decodeURIComponent(last); } catch (e) {}
|
|
41
53
|
return last ? U.t('{folder} on {host}', { folder: last, host: m[1] || url }) : (m[1] || url);
|
|
@@ -49,7 +61,7 @@ var NetFolders = (function () {
|
|
|
49
61
|
if (f.cert) { h['X-Dav-Cert'] = f.cert; }
|
|
50
62
|
return h;
|
|
51
63
|
}
|
|
52
|
-
function query(f, rel) { return '?u=' + encodeURIComponent(f.url) + (rel != null ? '&p=' + encodeURIComponent(rel) : ''); }
|
|
64
|
+
function query(f, rel) { return '?u=' + encodeURIComponent(isDlna(f) ? 'dlna:' + f.control : f.url) + (rel != null ? '&p=' + encodeURIComponent(rel) : ''); }
|
|
53
65
|
var WHY = {
|
|
54
66
|
auth: U.t('It refused the user name or password'),
|
|
55
67
|
untrusted: U.t('Its certificate isn’t from a known authority'),
|
|
@@ -58,13 +70,15 @@ var NetFolders = (function () {
|
|
|
58
70
|
missing: U.t('No such folder there'),
|
|
59
71
|
elsewhere: U.t('It sent StremioK to another address (not followed)'),
|
|
60
72
|
toolarge: U.t('Its answer was too large'),
|
|
61
|
-
busy: U.t('Another folder is being indexed: try again when it’s done')
|
|
73
|
+
busy: U.t('Another folder is being indexed: try again when it’s done'),
|
|
74
|
+
smb3: U.t('It only speaks SMB 3 (StremioK speaks SMB 2)'),
|
|
75
|
+
other: U.t('It failed')
|
|
62
76
|
};
|
|
63
77
|
// The service's answer, or what went wrong: an Error with why (and, untrusted, the
|
|
64
78
|
// certificate: cert, fp, name, until).
|
|
65
79
|
function ask(f, path, rel, timeout, max, cancel) {
|
|
66
80
|
if (typeof LocalMedia === 'undefined' || !LocalMedia.askService) { return Promise.reject(new Error(U.t('no StremioK service here'))); }
|
|
67
|
-
return LocalMedia.askService('/dav/' + path + query(f, rel), timeout, max, cancel, headers(f)).then(function (r) {
|
|
81
|
+
return LocalMedia.askService((isDlna(f) ? '/dlna/' : isSmb(f) ? '/smb/' : '/dav/') + path + query(f, rel), timeout, max, cancel, headers(f)).then(function (r) {
|
|
68
82
|
if (!r || typeof r !== 'object') { throw new Error(U.t('No answer from StremioK’s service')); }
|
|
69
83
|
if (r.why) {
|
|
70
84
|
var e = new Error((WHY[r.why] || U.t('It failed')) + (r.message && r.why !== 'auth' && r.why !== 'busy' ? ' (' + r.message + ')' : ''));
|
|
@@ -85,6 +99,7 @@ var NetFolders = (function () {
|
|
|
85
99
|
function list(f, rel) {
|
|
86
100
|
rel = ('' + (rel || '')).replace(/^\/+|\/+$/g, '');
|
|
87
101
|
return ask(f, 'list', rel, 30000, 4 * 1048576).then(function (r) {
|
|
102
|
+
noteDigest(f, !!r.digest);
|
|
88
103
|
return { entries: U.listOf(r.entries, 3000, function (x) { return x && typeof x.name === 'string' && x.name && x.name.indexOf('/') === -1; }).map(function (x) { return entryOf(f, rel, x); }) };
|
|
89
104
|
});
|
|
90
105
|
}
|
|
@@ -94,7 +109,52 @@ var NetFolders = (function () {
|
|
|
94
109
|
return { files: U.listOf(r.files, 20000, function (x) { return x && typeof x.p === 'string'; }), truncated: !!r.truncated };
|
|
95
110
|
});
|
|
96
111
|
}
|
|
97
|
-
function subPath(f, rel) { return '/dav/sub' + query(f, rel); }
|
|
112
|
+
function subPath(f, rel) { return (isDlna(f) ? '/dlna/sub' : isSmb(f) ? '/smb/sub' : '/dav/sub') + query(f, rel); }
|
|
113
|
+
// A folder whose server signs in with Digest (the service found it out): kept with it, so its
|
|
114
|
+
// files play through the service (a ticket: the TV's player sends Basic only).
|
|
115
|
+
function noteDigest(f, digest) {
|
|
116
|
+
if (!f || f.id === 'probe' || !!f.digest === digest) { if (f && f.id === 'probe') { f.digest = digest; } return; }
|
|
117
|
+
save(all().map(function (x) { if (x.id !== f.id) { return x; } var g = Object.assign({}, x); if (digest) { g.digest = true; } else { delete g.digest; } return g; }));
|
|
118
|
+
}
|
|
119
|
+
// The service's ticket for a folder whose files play through it (Digest), asked as a file
|
|
120
|
+
// starts (prepare) and kept TICKET_MS (the service keeps it hours, while used).
|
|
121
|
+
var TICKET_MS = 3600000, _tickets = {};
|
|
122
|
+
function needsTicket(f) { return !!(f && (f.digest || isSmb(f) || isDlna(f))); } // (Digest, or a share: the TV's player can do neither)
|
|
123
|
+
function prepare(url) {
|
|
124
|
+
var f = folderOfUrl(url);
|
|
125
|
+
if (!needsTicket(f)) { return null; }
|
|
126
|
+
var t = _tickets[f.id];
|
|
127
|
+
if (t && Date.now() - t.at < TICKET_MS) { return Promise.resolve(t.ticket); }
|
|
128
|
+
return ask(f, 'open', null, 8000, 4096).then(function (r) {
|
|
129
|
+
if (!r || !/^[0-9a-f]{32}$/.test(r.ticket || '')) { throw new Error('no ticket'); }
|
|
130
|
+
_tickets[f.id] = { ticket: r.ticket, at: Date.now() };
|
|
131
|
+
return r.ticket;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// What's in a video there, from its header (the service's /dav/mi: see mediaInfo).
|
|
135
|
+
function mediaInfo(f, rel, cancel) { return ask(f, 'mi', rel, 25000, 262144, cancel); }
|
|
136
|
+
// A media server's id as a folder's name: its UDN (or control link), hashed short.
|
|
137
|
+
function dlnaId(s) { var h = 5381; s = '' + s; for (var i = 0; i < s.length; i++) { h = ((h * 33) ^ s.charCodeAt(i)) >>> 0; } return 'm' + h.toString(36) + s.length.toString(36); }
|
|
138
|
+
// The media servers on the home network (asked now, a few seconds): [{ id, name, control }],
|
|
139
|
+
// those already added left out.
|
|
140
|
+
function discover() {
|
|
141
|
+
if (typeof LocalMedia === 'undefined' || !LocalMedia.askService) { return Promise.reject(new Error(U.t('no StremioK service here'))); }
|
|
142
|
+
return LocalMedia.askService('/dlna/discover', 20000, 262144).then(function (r) {
|
|
143
|
+
var have = all().filter(isDlna).map(function (f) { return f.control; });
|
|
144
|
+
return U.listOf(r && r.servers, 32, function (x) { return x && typeof x.control === 'string' && /^https?:\/\//i.test(x.control) && typeof x.name === 'string'; })
|
|
145
|
+
.filter(function (x) { return have.indexOf(x.control) === -1; });
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// A server's shares, to pick one (smb://host/): [{ name, remark }].
|
|
149
|
+
function shares(host, user, pass) {
|
|
150
|
+
var f = { id: 'probe', kind: 'smb', url: 'smb://' + host + '/', user: '' + (user || ''), pass: '' + (pass || '') };
|
|
151
|
+
return ask(f, 'shares', null, 30000, 262144).then(function (r) { return U.listOf(r.shares, 200, function (x) { return x && typeof x.name === 'string' && x.name; }); });
|
|
152
|
+
}
|
|
153
|
+
// A server's address as typed for a share: a host (name or address, a port after it), or null.
|
|
154
|
+
function smbHostOf(v) {
|
|
155
|
+
var m = /^(?:smb:\/\/|\\\\)?([A-Za-z0-9._-]{1,253})(?::(\d{1,5}))?[\/\\]*$/.exec(('' + (v || '')).trim());
|
|
156
|
+
return m ? m[1] + (m[2] ? ':' + m[2] : '') : null;
|
|
157
|
+
}
|
|
98
158
|
|
|
99
159
|
// ---- links ----
|
|
100
160
|
// The folder a link is in (its address a prefix of the link), or null.
|
|
@@ -113,6 +173,9 @@ var NetFolders = (function () {
|
|
|
113
173
|
function playUrl(url) {
|
|
114
174
|
var f = folderOfUrl(url);
|
|
115
175
|
if (!f) { return null; }
|
|
176
|
+
var t = needsTicket(f) ? _tickets[f.id] : null;
|
|
177
|
+
if (t && typeof LocalMedia !== 'undefined' && LocalMedia.serviceUrl) { return LocalMedia.serviceUrl('/net/' + t.ticket + '/f?p=' + encodeURIComponent(relOf(f, url))); } // (Digest: through the service)
|
|
178
|
+
if (isSmb(f) || isDlna(f)) { return null; } // (a share's or a media server's file: through the service, its ticket asked first)
|
|
116
179
|
if (!f.user && !f.pass) { return '' + url; }
|
|
117
180
|
return ('' + url).replace(/^(https?:\/\/)/i, '$1' + encodeURIComponent(f.user || '') + ':' + encodeURIComponent(f.pass || '') + '@');
|
|
118
181
|
}
|
|
@@ -121,15 +184,20 @@ var NetFolders = (function () {
|
|
|
121
184
|
function newId() { var s = ''; while (s.length < 8) { s += Math.floor(Math.random() * 36).toString(36); } return s; }
|
|
122
185
|
// Ask the folder (its top's listing) with this sign-in: resolves the folder to keep, or
|
|
123
186
|
// rejects as ask does (untrusted: the certificate to ask about, then probe again with it).
|
|
124
|
-
function probe(url, user, pass, cert) {
|
|
187
|
+
function probe(url, user, pass, cert, kind, server) {
|
|
125
188
|
var f = { id: 'probe', url: baseOf(url), user: '' + (user || ''), pass: '' + (pass || ''), cert: cert || '' };
|
|
126
|
-
|
|
189
|
+
if (kind === 'smb') { f.kind = 'smb'; f.cert = ''; }
|
|
190
|
+
if (kind === 'dlna') { f = { id: 'probe', kind: 'dlna', url: 'dlna://' + dlnaId(server.id || server.control) + '/', control: server.control, user: '', pass: '', cert: '' }; }
|
|
191
|
+
return list(f, '').then(function (r) { return { url: f.url, user: f.user, pass: f.pass, cert: f.cert, name: kind === 'dlna' ? ('' + (server.name || 'DLNA')).slice(0, 80) : nameOf(f.url), entries: r.entries.length, digest: !!f.digest, kind: f.kind, control: f.control }; });
|
|
127
192
|
}
|
|
128
193
|
// Keep a folder probe() found (the same address again: replaced).
|
|
129
194
|
function add(p) {
|
|
130
195
|
var l = all().filter(function (f) { return f.url !== p.url; });
|
|
131
196
|
if (l.length >= MAX) { throw new Error(U.t('Up to {n} network folders', { n: MAX })); }
|
|
132
197
|
var f = { id: newId(), name: p.name || nameOf(p.url), url: p.url, user: p.user || '', pass: p.pass || '', cert: p.cert || '', at: Date.now() };
|
|
198
|
+
if (p.digest) { f.digest = true; }
|
|
199
|
+
if (p.kind === 'smb') { f.kind = 'smb'; }
|
|
200
|
+
if (p.kind === 'dlna') { f.kind = 'dlna'; f.control = p.control; }
|
|
133
201
|
l.push(f);
|
|
134
202
|
save(l);
|
|
135
203
|
U.log('local', 'Network folder “' + f.name + '” added' + (f.cert ? ' (its certificate trusted)' : ''));
|
|
@@ -152,6 +220,6 @@ var NetFolders = (function () {
|
|
|
152
220
|
return {
|
|
153
221
|
all: all, folders: folders, get: get, drives: drives, driveOf: driveOf, onChange: onChange,
|
|
154
222
|
addressProblem: addressProblem, nameOf: nameOf, probe: probe, add: add, setOn: setOn, remove: remove,
|
|
155
|
-
list: list, walk: walk, headers: headers, subPath: subPath, fileUrl: fileUrl, folderOfUrl: folderOfUrl, relOf: relOf, playUrl: playUrl
|
|
223
|
+
list: list, walk: walk, headers: headers, subPath: subPath, mediaInfo: mediaInfo, prepare: prepare, shares: shares, smbHostOf: smbHostOf, isSmb: isSmb, isDlna: isDlna, discover: discover, fileUrl: fileUrl, folderOfUrl: folderOfUrl, relOf: relOf, playUrl: playUrl
|
|
156
224
|
};
|
|
157
225
|
})();
|
package/js/player-audio.js
CHANGED
|
@@ -151,14 +151,19 @@
|
|
|
151
151
|
if (prefs.length && cfg.lang2 !== 'none' && cfg.lang2 !== cfg.lang) { prefs.push(cfg.lang2); }
|
|
152
152
|
// (the track playing already in that language: kept, not swapped for another
|
|
153
153
|
// track in it, e.g. the first English one when the file plays its second)
|
|
154
|
-
|
|
154
|
+
// (a commentary track, by the file's header, only when the language has nothing else)
|
|
155
|
+
var playing = -1, own = P.fileTracks ? P.fileTracks('audio', tracks) : null;
|
|
156
|
+
var talk = function (i) { return !!(own && own[i] && own[i].commentary); };
|
|
155
157
|
for (var k = 0; k < tracks.length; k++) { if (tracks[k].index === _audioIdx) { playing = k; break; } }
|
|
156
158
|
for (var p = 0; p < prefs.length && pos < 0; p++) {
|
|
157
|
-
if (playing >= 0 && langMatches(prefs[p], infoLang(trackInfo(tracks[playing])))) { pos = playing; break; }
|
|
159
|
+
if (playing >= 0 && !talk(playing) && langMatches(prefs[p], infoLang(trackInfo(tracks[playing])))) { pos = playing; break; }
|
|
160
|
+
var first = -1;
|
|
158
161
|
for (var i = 0; i < tracks.length; i++) {
|
|
159
|
-
|
|
160
|
-
if (
|
|
162
|
+
if (!langMatches(prefs[p], infoLang(trackInfo(tracks[i])))) { continue; }
|
|
163
|
+
if (first < 0) { first = i; }
|
|
164
|
+
if (!talk(i)) { pos = i; break; }
|
|
161
165
|
}
|
|
166
|
+
if (pos < 0 && first >= 0) { pos = first; }
|
|
162
167
|
}
|
|
163
168
|
}
|
|
164
169
|
return pos;
|
|
@@ -190,14 +195,16 @@
|
|
|
190
195
|
}
|
|
191
196
|
// Menu wording: "English · 6ch · EAC3 (eng)"; the raw tag keeps regional
|
|
192
197
|
// variants apart (es-419 vs es-ES).
|
|
193
|
-
function audioMenuLabel(tr, n) {
|
|
198
|
+
function audioMenuLabel(tr, n, own) {
|
|
194
199
|
var info = trackInfo(tr), lang = infoLang(info);
|
|
195
200
|
var ch = info.channels || info.channel, codec = info.fourCC || info.codec || '';
|
|
196
201
|
var parts = [lang && lang !== 'und' ? langName(lang) : U.t('Audio {n}', { n: n + 1 })];
|
|
197
202
|
if (ch) { parts.push(ch + 'ch'); }
|
|
198
203
|
if (codec) { parts.push(('' + codec).toUpperCase()); }
|
|
199
204
|
var label = parts.join(' · ');
|
|
200
|
-
|
|
205
|
+
label = (lang && lang !== 'und' && langName(lang).toLowerCase() !== ('' + lang).toLowerCase()) ? label + ' (' + lang + ')' : label;
|
|
206
|
+
var note = own && P.fileTrackNote ? P.fileTrackNote(own) : ''; // (its own name, from the file's header: "Commentary with the director")
|
|
207
|
+
return note ? label + ' · ' + note : label;
|
|
201
208
|
}
|
|
202
209
|
|
|
203
210
|
// force: the track picked is the one the TV already reports. If you can still hear
|
|
@@ -316,7 +323,8 @@
|
|
|
316
323
|
// same language's tracks sit together.
|
|
317
324
|
function audioMenu() {
|
|
318
325
|
var cfg = getAudioCfg(), prefs = [cfg.lang, cfg.lang2].filter(function (x) { return x && x !== 'default' && x !== 'none'; });
|
|
319
|
-
var
|
|
326
|
+
var all = getAudioTracks(), own = P.fileTracks ? P.fileTracks('audio', all) : null;
|
|
327
|
+
var tracks = all.map(function (tr, i) { return { tr: tr, n: i, k: langKey(trackLang(tr)) }; });
|
|
320
328
|
tracks.sort(function (a, b) {
|
|
321
329
|
var ra = langRank(a.k, prefs), rb = langRank(b.k, prefs);
|
|
322
330
|
if (ra !== rb) { return ra - rb; }
|
|
@@ -327,7 +335,7 @@
|
|
|
327
335
|
var items = tracks.map(function (x, i) {
|
|
328
336
|
var tr = x.tr;
|
|
329
337
|
if (tr.index === _audioIdx) { idx = i; }
|
|
330
|
-
return { label: audioMenuLabel(tr, x.n), sel: (tr.index === _audioIdx),
|
|
338
|
+
return { label: audioMenuLabel(tr, x.n, own && own[x.n]), sel: (tr.index === _audioIdx),
|
|
331
339
|
run: function () {
|
|
332
340
|
if (stuck) { closeMenu(); U.toast(cantSwitchText(), 6000); return; }
|
|
333
341
|
// re-picking the checked track re-applies it (see selectAudio)
|
package/js/player-controls.js
CHANGED
|
@@ -846,6 +846,73 @@
|
|
|
846
846
|
var tags = (info && Stremio.formatTags) ? Stremio.formatTags(info, S.actual) : '';
|
|
847
847
|
if (tags) { lines.push([U.t('Format'), tags]); }
|
|
848
848
|
}
|
|
849
|
+
// What the file's header says (S.mi: player-core's startFileInfo): its container and video,
|
|
850
|
+
// what its Dolby Vision does on this TV, and its audio and subtitle tracks, each with its
|
|
851
|
+
// language, codec and own name (MI_SHOW of each, then how many more).
|
|
852
|
+
var MI_SHOW = 6;
|
|
853
|
+
var CODEC_NAMES = { h264: 'H.264', hevc: 'HEVC', av1: 'AV1', vp9: 'VP9', vp8: 'VP8', mpeg2: 'MPEG-2', mpeg4: 'MPEG-4', aac: 'AAC', ac3: 'Dolby Digital', eac3: 'Dolby Digital Plus',
|
|
854
|
+
dts: 'DTS', truehd: 'Dolby TrueHD', flac: 'FLAC', opus: 'Opus', vorbis: 'Vorbis', mp3: 'MP3', mp2: 'MP2', pcm: 'PCM', alac: 'ALAC', srt: 'SRT', ass: 'ASS', ssa: 'SSA',
|
|
855
|
+
vtt: 'WebVTT', pgs: 'PGS', vobsub: 'VobSub', dvb: 'DVB', mov_text: 'MP4 text', ttml: 'TTML', cc608: 'CEA-608', textst: 'TextST', usf: 'USF' };
|
|
856
|
+
function codecName(c) { return CODEC_NAMES[c] || (c ? ('' + c).toUpperCase() : ''); }
|
|
857
|
+
function channelsName(n) { return ({ 1: '1.0', 2: '2.0', 3: '2.1', 6: '5.1', 7: '6.1', 8: '7.1' })[n] || (n ? n + 'ch' : ''); }
|
|
858
|
+
// Samsung TVs have no Dolby Vision: what's underneath plays (HDR10, HLG or SDR); a profile 5
|
|
859
|
+
// file has nothing underneath, so its colors come out wrong (green and purple).
|
|
860
|
+
function dvNote(dv) {
|
|
861
|
+
var p = dv.profile || '';
|
|
862
|
+
if (dv.compat === 1 || dv.compat === 6) { return U.t('Dolby Vision {p}: plays as HDR10', { p: p }); }
|
|
863
|
+
if (dv.compat === 4) { return U.t('Dolby Vision {p}: plays as HLG', { p: p }); }
|
|
864
|
+
if (dv.compat === 2) { return U.t('Dolby Vision {p}: plays as SDR', { p: p }); }
|
|
865
|
+
if (p) { return U.t('Dolby Vision {p}: no HDR10 layer, its colors look wrong on this TV', { p: p }); }
|
|
866
|
+
return U.t('Dolby Vision');
|
|
867
|
+
}
|
|
868
|
+
function trackLine(t) {
|
|
869
|
+
var lang = t.lang && !/^(und|zxx|mis)$/i.test(t.lang) ? P.langName(t.lang) : '';
|
|
870
|
+
var bits = [lang, codecName(t.codec), channelsName(t.channels)];
|
|
871
|
+
if (t.name && t.name.toLowerCase() !== lang.toLowerCase()) { bits.push('“' + t.name + '”'); }
|
|
872
|
+
if (t.forced && !/forced/i.test(t.name || '')) { bits.push(U.t('forced')); }
|
|
873
|
+
if (t.commentary && !/commentary/i.test(t.name || '')) { bits.push(U.t('commentary')); }
|
|
874
|
+
if (t.hi && !/\bSDH\b/i.test(t.name || '')) { bits.push('SDH'); }
|
|
875
|
+
return bits.filter(Boolean).join(' ');
|
|
876
|
+
}
|
|
877
|
+
// A track's own name and marks, for the menus (no language: the menu says it): "“Signs &
|
|
878
|
+
// songs” · forced", a picture subtitle (PGS, VobSub) said not shown (the TV hands over none).
|
|
879
|
+
function fileTrackNote(t) {
|
|
880
|
+
if (!t) { return ''; }
|
|
881
|
+
var bits = [];
|
|
882
|
+
if (t.name) { bits.push('“' + t.name + '”'); }
|
|
883
|
+
if (t.forced && !/forced/i.test(t.name || '')) { bits.push(U.t('forced')); }
|
|
884
|
+
if (t.commentary && !/commentary/i.test(t.name || '')) { bits.push(U.t('commentary')); }
|
|
885
|
+
if (t.hi && !/\bSDH\b/i.test(t.name || '')) { bits.push('SDH'); }
|
|
886
|
+
if (t.text === false && /^(pgs|vobsub|dvb)$/.test(t.codec || '')) { bits.push(U.t('{codec}: pictures, not shown', { codec: codecName(t.codec) })); }
|
|
887
|
+
return bits.join(' · ');
|
|
888
|
+
}
|
|
889
|
+
P.fileTrackNote = fileTrackNote;
|
|
890
|
+
function trackList(list) {
|
|
891
|
+
var out = list.slice(0, MI_SHOW).map(trackLine);
|
|
892
|
+
if (list.length > MI_SHOW) { out.push(U.t('{n} more', { n: list.length - MI_SHOW })); }
|
|
893
|
+
return out.join(' · ');
|
|
894
|
+
}
|
|
895
|
+
// The file in short, for a start that failed (player-core's formatFailText): its video and
|
|
896
|
+
// the audio that plays first. '' when the header said neither.
|
|
897
|
+
function fileSummary(mi) {
|
|
898
|
+
var v = mi.video, a = (mi.audio || []).filter(function (x) { return x.default; })[0] || (mi.audio || [])[0], out = [];
|
|
899
|
+
if (v && v.codec) { out.push([codecName(v.codec), v.bitDepth > 8 ? U.t('{n}-bit', { n: v.bitDepth }) : '', v.hdr === 'hdr10' && !v.dv ? 'HDR10' : v.hdr === 'hlg' && !v.dv ? 'HLG' : ''].filter(Boolean).join(' ')); }
|
|
900
|
+
if (v && v.dv) { out.push(v.dv.profile ? 'Dolby Vision ' + v.dv.profile : 'Dolby Vision'); }
|
|
901
|
+
if (a && a.codec) { out.push([codecName(a.codec), channelsName(a.channels)].filter(Boolean).join(' ')); }
|
|
902
|
+
return out.join(' · ');
|
|
903
|
+
}
|
|
904
|
+
P.fileSummary = fileSummary;
|
|
905
|
+
function fileLines(lines) {
|
|
906
|
+
var mi = S.mi;
|
|
907
|
+
if (!mi || !mi.container) { return; }
|
|
908
|
+
var v = mi.video, parts = [('' + mi.container).toUpperCase()];
|
|
909
|
+
if (v) { parts.push([codecName(v.codec), v.bitDepth > 8 ? U.t('{n}-bit', { n: v.bitDepth }) : '', v.hdr === 'hdr10' ? 'HDR10' : v.hdr === 'hlg' ? 'HLG' : ''].filter(Boolean).join(' ')); }
|
|
910
|
+
if (mi.duration > 0) { parts.push(U.fmtTime(mi.duration)); }
|
|
911
|
+
lines.push([U.t('In the file'), parts.filter(Boolean).join(' · ')]);
|
|
912
|
+
if (v && v.dv) { lines.push([U.t('Dolby Vision'), dvNote(v.dv)]); }
|
|
913
|
+
if (mi.audio && mi.audio.length) { lines.push([U.t('Audio tracks'), trackList(mi.audio)]); }
|
|
914
|
+
if (mi.subs && mi.subs.length) { lines.push([U.t('Subtitle tracks'), trackList(mi.subs)]); }
|
|
915
|
+
}
|
|
849
916
|
// How it reaches the player (no link): straight from its server, or through StremioK's service.
|
|
850
917
|
function howItPlays() {
|
|
851
918
|
var c = S.ctx;
|
|
@@ -860,6 +927,7 @@
|
|
|
860
927
|
if (!el || !S.ctx) { return; }
|
|
861
928
|
var lines = [], video = null, audio = null;
|
|
862
929
|
sourceLines(lines);
|
|
930
|
+
fileLines(lines);
|
|
863
931
|
if (P.useAV) {
|
|
864
932
|
try {
|
|
865
933
|
var now = avplay.getCurrentStreamInfo() || [];
|
package/js/player-core.js
CHANGED
|
@@ -95,10 +95,12 @@ var PlayerParts = {};
|
|
|
95
95
|
|
|
96
96
|
// Jumps ahead the player makes on its own (see checkJump): the last play time and when
|
|
97
97
|
// it came, and where one was last undone.
|
|
98
|
-
var JUMP_SLACK_SECS = 5;
|
|
98
|
+
var JUMP_SLACK_SECS = 5, JUMP_BACK_MS = 20000;
|
|
99
99
|
var _tick = null; // { pos (s), wall (ms) }
|
|
100
100
|
var _jumpUndone = null; // the position (s) a jump was last taken back to
|
|
101
101
|
var _pausedOnce = false; // paused since this was opened (it only happens after pauses)
|
|
102
|
+
var _pausedSince = 0; // when it was paused (Date.now), 0 playing: a long pause re-anchors the TV's player (play_)
|
|
103
|
+
var _jumpBack = null; // a jump taken back: { to (s), at (ms), tries }, checked on the next play times (checkJump)
|
|
102
104
|
|
|
103
105
|
function init() {
|
|
104
106
|
objEl = U.byId('av-player');
|
|
@@ -426,6 +428,60 @@ var PlayerParts = {};
|
|
|
426
428
|
play(ctx, _onExit);
|
|
427
429
|
}
|
|
428
430
|
|
|
431
|
+
// What's in the file playing, from its header (StremioK's service reads it: its container,
|
|
432
|
+
// codecs, HDR, every audio and subtitle track with its name; see the service's mediaInfo):
|
|
433
|
+
// asked once for the source as it opens, never for a list of them; the last MI_KEEP kept.
|
|
434
|
+
// S.mi: the answer for what's playing, else null (not asked yet, not read, or not a file:
|
|
435
|
+
// HLS, DASH, YouTube, a live channel, a trailer).
|
|
436
|
+
var MI_KEEP = 40, _miSeen = U.lru(MI_KEEP), _miLook = null;
|
|
437
|
+
function fileInfoAsk(ctx) {
|
|
438
|
+
if (!ctx || ctx.yt || ctx.trailer || S.isLive) { return null; }
|
|
439
|
+
// (Settings › Playback › Seeking & buffering › Read the file's details: a USB drive's only
|
|
440
|
+
// unless All files — the others are more requests to their server as playback starts)
|
|
441
|
+
var want = P.playerCfg().fileInfo;
|
|
442
|
+
if (want === 'off' || (want !== 'all' && !(ctx.localFile && !ctx.localFile.dav))) { return null; }
|
|
443
|
+
var url = '' + (ctx.url || ''), size = ctx.stream && ctx.stream.behaviorHints ? +ctx.stream.behaviorHints.videoSize || 0 : 0;
|
|
444
|
+
if (ctx.localFile) {
|
|
445
|
+
if (typeof LocalMedia === 'undefined' || !LocalMedia.fileInfo) { return null; }
|
|
446
|
+
return { key: 'file:' + (ctx.localFile.dav || '') + ':' + ctx.localFile.abs + ':' + (ctx.localFile.size || 0), ask: function (c) { return LocalMedia.fileInfo(ctx.localFile, c); } };
|
|
447
|
+
}
|
|
448
|
+
if (!/^https?:\/\//i.test(url) || /^http:\/\/(localhost|127\.0\.0\.1)[:\/]/i.test(url) || HLS_LINK.test(url) || /\.mpd(?:[?#]|$)/i.test(url)) { return null; }
|
|
449
|
+
if (ctx.formatInfo && ctx.formatInfo.container === 'hls') { return null; }
|
|
450
|
+
if (typeof YTPlay === 'undefined' || !YTPlay.mediaInfo || YTPlay.installMode() === 'browser') { return null; }
|
|
451
|
+
var lan = typeof Stremio !== 'undefined' && Stremio.getPrefs ? !!Stremio.getPrefs().allowLocal : false;
|
|
452
|
+
return { key: 'link:' + url.split(/[?#]/)[0] + ':' + (size || url), ask: function (c) { return YTPlay.mediaInfo(url, U.sanitizeHeaders(ctx._headers), lan, c); } }; // (the link without its query, and the file's size: a new token, the same file)
|
|
453
|
+
}
|
|
454
|
+
function startFileInfo(ctx) {
|
|
455
|
+
if (_miLook) { _miLook.cancel(); _miLook = null; }
|
|
456
|
+
S.mi = null;
|
|
457
|
+
var job = fileInfoAsk(ctx);
|
|
458
|
+
if (!job) { return; }
|
|
459
|
+
var known = _miSeen.get(job.key);
|
|
460
|
+
if (known) { fileInfoIn(ctx, known); return; }
|
|
461
|
+
var look = _miLook = U.cancelToken();
|
|
462
|
+
job.ask(look).then(function (mi) {
|
|
463
|
+
if (look.cancelled || !mi || typeof mi !== 'object' || !mi.container) { return; }
|
|
464
|
+
_miSeen.set(job.key, mi);
|
|
465
|
+
if (S.ctx === ctx && S.active) { fileInfoIn(ctx, mi); }
|
|
466
|
+
}, function (e) { if (!look.cancelled) { U.log('player', 'The file\'s details couldn\'t be read: ' + ((e && e.message) || 'unknown')); } });
|
|
467
|
+
}
|
|
468
|
+
// The answer in: S.mi, and the source's details corrected by it (Stremio.withFileInfo): what
|
|
469
|
+
// the player shows (its tags, Stream info) and what Formats learns from it are the file's.
|
|
470
|
+
function fileInfoIn(ctx, mi) {
|
|
471
|
+
S.mi = mi;
|
|
472
|
+
if (typeof Stremio !== 'undefined' && Stremio.withFileInfo) { ctx.formatInfo = Stremio.withFileInfo(ctx.formatInfo || (Stremio.streamInfo ? Stremio.streamInfo({ url: ctx.url, name: ctx.name }) : null), mi); }
|
|
473
|
+
if (!osdHidden()) { renderOSD(); }
|
|
474
|
+
}
|
|
475
|
+
// A start that failed for its format (not the network or the link), its file's header read:
|
|
476
|
+
// what's in the file said ("HEVC 10-bit · Dolby Vision 5 · Dolby TrueHD 7.1"), else why as given.
|
|
477
|
+
var NOT_FORMAT_ERR = /CONNECTION|NETWORK|DISCONNECT|INVALID_URI|TIMEOUT|TIMED_OUT|HTTP|license/i;
|
|
478
|
+
function formatFailText(why, err) {
|
|
479
|
+
if (!S.mi || !P.fileSummary || NOT_FORMAT_ERR.test('' + (err || '')) || (S.ctx && S.ctx._drmWhy)) { return why; }
|
|
480
|
+
var what = P.fileSummary(S.mi);
|
|
481
|
+
return what ? U.t('This TV didn’t play this file: {what}', { what: what }) : why;
|
|
482
|
+
}
|
|
483
|
+
P.fileInfoFor = function (ctx) { var j = fileInfoAsk(ctx); return j ? _miSeen.get(j.key) || null : null; };
|
|
484
|
+
|
|
429
485
|
function play(ctx, onExit) {
|
|
430
486
|
// Replacing a YouTube stream that's playing (CH+/CH− to the next channel): the TV's
|
|
431
487
|
// player can freeze on an open straight after closing it, so settle first (startAV).
|
|
@@ -463,7 +519,7 @@ var PlayerParts = {};
|
|
|
463
519
|
recoReset();
|
|
464
520
|
_prefetchedNext = false; S.playStarted = false; S.playing = false;
|
|
465
521
|
_segments = null; _creditsSec = null; _creditsHandled = false; _segmentsFor = null;
|
|
466
|
-
S.buffering = false; S.pendingSeek = null; S.lastSeekAt = 0; S.settleFrom = 0; _seekRecovering = false; _jumpUndone = null; _pausedOnce = false;
|
|
522
|
+
S.buffering = false; S.pendingSeek = null; S.lastSeekAt = 0; S.settleFrom = 0; _seekRecovering = false; _jumpUndone = null; _pausedOnce = false; _pausedSince = 0; _jumpBack = null;
|
|
467
523
|
updateHint();
|
|
468
524
|
|
|
469
525
|
U.byId('app').className = 'hidden';
|
|
@@ -478,6 +534,13 @@ var PlayerParts = {};
|
|
|
478
534
|
if (fileViaService(ctx)) { startFileRelay(ctx, settle); return; }
|
|
479
535
|
if (useAV) { startLive(ctx, settle); } else { startHTML5(ctx.url); }
|
|
480
536
|
};
|
|
537
|
+
// (a network folder's file that plays through the service — Digest sign-in: its ticket
|
|
538
|
+
// first, LocalMedia.prepare; asked or not, it then plays)
|
|
539
|
+
var prep = ctx.localFile && typeof LocalMedia !== 'undefined' && LocalMedia.prepare ? LocalMedia.prepare(ctx.url) : null;
|
|
540
|
+
if (prep) {
|
|
541
|
+
var plain = go;
|
|
542
|
+
go = function () { prep.then(function () { if (S.ctx === ctx && S.active) { plain(); } }, function () { if (S.ctx === ctx && S.active) { plain(); } }); };
|
|
543
|
+
}
|
|
481
544
|
if (ctx.stream && ctx.stream._pickFile && typeof Stremio !== 'undefined' && Stremio.torrentFile) {
|
|
482
545
|
// (the source before stopped first: its callbacks are about it, not this one)
|
|
483
546
|
++_playToken; _openedAt = 0;
|
|
@@ -512,6 +575,8 @@ var PlayerParts = {};
|
|
|
512
575
|
}, function () {});
|
|
513
576
|
}
|
|
514
577
|
|
|
578
|
+
startFileInfo(ctx);
|
|
579
|
+
|
|
515
580
|
// A trailer is just watched: no skip segments, progress or watched state. Its subtitles
|
|
516
581
|
// (your language, else your second choice) from its own captions (see startSubtitles).
|
|
517
582
|
if (ctx.trailer) { startSubtitles(ctx); return; }
|
|
@@ -797,7 +862,7 @@ var PlayerParts = {};
|
|
|
797
862
|
if (!S.playing && (relayFailed() || tryFallback())) { return; }
|
|
798
863
|
reportStart(false, err); // (unless it had already played)
|
|
799
864
|
U.log('player', 'Playback error: ' + err + ' (' + where(S.ctx && S.ctx.url) + ')');
|
|
800
|
-
if (!S.playing) { failedStart(U.t('Playback error: {why}', { why: err })); return; }
|
|
865
|
+
if (!S.playing) { failedStart(formatFailText(U.t('Playback error: {why}', { why: err }), err)); return; }
|
|
801
866
|
U.toast(U.t('Playback error: {why}', { why: err }));
|
|
802
867
|
exitLater();
|
|
803
868
|
}
|
|
@@ -838,7 +903,7 @@ var PlayerParts = {};
|
|
|
838
903
|
if (tryFallback()) { return; }
|
|
839
904
|
U.log('player', 'Could not open: ' + (err && (err.name || err.message || err)) + ' (' + where(url) + ')');
|
|
840
905
|
reportStart(false, err && (err.name || err.message || err));
|
|
841
|
-
failedStart(S.ctx && S.ctx._drmWhy ? U.t('No license for this channel: {why}', { why: S.ctx._drmWhy }) : U.t('Could not open stream'));
|
|
906
|
+
failedStart(S.ctx && S.ctx._drmWhy ? U.t('No license for this channel: {why}', { why: S.ctx._drmWhy }) : formatFailText(U.t('Could not open stream'), err && (err.name || err.message || err)));
|
|
842
907
|
});
|
|
843
908
|
} catch (e) {
|
|
844
909
|
U.log('player', 'AVPlay failed: ' + (e && e.message));
|
|
@@ -1171,8 +1236,20 @@ var PlayerParts = {};
|
|
|
1171
1236
|
if (useAV) { return state() !== 'PLAYING'; }
|
|
1172
1237
|
return S.videoEl.paused;
|
|
1173
1238
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1239
|
+
// After a pause of LONG_PAUSE_MS or more the TV's player can jump ahead at its next buffering,
|
|
1240
|
+
// to where it would be had it never paused (its clock ran on: seen 115 s and 501 s on the Tizen
|
|
1241
|
+
// 6 TV): so it's set again at the paused place first (a jump to where it is), and plays on from
|
|
1242
|
+
// there. A short pause: as it is.
|
|
1243
|
+
var LONG_PAUSE_MS = 20000;
|
|
1244
|
+
function play_() {
|
|
1245
|
+
if (useAV) {
|
|
1246
|
+
if (_pausedSince && Date.now() - _pausedSince >= LONG_PAUSE_MS && !S.isLive && S.cur > 0) { doAVSeek(S.cur, 0); }
|
|
1247
|
+
_pausedSince = 0;
|
|
1248
|
+
try { avplay.play(); } catch (e) {}
|
|
1249
|
+
} else { S.videoEl.play(); }
|
|
1250
|
+
screenSaver(false);
|
|
1251
|
+
}
|
|
1252
|
+
function pause_() { _pausedOnce = true; _pausedSince = Date.now(); jfTell('pause'); if (useAV) { try { avplay.pause(); } catch (e) {} } else { S.videoEl.pause(); } screenSaver(true); }
|
|
1176
1253
|
|
|
1177
1254
|
// The TV's screensaver stays off while a video plays and is allowed again when it's
|
|
1178
1255
|
// paused or stopped. No-op where the Samsung appcommon API isn't available.
|
|
@@ -1190,7 +1267,7 @@ var PlayerParts = {};
|
|
|
1190
1267
|
// keep a small margin from the very end (seeking to EOF can error)
|
|
1191
1268
|
var maxT = S.dur ? Math.max(0, S.dur - 2) : 1e9;
|
|
1192
1269
|
var target = Math.max(0, Math.min(maxT, sec));
|
|
1193
|
-
S.cur = target;
|
|
1270
|
+
S.cur = target; _jumpBack = null; // (a jump you asked for: not taken back)
|
|
1194
1271
|
renderOSD();
|
|
1195
1272
|
showOSD(false);
|
|
1196
1273
|
if (useAV) {
|
|
@@ -1226,6 +1303,16 @@ var PlayerParts = {};
|
|
|
1226
1303
|
// Returns true when it took one back (that play time isn't shown).
|
|
1227
1304
|
function checkJump(pos) {
|
|
1228
1305
|
var now = Date.now(), t = _tick;
|
|
1306
|
+
// (a jump taken back: did the TV go back? One it ignored — asked while it buffered — is
|
|
1307
|
+
// asked again, twice at most, within JUMP_BACK_MS)
|
|
1308
|
+
var jb = _jumpBack;
|
|
1309
|
+
if (jb) {
|
|
1310
|
+
if (pos <= jb.to + JUMP_SLACK_SECS + 2 || now - jb.at > JUMP_BACK_MS) { _jumpBack = null; }
|
|
1311
|
+
else if (!S.buffering && S.pendingSeek == null && now - S.lastSeekAt > 1500) {
|
|
1312
|
+
if (jb.tries >= 2) { _jumpBack = null; U.log('player', 'Playback jumped ahead and didn\'t go back to ' + U.fmtTime(jb.to) + ': left at ' + U.fmtTime(pos)); }
|
|
1313
|
+
else { jb.tries++; _tick = { pos: jb.to, wall: now }; S.cur = jb.to; doAVSeek(jb.to, 0); return true; }
|
|
1314
|
+
} else { return true; } // (on its way back: that play time isn't shown)
|
|
1315
|
+
}
|
|
1229
1316
|
_tick = { pos: pos, wall: now };
|
|
1230
1317
|
if (!t || !_pausedOnce || S.isLive || !useAV || scrubbing() || S.pendingSeek != null || S.lastSeekAt >= t.wall) { return false; }
|
|
1231
1318
|
var ahead = (pos - t.pos) - (now - t.wall) / 1000;
|
|
@@ -1239,7 +1326,10 @@ var PlayerParts = {};
|
|
|
1239
1326
|
_jumpUndone = t.pos;
|
|
1240
1327
|
_tick = { pos: t.pos, wall: now };
|
|
1241
1328
|
S.cur = t.pos;
|
|
1242
|
-
|
|
1329
|
+
_jumpBack = { to: t.pos, at: now, tries: 0 };
|
|
1330
|
+
// (it jumps as it buffers, when the TV ignores a seek: then asked once the buffering's done,
|
|
1331
|
+
// as any seek made then)
|
|
1332
|
+
if (S.buffering) { S.pendingSeek = t.pos; } else { doAVSeek(t.pos, 0); }
|
|
1243
1333
|
return true;
|
|
1244
1334
|
}
|
|
1245
1335
|
|
package/js/player-lang.js
CHANGED
|
@@ -177,6 +177,22 @@
|
|
|
177
177
|
return ('' + (lang || '')).toLowerCase().trim();
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
// The file's own track (its header's, S.mi: see player-core's startFileInfo) for each of the
|
|
181
|
+
// TV player's tracks of a kind ('audio' | 'subs'): by position, when the header lists as many
|
|
182
|
+
// and every language it states agrees with the player's; else null (an odd file: the player's
|
|
183
|
+
// list as it is).
|
|
184
|
+
function fileTracks(kind, tracks) {
|
|
185
|
+
var list = P.S.mi && P.S.mi[kind];
|
|
186
|
+
if (!list || !tracks || list.length !== tracks.length || !list.length) { return null; }
|
|
187
|
+
for (var i = 0; i < list.length; i++) {
|
|
188
|
+
var tv = langKey(trackLang(tracks[i])), fl = langKey(list[i].lang || '');
|
|
189
|
+
if (tv && fl && !P.langUnstated(tv) && !P.langUnstated(fl) && tv !== fl && langKey(('' + list[i].lang).split('-')[0]) !== tv) { return null; }
|
|
190
|
+
}
|
|
191
|
+
return list;
|
|
192
|
+
}
|
|
193
|
+
function fileTrack(kind, tracks, pos) { var l = fileTracks(kind, tracks); return l ? l[pos] || null : null; }
|
|
194
|
+
P.fileTracks = fileTracks; P.fileTrack = fileTrack;
|
|
195
|
+
|
|
180
196
|
// ----- for the other parts (and js/player.js) -----
|
|
181
197
|
P.trackInfo = trackInfo; P.infoLang = infoLang; P.trackLang = trackLang; P.langMatches = langMatches;
|
|
182
198
|
P.langName = langName; P.langRank = langRank; P.langKey = langKey;
|
package/js/player-store.js
CHANGED
|
@@ -97,7 +97,8 @@
|
|
|
97
97
|
font: subFontFamily(d.font) ? d.font : 'default', // an unknown font -> TV default
|
|
98
98
|
skip: skipWords(d.skip), // lines with one of these aren't shown (none by default: see player-subs' skipLines)
|
|
99
99
|
second: typeof d.second === 'string' && /^[a-z]{2,3}$/.test(d.second) ? d.second : 'off', // a second subtitle at the top (player-subs; Off by default)
|
|
100
|
-
only: d.only === 'on' ? 'on' : 'off'
|
|
100
|
+
only: d.only === 'on' ? 'on' : 'off', // the subtitle menu: only your languages (player-subs' langMenu; Off by default)
|
|
101
|
+
fileColors: d.fileColors === 'on' ? 'on' : 'off' }; // a file's own colors (ASS, <font color>) instead of yours (player-subs' drawCues; Off by default)
|
|
101
102
|
}
|
|
102
103
|
// Settings › Subtitles › Skip lines with: words (or bits, ".srt"), capitals or not; at most 20.
|
|
103
104
|
function skipWords(x) {
|
|
@@ -261,7 +262,11 @@
|
|
|
261
262
|
buffer: d.buffer === 'more' || d.buffer === 'most' ? d.buffer : 'normal',
|
|
262
263
|
reconnect: d.reconnect === 'off' || d.reconnect === 'always' ? d.reconnect : 'few',
|
|
263
264
|
phone: d.phone === 'infuse' || d.phone === 'link' ? d.phone : 'vlc', // (Continue on phone: what the QR opens)
|
|
264
|
-
hls: d.hls === 'headers' || d.hls === 'all' ? d.hls : 'off'
|
|
265
|
+
hls: d.hls === 'headers' || d.hls === 'all' ? d.hls : 'off', // (HLS through StremioK's service: see player-core's viaService)
|
|
266
|
+
// (the file's details read from its start: player-core's fileInfoAsk. A USB drive's by
|
|
267
|
+
// default, read off the drive itself; a link's or a network folder's are more requests
|
|
268
|
+
// as it starts, so only when chosen)
|
|
269
|
+
fileInfo: d.fileInfo === 'all' || d.fileInfo === 'off' ? d.fileInfo : 'usb' };
|
|
265
270
|
}
|
|
266
271
|
function setPlayerCfg(cfg) { // (what's given changes; the rest stays)
|
|
267
272
|
var d = U.store.get(PLAYERCFG_KEY, {}) || {};
|