stremiok 2.3.4 → 2.3.6

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +14 -13
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +43 -40
  6. package/js/app.js +3 -3
  7. package/js/downloads.js +16 -16
  8. package/js/epg.js +2 -3
  9. package/js/hubpreview.js +1 -1
  10. package/js/i18n.js +108 -0
  11. package/js/iptv.js +13 -13
  12. package/js/jellyfin.js +19 -19
  13. package/js/lang/ar.js +1972 -0
  14. package/js/lang/de.js +1972 -0
  15. package/js/lang/es.js +1972 -0
  16. package/js/lang/fi.js +1972 -0
  17. package/js/lang/fr.js +1972 -0
  18. package/js/lang/he.js +1972 -0
  19. package/js/lang/hi.js +1972 -0
  20. package/js/lang/it.js +1972 -0
  21. package/js/lang/ja.js +1972 -0
  22. package/js/lang/ko.js +1972 -0
  23. package/js/lang/languages.js +21 -0
  24. package/js/lang/pl.js +1972 -0
  25. package/js/lang/pt-BR.js +1972 -0
  26. package/js/lang/ru.js +1972 -0
  27. package/js/lang/tr.js +1972 -0
  28. package/js/lang/zh-CN.js +1972 -0
  29. package/js/local.js +9 -9
  30. package/js/netfolders.js +13 -13
  31. package/js/player-audio.js +17 -17
  32. package/js/player-controls.js +100 -100
  33. package/js/player-core.js +90 -58
  34. package/js/player-lang.js +22 -22
  35. package/js/player-quality.js +15 -15
  36. package/js/player-store.js +13 -13
  37. package/js/player-subs.js +69 -69
  38. package/js/plex.js +11 -11
  39. package/js/plugins.js +270 -0
  40. package/js/stremio-account.js +8 -8
  41. package/js/stremio-sync.js +5 -5
  42. package/js/stremio.js +81 -78
  43. package/js/stvod.js +4 -4
  44. package/js/trakt.js +23 -23
  45. package/js/tvapps.js +4 -4
  46. package/js/util.js +48 -27
  47. package/js/vendor/quickjs/LICENSES.md +412 -0
  48. package/js/vendor/quickjs/crypto-js.js +6659 -0
  49. package/js/vendor/quickjs/plugin-worker-legacy.js +1364 -0
  50. package/js/vendor/quickjs/plugin-worker.js +8774 -0
  51. package/js/vendor/quickjs/quickjs.wasm +0 -0
  52. package/js/view-core.js +93 -93
  53. package/js/view-detail.js +132 -130
  54. package/js/view-discover.js +27 -27
  55. package/js/view-guide.js +13 -13
  56. package/js/view-home.js +124 -118
  57. package/js/view-search.js +25 -25
  58. package/js/view-settings.js +743 -643
  59. package/js/xtvod.js +2 -2
  60. package/js/youtube.js +17 -17
  61. package/js/ytplay.js +39 -9
  62. package/package.json +1 -1
  63. package/service/index.js +227 -13
  64. package/tizenbrew.html +1 -1
package/js/player-core.js CHANGED
@@ -148,7 +148,7 @@ var PlayerParts = {};
148
148
  applyAspect(true);
149
149
  } catch (e) {
150
150
  U.log('player', 'The TV\'s player couldn\'t be restored after the background: opening the stream again');
151
- reopen('Opening the stream again…');
151
+ reopen(U.t('Opening the stream again…'));
152
152
  return;
153
153
  }
154
154
  }
@@ -230,7 +230,7 @@ var PlayerParts = {};
230
230
  }
231
231
  function chapterLabel(i) {
232
232
  var list = chapters(), c = list[i];
233
- return c ? (i + 1) + '/' + list.length + ' · ' + (c.title || 'Chapter ' + (i + 1)) : '';
233
+ return c ? (i + 1) + '/' + list.length + ' · ' + (c.title || U.t('Chapter {n}', { n: i + 1 })) : '';
234
234
  }
235
235
  // A gap in the bar where each chapter starts (but the first), as on YouTube; redrawn
236
236
  // only when the chapters or the length change.
@@ -332,12 +332,12 @@ var PlayerParts = {};
332
332
  var t = Date.now() / 1000;
333
333
  U.byId('osd-bar').style.display = '';
334
334
  U.byId('osd-progress').style.width = Math.max(0, Math.min(100, Math.round((t - g.now.start) / (g.now.stop - g.now.start) * 100))) + '%';
335
- cur.textContent = '● LIVE ' + clock(g.now.start) + '–' + clock(g.now.stop) + ' ' + g.now.title;
336
- U.byId('osd-dur').textContent = g.next ? 'Next ' + clock(g.next.start) + ' ' + g.next.title : '';
335
+ cur.textContent = '● ' + U.t('LIVE') + ' ' + clock(g.now.start) + '–' + clock(g.now.stop) + ' ' + g.now.title;
336
+ U.byId('osd-dur').textContent = g.next ? U.t('Next') + ' ' + clock(g.next.start) + ' ' + g.next.title : '';
337
337
  return;
338
338
  }
339
339
  U.byId('osd-bar').style.display = 'none';
340
- cur.textContent = '● LIVE';
340
+ cur.textContent = U.t('● LIVE');
341
341
  U.byId('osd-dur').textContent = '';
342
342
  return;
343
343
  }
@@ -391,7 +391,7 @@ var PlayerParts = {};
391
391
  Object.keys(old).forEach(function (k) { if (!/^_(relay|relayFor|relayCc|ccOffer|liveChecked)$/.test(k)) { ctx[k] = old[k]; } });
392
392
  ctx.switching = true;
393
393
  play(ctx, _onExit);
394
- U.spinner(true, 'Opening it as ' + (fmt === 'hls' ? 'HLS' : 'MPEG-TS') + '…');
394
+ U.spinner(true, U.t('Opening it as {format}…', { format: fmt === 'hls' ? 'HLS' : 'MPEG-TS' }));
395
395
  }
396
396
  P.liveFormat = function () { return S.active && S.ctx && S.isLive && S.ctx._ownUrl ? liveFormat(S.ctx.url) : ''; };
397
397
  P.setLiveFormat = setLiveFormat;
@@ -436,7 +436,7 @@ var PlayerParts = {};
436
436
  // (private viewing, a link played as it is, or one started from a private playback —
437
437
  // a video followed from it, another source: nothing recorded, see player-store)
438
438
  ctx.private = !ctx.trailer && (ctx.private === true || !!ctx.link || isPrivate());
439
- if (ctx.private && !ctx.switching) { U.toast('Private viewing: not tracked', 2500); }
439
+ if (ctx.private && !ctx.switching) { U.toast(U.t('Private viewing: not tracked'), 2500); }
440
440
  if (_exitTimer) { clearTimeout(_exitTimer); _exitTimer = null; }
441
441
  if (U.crumb) { U.crumb('play ' + (ctx.type || '') + ' ' + (ctx.private ? '(private)' : /^file:/i.test(ctx.url || '') ? 'file .' + ('' + ctx.url).split('.').pop() : ('' + (ctx.url || '')).replace(/^https?:\/\/([^\/?#]+).*$/i, '$1'))); } // (Diagnostics, after an unexpected close)
442
442
  S.active = true; S.cur = 0; S.dur = 0; _bg = null; S.actual = null;
@@ -450,7 +450,7 @@ var PlayerParts = {};
450
450
  var jfAt = Jellyfin.resumeFor(ctx.stream._jf, P.progressFor ? P.progressFor(ctx.type, ctx.id) : null, S.ctx.resumeSec);
451
451
  if (jfAt !== S.ctx.resumeSec) {
452
452
  S.ctx.resumeSec = jfAt;
453
- if (jfAt > 5) { U.toast('Carrying on from where ' + (Jellyfin.sourceKind ? Jellyfin.sourceKind(ctx.stream._jf) : 'Jellyfin') + ' had it: ' + U.fmtTime(jfAt), 3500); }
453
+ if (jfAt > 5) { U.toast(U.t('Carrying on from where {server} had it: {at}', { server: Jellyfin.sourceKind ? Jellyfin.sourceKind(ctx.stream._jf) : 'Jellyfin', at: U.fmtTime(jfAt) }), 3500); }
454
454
  }
455
455
  }
456
456
 
@@ -470,23 +470,26 @@ var PlayerParts = {};
470
470
  document.body.style.background = 'transparent';
471
471
  showOSD(true);
472
472
  renderOSD(); // show the NEW title immediately (not the previous item's)
473
- U.spinner(true, ctx.switching ? 'Switching source…' : ctx.initialQualityHeight ? 'Opening stream at ' + ctx.initialQualityHeight + 'p…' : 'Opening stream…');
473
+ U.spinner(true, ctx.switching ? U.t('Switching source…') : ctx.initialQualityHeight ? U.t('Opening stream at {height}p…', { height: ctx.initialQualityHeight }) : U.t('Opening stream…'));
474
474
 
475
475
  engineFor(ctx); // (the TV's player, or a ClearKey channel's own: see startShaka)
476
476
  // (a TorrServer torrent that doesn't say which of its files: its file list asked for first)
477
- var go = function () { if (useAV) { startLive(ctx, settle); } else { startHTML5(ctx.url); } };
477
+ var go = function () {
478
+ if (fileViaService(ctx)) { startFileRelay(ctx, settle); return; }
479
+ if (useAV) { startLive(ctx, settle); } else { startHTML5(ctx.url); }
480
+ };
478
481
  if (ctx.stream && ctx.stream._pickFile && typeof Stremio !== 'undefined' && Stremio.torrentFile) {
479
482
  // (the source before stopped first: its callbacks are about it, not this one)
480
483
  ++_playToken; _openedAt = 0;
481
484
  if (useAV) { try { avplay.stop(); } catch (e0) {} try { avplay.close(); } catch (e1) {} }
482
485
  else if (S.videoEl) { try { S.videoEl.pause(); S.videoEl.removeAttribute('src'); } catch (e2) {} }
483
- U.spinner(true, 'Asking your streaming server for the torrent’s files…');
486
+ U.spinner(true, U.t('Asking your streaming server for the torrent’s files…'));
484
487
  var ep = /:(\d+):(\d+)$/.exec(ctx.id || ''), look = _fileLook = U.cancelToken();
485
488
  Stremio.torrentFile(ctx.stream, ep ? +ep[1] : 0, ep ? +ep[2] : 0, look).then(function (url) {
486
489
  if (look.cancelled || S.ctx !== ctx || !S.active) { return; }
487
490
  _fileLook = null;
488
491
  if (url) { ctx.url = url; go(); return; }
489
- var why = 'The torrent has no file for S' + ep[1] + 'E' + ep[2]; // (another episode isn't played in its place)
492
+ var why = U.t('The torrent has no file for {ep}', { ep: 'S' + ep[1] + 'E' + ep[2] }); // (another episode isn't played in its place)
490
493
  U.log('player', why);
491
494
  U.spinner(false);
492
495
  if (nextSourceOnFail({ text: why })) { return; }
@@ -523,7 +526,7 @@ var PlayerParts = {};
523
526
  .filter(function (g) { return g.mode !== 'off'; });
524
527
  S.sponsor = segs;
525
528
  var whole = segs.filter(function (g) { return g.action === 'full'; })[0];
526
- if (whole) { U.toast('SponsorBlock: this whole video is marked “' + YouTube.SB_NAMES[whole.cat] + '”', 5000); }
529
+ if (whole) { U.toast(U.t('SponsorBlock: this whole video is marked “{what}”', { what: YouTube.SB_NAMES[whole.cat] }), 5000); }
527
530
  if (!osdHidden()) { renderOSD(); }
528
531
  }, function () {});
529
532
  }
@@ -592,8 +595,8 @@ var PlayerParts = {};
592
595
  }
593
596
 
594
597
  function updateHint() {
595
- var base = S.isLive ? 'OK: Play/Pause' : 'OK: Play/Pause ←/→: Seek';
596
- base += ' UP: Controls DOWN: Menu RETURN: Back';
598
+ var base = S.isLive ? U.t('OK: Play/Pause') : U.t('OK: Play/Pause ←/→: Seek');
599
+ base += ' ' + U.t('UP: Controls DOWN: Menu RETURN: Back');
597
600
  var h = U.byId('osd-hint');
598
601
  if (h) { h.textContent = base; }
599
602
  }
@@ -698,7 +701,7 @@ var PlayerParts = {};
698
701
  function drmEvent(drm, data, token) {
699
702
  if (!drm || drm.sys !== 'widevine' || !data || data.name !== 'Challenge' || !data.challenge) { return; }
700
703
  var ctx = S.ctx;
701
- if (typeof YTPlay === 'undefined' || !YTPlay.drmLicense) { ctx._drmWhy = 'StremioK’s service isn’t there'; return; }
704
+ if (typeof YTPlay === 'undefined' || !YTPlay.drmLicense) { ctx._drmWhy = U.t('StremioK’s service isn’t there'); return; }
702
705
  YTPlay.drmLicense(drm.url, drm.h, data.challenge, drm.b64).then(function (r) {
703
706
  if (!S.active || token !== _playToken) { return; }
704
707
  if (!r || !r.license) { throw new Error((r && r.why) || 'no answer'); }
@@ -709,14 +712,14 @@ var PlayerParts = {};
709
712
  U.log('player', 'DRM: no license for this channel (' + ctx._drmWhy + ')');
710
713
  });
711
714
  }
712
- function drmName(d) { return { clearkey: 'ClearKey', widevine: 'Widevine', playready: 'PlayReady' }[d.sys] || 'its DRM'; }
715
+ function drmName(d) { return { clearkey: 'ClearKey', widevine: 'Widevine', playready: 'PlayReady' }[d.sys] || U.t('its DRM'); }
713
716
  var BUFFERS = { more: [8, 10], most: [15, 20] };
714
717
  function openAV(url, token) {
715
718
  var drm = S.ctx && S.ctx.stream && S.ctx.stream._drm;
716
719
  if (drm && !drm.ok) { // (ClearKey, or a license StremioK can't ask for)
717
720
  U.log('player', 'Not played: ' + drmName(drm) + (drm.sys === 'clearkey' ? '' : ' without a license server StremioK can use') + ' (' + where(url) + ')');
718
721
  U.spinner(false);
719
- failedStart(drm.sys === 'clearkey' ? 'This ClearKey channel’s keys can’t be read (its playlist’s #KODIPROP lines)' : 'This channel’s DRM can’t be played on the TV (' + drmName(drm) + ')');
722
+ failedStart(drm.sys === 'clearkey' ? U.t('This ClearKey channel’s keys can’t be read (its playlist’s #KODIPROP lines)') : U.t('This channel’s DRM can’t be played on the TV ({drm})', { drm: drmName(drm) }));
720
723
  return;
721
724
  }
722
725
  try {
@@ -741,7 +744,7 @@ var PlayerParts = {};
741
744
  avplay.setListener({
742
745
  onbufferingstart: function () {
743
746
  if (!S.active || token !== _playToken) { return; }
744
- S.buffering = true; U.spinner(true, S.playStarted ? 'Buffering…' : undefined);
747
+ S.buffering = true; U.spinner(true, S.playStarted ? U.t('Buffering…') : undefined);
745
748
  },
746
749
  onbufferingcomplete: function () {
747
750
  if (!S.active || token !== _playToken) { return; }
@@ -789,13 +792,13 @@ var PlayerParts = {};
789
792
  // A live channel that played: its connection dropped → opened again (liveDropped).
790
793
  if (S.playing && liveReconnects()) { U.log('player', 'Playback error: ' + err + ' (' + where(S.ctx.url) + ')'); liveDropped('Connection lost'); return; }
791
794
  // A reconnect's try that didn't play → the next try.
792
- if (!S.playing && _reco.tries) { if (!relayFailed()) { liveDropped('Couldn’t reconnect'); } return; }
795
+ if (!S.playing && _reco.tries) { if (!relayFailed()) { liveDropped(U.t('Couldn’t reconnect')); } return; }
793
796
  // Failed before it ever played (opened, maybe, but nothing shown) → retry / step down / Auto.
794
797
  if (!S.playing && (relayFailed() || tryFallback())) { return; }
795
798
  reportStart(false, err); // (unless it had already played)
796
799
  U.log('player', 'Playback error: ' + err + ' (' + where(S.ctx && S.ctx.url) + ')');
797
- if (!S.playing) { failedStart('Playback error: ' + err); return; }
798
- U.toast('Playback error: ' + err);
800
+ if (!S.playing) { failedStart(U.t('Playback error: {why}', { why: err })); return; }
801
+ U.toast(U.t('Playback error: {why}', { why: err }));
799
802
  exitLater();
800
803
  }
801
804
  });
@@ -830,17 +833,17 @@ var PlayerParts = {};
830
833
  if (!S.active || token !== _playToken) { return; }
831
834
  U.spinner(false);
832
835
  if (relayFailed()) { return; }
833
- if (_reco.tries) { liveDropped('Couldn’t reconnect'); return; } // (a reconnect's try: the next one)
836
+ if (_reco.tries) { liveDropped(U.t('Couldn’t reconnect')); return; } // (a reconnect's try: the next one)
834
837
  // Prepare failed → retry / step down / Auto.
835
838
  if (tryFallback()) { return; }
836
839
  U.log('player', 'Could not open: ' + (err && (err.name || err.message || err)) + ' (' + where(url) + ')');
837
840
  reportStart(false, err && (err.name || err.message || err));
838
- failedStart(S.ctx && S.ctx._drmWhy ? 'No license for this channel: ' + S.ctx._drmWhy : 'Could not open stream');
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'));
839
842
  });
840
843
  } catch (e) {
841
844
  U.log('player', 'AVPlay failed: ' + (e && e.message));
842
845
  reportStart(false, e && e.message);
843
- U.spinner(false); U.toast('AVPlay failed: ' + e.message); exitLater();
846
+ U.spinner(false); U.toast(U.t('AVPlay failed: {why}', { why: e.message })); exitLater();
844
847
  }
845
848
  }
846
849
  // What a log entry names: the link, or, playing privately, nothing that says what.
@@ -922,7 +925,7 @@ var PlayerParts = {};
922
925
  function shakaLoadInto(url, drm, token, fail) {
923
926
  loadShaka().then(function () {
924
927
  if (!S.active || token !== _playToken) { return; }
925
- if (typeof shaka === 'undefined' || !shaka.Player.isBrowserSupported()) { throw new Error('this TV’s browser can’t play it'); }
928
+ if (typeof shaka === 'undefined' || !shaka.Player.isBrowserSupported()) { throw new Error(U.t('this TV’s browser can’t play it')); }
926
929
  return shakaStop().then(function () {
927
930
  if (!S.active || token !== _playToken) { return; }
928
931
  var pl = _shakaPl = new shaka.Player(), cfg = { streaming: { bufferingGoal: 10 } };
@@ -944,7 +947,7 @@ var PlayerParts = {};
944
947
  });
945
948
  }).then(null, function (e) { if (S.active && token === _playToken) { fail(shakaWhy(e)); } });
946
949
  }
947
- function shakaWhy(e) { return e && e.code ? 'Shaka error ' + e.code : (e && e.message) || 'it didn’t start'; }
950
+ function shakaWhy(e) { return e && e.code ? U.t('Shaka error {code}', { code: e.code }) : (e && e.message) || U.t('it didn’t start'); }
948
951
  var HTML5_START_MS = 20000;
949
952
  function startHTML5(url) {
950
953
  url = opened(url);
@@ -956,7 +959,7 @@ var PlayerParts = {};
956
959
  reportStart(false, 'TIMEOUT');
957
960
  U.spinner(false);
958
961
  if (!drm) { U.log('player', 'Not played (the page’s video player): no start in ' + Math.round(HTML5_START_MS / 1000) + ' s (' + where(url) + ')'); }
959
- U.toast('This stream didn\'t start'); exitLater();
962
+ U.toast(U.t('This stream didn\'t start')); exitLater();
960
963
  }, drm ? SHAKA_START_MS : HTML5_START_MS);
961
964
  S.videoEl.onloadedmetadata = function () {
962
965
  if (!S.active || token !== _playToken) { return; }
@@ -984,14 +987,14 @@ var PlayerParts = {};
984
987
  // (the page's player says little: its code, and a message where the engine has one)
985
988
  U.log('player', (loaded ? 'Stopped' : 'Not played') + ' (the page’s video player): ' + (['', 'aborted', 'a network error', 'the file couldn’t be decoded', 'a format or link it can’t play'][mcode] || 'an error') +
986
989
  (me && me.message ? ' (' + me.message + ')' : '') + ' (' + where(url) + ')');
987
- U.toast('Playback error'); exitLater();
990
+ U.toast(U.t('Playback error')); exitLater();
988
991
  };
989
992
  if (drm) {
990
993
  shakaLoadInto(url, drm, token, function (why) {
991
994
  if (loaded) { U.log('player', 'ClearKey channel: ' + why); U.toast('Playback error: ' + why); exitLater(); return; }
992
995
  U.log('player', 'ClearKey channel didn’t play (' + why + ')');
993
996
  U.spinner(false);
994
- failedStart('This ClearKey channel didn’t play (' + why + ')');
997
+ failedStart(U.t('This ClearKey channel didn’t play ({why})', { why: why }));
995
998
  });
996
999
  } else {
997
1000
  var p = S.videoEl.play();
@@ -1020,9 +1023,9 @@ var PlayerParts = {};
1020
1023
  }
1021
1024
  function onEnded() {
1022
1025
  // a live channel whose stream ended (its server stopped it): opened again (liveDropped)
1023
- if (liveReconnects()) { liveDropped('The stream ended'); return; }
1026
+ if (liveReconnects()) { liveDropped(U.t('The stream ended')); return; }
1024
1027
  if (isNotice()) { // (back to its sources: another one, or this one later)
1025
- U.toast('That source isn\'t ready yet (the debrid service is still getting it): try another, or this one later', 6000);
1028
+ U.toast(U.t('That source isn\'t ready yet (the debrid service is still getting it): try another, or this one later'), 6000);
1026
1029
  exit();
1027
1030
  return;
1028
1031
  }
@@ -1110,9 +1113,9 @@ var PlayerParts = {};
1110
1113
  var name = YouTube.SB_NAMES[g.cat] || 'section';
1111
1114
  if (g.mode === 'skip') {
1112
1115
  seekTo(g.end);
1113
- U.toast('Skipped: ' + name + ' (' + U.fmtTime(g.end - g.start) + ')', 3000);
1116
+ U.toast(U.t('Skipped: {what} ({length})', { what: name, length: U.fmtTime(g.end - g.start) }), 3000);
1114
1117
  } else {
1115
- showSkip('sb', { end: g.end, label: 'Skip ' + name });
1118
+ showSkip('sb', { end: g.end, label: U.t('Skip {what}', { what: name }) });
1116
1119
  }
1117
1120
  return;
1118
1121
  }
@@ -1183,7 +1186,7 @@ var PlayerParts = {};
1183
1186
  }
1184
1187
 
1185
1188
  function seekTo(sec) {
1186
- if (S.isLive) { showOSD(false); U.toast('Live — seeking unavailable', 1500); return; }
1189
+ if (S.isLive) { showOSD(false); U.toast(U.t('Live — seeking unavailable'), 1500); return; }
1187
1190
  // keep a small margin from the very end (seeking to EOF can error)
1188
1191
  var maxT = S.dur ? Math.max(0, S.dur - 2) : 1e9;
1189
1192
  var target = Math.max(0, Math.min(maxT, sec));
@@ -1256,7 +1259,8 @@ var PlayerParts = {};
1256
1259
  try { n = c.nextSource(tried, c._avoid || []); } catch (e) { n = null; }
1257
1260
  if (!n || !n.source || !n.source.url) { return false; }
1258
1261
  c._tried = tried; // (kept by the next one: not a source's own field)
1259
- var msg = (notice ? notice.text + ' · trying' : 'Didn’t start: trying') + ' the next source (' + (tried.length + 1) + ' of ' + Math.min(n.total, NEXT_TRIES + 1) + ')…';
1262
+ var next = { n: tried.length + 1, of: Math.min(n.total, NEXT_TRIES + 1) };
1263
+ var msg = notice ? notice.text + ' · ' + U.t('trying the next source ({n} of {of})…', next) : U.t('Didn’t start: trying the next source ({n} of {of})…', next);
1260
1264
  U.log('player', 'Source didn’t start: trying the next one (' + (tried.length + 1) + ')');
1261
1265
  replaceSource(n.source, true);
1262
1266
  U.spinner(true, msg); U.toast(msg, notice ? 7000 : 4000);
@@ -1271,7 +1275,7 @@ var PlayerParts = {};
1271
1275
  var u = (typeof Stremio !== 'undefined' && Stremio.convertUrl) ? Stremio.convertUrl(c.url) : null;
1272
1276
  if (!u) { return false; }
1273
1277
  c._converted = true; c._convertedFrom = c.url; // (kept by what replaces it: Continue Watching saves its own link)
1274
- var msg = 'Didn’t start: converting it on your streaming server…';
1278
+ var msg = U.t('Didn’t start: converting it on your streaming server…');
1275
1279
  U.log('player', 'Source didn’t start: converting it on the streaming server');
1276
1280
  replaceSource({ url: u, stream: c.stream, subExtra: c.subExtra, sourceSubs: c.sourceSubs, localSubs: c.localSubs, converted: true }, true);
1277
1281
  U.spinner(true, msg); U.toast(msg, 5000);
@@ -1318,13 +1322,14 @@ var PlayerParts = {};
1318
1322
  }
1319
1323
  function describeNotice(kind, st) {
1320
1324
  var d = (typeof Stremio !== 'undefined' && Stremio.debridOf) ? Stremio.debridOf(st) : null;
1321
- var svc = d ? d.name : 'The debrid service', addon = st._addon || 'the addon', key = d ? d.name + ' key' : 'debrid key';
1325
+ var svc = d ? d.name : U.t('The debrid service'), addon = st._addon || U.t('the addon'), key = d ? U.t('{service} key', { service: d.name }) : U.t('debrid key');
1322
1326
  var n = { kind: kind, service: d ? d.name : '', tag: d ? d.tag : '', account: false, text: '' };
1323
- if (/access|auth|unauthorized|forbidden|premium/.test(kind)) { n.account = true; n.text = svc + ' refused access (' + addon + '): check its ' + key + ' in the addon’s settings'; }
1324
- else if (/limit|too_many|exceeded/.test(kind)) { n.account = true; n.text = svc + ': your limit is reached for now (' + addon + ')'; }
1325
- else if (/infring|blocked|dmca|removed/.test(kind)) { n.text = svc + ' won’t give this file (' + addon + '): try another source'; }
1326
- else if (/download|caching|queued/.test(kind)) { n.text = 'Still downloading on ' + svc + ' (' + addon + '): try again later'; }
1327
- else { n.text = svc + ' couldn’t give this file (' + addon + ': “' + kind.replace(/_/g, ' ') + '”)'; }
1327
+ var w = { service: svc, addon: addon, key: key, what: kind.replace(/_/g, ' ') };
1328
+ if (/access|auth|unauthorized|forbidden|premium/.test(kind)) { n.account = true; n.text = U.t('{service} refused access ({addon}): check its {key} in the addon’s settings', w); }
1329
+ else if (/limit|too_many|exceeded/.test(kind)) { n.account = true; n.text = U.t('{service}: your limit is reached for now ({addon})', w); }
1330
+ else if (/infring|blocked|dmca|removed/.test(kind)) { n.text = U.t('{service} won’t give this file ({addon}): try another source', w); }
1331
+ else if (/download|caching|queued/.test(kind)) { n.text = U.t('Still downloading on {service} ({addon}): try again later', w); }
1332
+ else { n.text = U.t('{service} couldn’t give this file ({addon}: “{what}”)', w); }
1328
1333
  return n;
1329
1334
  }
1330
1335
  // Not playing after AV_START_MS (no answer from the server, or opened and nothing shown): the
@@ -1337,12 +1342,12 @@ var PlayerParts = {};
1337
1342
  }
1338
1343
  function startCheck() {
1339
1344
  if (!S.active || S.playing || !useAV || !_openedAt || Date.now() - _openedAt < startMs()) { return; }
1340
- if (_reco.tries) { liveDropped('Couldn’t reconnect'); return; } // (a reconnect's try: the next one)
1345
+ if (_reco.tries) { liveDropped(U.t('Couldn’t reconnect')); return; } // (a reconnect's try: the next one)
1341
1346
  if (nextSourceOnFail()) { return; }
1342
1347
  if (S.playStarted && isPaused()) { return; }
1343
1348
  U.log('player', 'Didn’t start: nothing played in ' + (startMs() / 1000) + ' s (' + where(S.ctx && S.ctx.url) + ')');
1344
1349
  U.spinner(false);
1345
- U.toast('Didn’t start: nothing played in ' + (startMs() / 1000) + ' seconds. Try another source.', 6000);
1350
+ U.toast(U.t('Didn’t start: nothing played in {n} seconds. Try another source.', { n: startMs() / 1000 }), 6000);
1346
1351
  exitLater();
1347
1352
  }
1348
1353
  P.startCheck = startCheck;
@@ -1427,9 +1432,9 @@ var PlayerParts = {};
1427
1432
  var known = liveKnown(ctx.url), cc = ctx._relayCc || null, raw = !!(known && known.raw);
1428
1433
  liveKeep(ctx.url, repack, known ? ccOf(known) : null, true); // (its hls answer kept)
1429
1434
  U.log('player', 'Live sound ' + (repack ? 'repacked by StremioK\'s service' : 'straight from the server') + ': your choice for this channel');
1430
- var msg = repack ? 'Repacking this channel’s sound…' : 'Playing the sound straight from the server…';
1435
+ var msg = repack ? U.t('Repacking this channel’s sound…') : U.t('Playing the sound straight from the server…');
1431
1436
  if (!repack && !cc) { ctx._relay = null; ctx._relayFor = null; ctx._relayFix = false; reopen(msg); return; }
1432
- function failed() { if (S.ctx === ctx && S.active) { U.toast('StremioK’s service didn’t answer: the sound stays as it was', 5000); } }
1437
+ function failed() { if (S.ctx === ctx && S.active) { U.toast(U.t('StremioK’s service didn’t answer: the sound stays as it was'), 5000); } }
1433
1438
  YTPlay.liveOpen(ctx.url, ctx._headers, true, { fix: !!repack, cc: raw ? null : cc, raw: raw }).then(function (r) {
1434
1439
  if (S.ctx !== ctx || !S.active) { return; }
1435
1440
  if (!relayed(ctx, r, cc, repack)) { failed(); return; }
@@ -1461,6 +1466,33 @@ var PlayerParts = {};
1461
1466
  startAV(ctx.url, settle);
1462
1467
  }, function () { if (S.ctx === ctx && S.active) { startAV(ctx.url, settle); } });
1463
1468
  }
1469
+ // A file (not HLS) through the service's file relay (/live/file): when it needs headers the
1470
+ // TV's player can't send (Origin, Accept, Accept-Language; under TizenBrew the page's player
1471
+ // sends none), or hold OK on it (ctx.viaService). Each request goes on with its headers and the
1472
+ // player's byte range. Not YouTube, DRM, USB files or the service's own links; redirects into
1473
+ // the home network as Local-network links from internet addons says; the service not
1474
+ // answering: as it is.
1475
+ function fileViaService(ctx) {
1476
+ if (!ctx || ctx._relay || ctx.yt || ctx.trailer || ctx.localFile || (ctx.stream && ctx.stream._drm)) { return false; }
1477
+ if (typeof YTPlay === 'undefined' || !YTPlay.fileOpen || YTPlay.installMode() === 'browser') { return false; }
1478
+ var url = ctx.url || '';
1479
+ if (!/^https?:\/\//i.test(url) || /^http:\/\/(localhost|127\.0\.0\.1)[:\/]/i.test(url)) { return false; }
1480
+ if (HLS_LINK.test(url) || (ctx.formatInfo && ctx.formatInfo.container === 'hls') || /\.mpd(?:[?#]|$)/i.test(url)) { return false; }
1481
+ if (ctx.viaService) { return true; }
1482
+ var h = U.sanitizeHeaders(ctx._headers);
1483
+ return !!h && (!useAV || !!(h.origin || h.accept || h.lang));
1484
+ }
1485
+ function startFileRelay(ctx, settle) {
1486
+ var lan = typeof Stremio !== 'undefined' && Stremio.getPrefs ? !!Stremio.getPrefs().allowLocal : false;
1487
+ function go() {
1488
+ if (S.ctx !== ctx || !S.active) { return; }
1489
+ if (useAV) { startLive(ctx, settle); } else { startHTML5(ctx._relay && ctx._relayFor === ctx.url ? ctx._relay : ctx.url); }
1490
+ }
1491
+ YTPlay.fileOpen(ctx.url, U.sanitizeHeaders(ctx._headers), lan).then(function (r) {
1492
+ if (S.ctx === ctx && S.active && relayed(ctx, r, null, false)) { U.log('player', 'Through StremioK\'s service, with the source\'s headers (' + where(ctx.url) + ')'); }
1493
+ go();
1494
+ }, go);
1495
+ }
1464
1496
  function startLive(ctx, settle) {
1465
1497
  if (!ctx._relay && viaService(ctx)) { startViaService(ctx, settle); return; }
1466
1498
  var known = liveFixable(ctx) ? liveKnown(ctx.url) : null, cc = ccOf(known);
@@ -1497,10 +1529,10 @@ var PlayerParts = {};
1497
1529
  liveKeep(url, fix, cc, false, hls, !!r.raw);
1498
1530
  if (S.ctx !== ctx || !S.active || ctx.url !== url) { return; }
1499
1531
  if (cc && cc.length && !ctx._relayCc) { ctx._ccOffer = cc; }
1500
- if (cc && cc.length && ccWanted(ctx, cc)) { ccOn(ctx, 'Adding this channel’s captions…'); return; }
1532
+ if (cc && cc.length && ccWanted(ctx, cc)) { ccOn(ctx, U.t('Adding this channel’s captions…')); return; }
1501
1533
  if (known || !fix || ctx._relay || !relayed(ctx, r, null, true)) { return; } // (the sound: restarted for on its first look only)
1502
1534
  U.log('player', 'Live sound repacked by StremioK\'s service (' + (r.why || '') + ')');
1503
- reopen('Fixing this channel’s sound…');
1535
+ reopen(U.t('Fixing this channel’s sound…'));
1504
1536
  }, function () {});
1505
1537
  }
1506
1538
  // The channel again through the relay with its closed captions as subtitle tracks (the sound
@@ -1518,7 +1550,7 @@ var PlayerParts = {};
1518
1550
  return true;
1519
1551
  }, function () { return false; });
1520
1552
  }
1521
- P.ccOn = function (want) { return S.ctx ? ccOn(S.ctx, 'Adding this channel’s captions…', want) : Promise.resolve(false); };
1553
+ P.ccOn = function (want) { return S.ctx ? ccOn(S.ctx, U.t('Adding this channel’s captions…'), want) : Promise.resolve(false); };
1522
1554
  // The relay didn't start (StremioK's service gone): the channel as it is.
1523
1555
  function relayFailed() {
1524
1556
  if (S.playStarted || !S.ctx || !S.ctx._relay) { return false; }
@@ -1539,12 +1571,12 @@ var PlayerParts = {};
1539
1571
  var now = Date.now();
1540
1572
  if (S.buffering) {
1541
1573
  if (!_stall.bufSince) { _stall.bufSince = now; }
1542
- else if (now - _stall.bufSince > BUFFER_STALL_SECS * 1000) { recoverStall('Stream stopped loading'); }
1574
+ else if (now - _stall.bufSince > BUFFER_STALL_SECS * 1000) { recoverStall(U.t('Stream stopped loading')); }
1543
1575
  return;
1544
1576
  }
1545
1577
  _stall.bufSince = 0;
1546
1578
  if (isPaused() || S.cur !== _stall.t) { _stall.t = S.cur; _stall.since = now; return; }
1547
- if (_stall.since && now - _stall.since > STALL_SECS * 1000) { recoverStall('Playback stalled'); }
1579
+ if (_stall.since && now - _stall.since > STALL_SECS * 1000) { recoverStall(U.t('Playback stalled')); }
1548
1580
  }
1549
1581
  function recoverStall(why) {
1550
1582
  if (liveReconnects()) { liveDropped(why); return; }
@@ -1552,12 +1584,12 @@ var PlayerParts = {};
1552
1584
  _stall.recoveries = _stall.recoveries.filter(function (t) { return now - t < STALL_WINDOW_MS; });
1553
1585
  if (_stall.recoveries.length >= STALL_MAX) {
1554
1586
  U.spinner(false);
1555
- U.toast('This source keeps stalling — try another one', 4000);
1587
+ U.toast(U.t('This source keeps stalling — try another one'), 4000);
1556
1588
  exit();
1557
1589
  return;
1558
1590
  }
1559
1591
  _stall.recoveries.push(now);
1560
- reopen(why + ' — reloading…');
1592
+ reopen(U.t('{why} — reloading…', { why: why }));
1561
1593
  }
1562
1594
 
1563
1595
  // ---------- a live channel that drops ----------
@@ -1578,20 +1610,20 @@ var PlayerParts = {};
1578
1610
  var mode = P.playerCfg().reconnect, now = Date.now();
1579
1611
  if (mode === 'off') {
1580
1612
  U.log('player', 'Live channel: ' + why + '; reconnecting is off');
1581
- U.spinner(false); U.toast(why + ': the channel stopped (reconnecting is off)', 5000);
1613
+ U.spinner(false); U.toast(U.t('{why}: the channel stopped (reconnecting is off)', { why: why }), 5000);
1582
1614
  exitLater();
1583
1615
  return;
1584
1616
  }
1585
1617
  _stall.recoveries = _stall.recoveries.filter(function (t) { return now - t < STALL_WINDOW_MS; });
1586
1618
  if (mode !== 'always' && _stall.recoveries.length >= STALL_MAX) {
1587
1619
  U.log('player', 'Live channel: ' + why + '; dropped ' + STALL_MAX + ' times in ' + (STALL_WINDOW_MS / 60000) + ' minutes, given up');
1588
- U.spinner(false); U.toast('This channel keeps dropping — try it again later', 5000);
1620
+ U.spinner(false); U.toast(U.t('This channel keeps dropping — try it again later'), 5000);
1589
1621
  exit();
1590
1622
  return;
1591
1623
  }
1592
1624
  _stall.recoveries.push(now);
1593
1625
  var n = ++_reco.tries, wait = RECO_WAIT_S[Math.min(n - 1, RECO_WAIT_S.length - 1)] * 1000, ctx = S.ctx;
1594
- var msg = why + ' — reconnecting' + (n > 1 ? ' (try ' + n + ')' : '') + '…';
1626
+ var msg = n > 1 ? U.t('{why} — reconnecting (try {n})…', { why: why, n: n }) : U.t('{why} — reconnecting…', { why: why });
1595
1627
  U.log('player', 'Live channel: ' + why + ', reconnecting (try ' + n + (wait ? ', in ' + (wait / 1000) + ' s' : '') + ')');
1596
1628
  if (!wait) { reopen(msg); return; }
1597
1629
  U.spinner(true, msg);
@@ -1668,5 +1700,5 @@ var PlayerParts = {};
1668
1700
  P.sponsorHighlight = sponsorHighlight;
1669
1701
  P.chapters = chapters; P.chapterAt = chapterAt; P.chapterLabel = chapterLabel;
1670
1702
  P.seekTo = seekTo; P.doAVSeek = doAVSeek; P.seekBy = seekBy; P.exit = exit;
1671
- P.reload = function () { if (S.active && S.ctx) { reopen(S.isLive ? 'Reloading the channel…' : 'Reloading…'); } }; // (the menu's Reload)
1703
+ P.reload = function () { if (S.active && S.ctx) { reopen(S.isLive ? U.t('Reloading the channel…') : U.t('Reloading…')); } }; // (the menu's Reload)
1672
1704
  })(PlayerParts);
package/js/player-lang.js CHANGED
@@ -135,32 +135,32 @@
135
135
  }
136
136
 
137
137
  // Display names for language codes (the aliases above, plus other common ones).
138
- var LANG_NAMES = { eng: 'English', spa: 'Spanish', fre: 'French', ger: 'German', ita: 'Italian', por: 'Portuguese',
139
- dut: 'Dutch', rus: 'Russian', ara: 'Arabic', tur: 'Turkish', pol: 'Polish',
140
- jpn: 'Japanese', ja: 'Japanese', kor: 'Korean', ko: 'Korean', chi: 'Chinese', zho: 'Chinese', zh: 'Chinese',
141
- hin: 'Hindi', hi: 'Hindi', swe: 'Swedish', sv: 'Swedish', nor: 'Norwegian', no: 'Norwegian', nob: 'Norwegian',
142
- dan: 'Danish', da: 'Danish', fin: 'Finnish', fi: 'Finnish', gre: 'Greek', ell: 'Greek', el: 'Greek',
143
- heb: 'Hebrew', he: 'Hebrew', hun: 'Hungarian', hu: 'Hungarian', cze: 'Czech', ces: 'Czech', cs: 'Czech',
144
- rum: 'Romanian', ron: 'Romanian', ro: 'Romanian', ukr: 'Ukrainian', uk: 'Ukrainian', tha: 'Thai', th: 'Thai',
145
- vie: 'Vietnamese', vi: 'Vietnamese', ind: 'Indonesian', id: 'Indonesian', cat: 'Catalan', ca: 'Catalan',
146
- bul: 'Bulgarian', bg: 'Bulgarian', hrv: 'Croatian', hr: 'Croatian', srp: 'Serbian', sr: 'Serbian',
147
- per: 'Persian', fas: 'Persian', fa: 'Persian', slo: 'Slovak', slv: 'Slovenian', may: 'Malay', fil: 'Filipino',
148
- baq: 'Basque', glg: 'Galician', est: 'Estonian', lav: 'Latvian', lit: 'Lithuanian', ice: 'Icelandic',
149
- tam: 'Tamil', tel: 'Telugu', ben: 'Bengali', mul: 'Multiple languages', zxx: 'No language',
150
- afr: 'Afrikaans', alb: 'Albanian', arg: 'Aragonese', arm: 'Armenian', ast: 'Asturian', aze: 'Azerbaijani',
151
- bel: 'Belarusian', bos: 'Bosnian', bre: 'Breton', bur: 'Burmese', prs: 'Dari', epo: 'Esperanto', ext:
152
- 'Extremaduran', gla: 'Scottish Gaelic', geo: 'Georgian', ibo: 'Igbo', ina: 'Interlingua', gle: 'Irish', kan:
153
- 'Kannada', kaz: 'Kazakh', khm: 'Khmer', kur: 'Kurdish', ltz: 'Luxembourgish', mac: 'Macedonian', mal:
154
- 'Malayalam', mni: 'Manipuri', mar: 'Marathi', mon: 'Mongolian', mne: 'Montenegrin', nav: 'Navajo', nep:
155
- 'Nepali', sme: 'Northern Sami', oci: 'Occitan', ori: 'Odia', pan: 'Punjabi', pus: 'Pashto', sat: 'Santali',
156
- snd: 'Sindhi', sin: 'Sinhala', som: 'Somali', swa: 'Swahili', syr: 'Syriac', tat: 'Tatar', tok: 'Toki Pona',
157
- tuk: 'Turkmen', urd: 'Urdu', uzb: 'Uzbek', wel: 'Welsh',
158
- und: 'Unknown language', '': 'Unknown language' };
138
+ var LANG_NAMES = { eng: U.t('English'), spa: U.t('Spanish'), fre: U.t('French'), ger: U.t('German'), ita: U.t('Italian'), por: U.t('Portuguese'),
139
+ dut: U.t('Dutch'), rus: U.t('Russian'), ara: U.t('Arabic'), tur: U.t('Turkish'), pol: U.t('Polish'),
140
+ jpn: U.t('Japanese'), ja: U.t('Japanese'), kor: U.t('Korean'), ko: U.t('Korean'), chi: U.t('Chinese'), zho: U.t('Chinese'), zh: U.t('Chinese'),
141
+ hin: U.t('Hindi'), hi: U.t('Hindi'), swe: U.t('Swedish'), sv: U.t('Swedish'), nor: U.t('Norwegian'), no: U.t('Norwegian'), nob: U.t('Norwegian'),
142
+ dan: U.t('Danish'), da: U.t('Danish'), fin: U.t('Finnish'), fi: U.t('Finnish'), gre: U.t('Greek'), ell: U.t('Greek'), el: U.t('Greek'),
143
+ heb: U.t('Hebrew'), he: U.t('Hebrew'), hun: U.t('Hungarian'), hu: U.t('Hungarian'), cze: U.t('Czech'), ces: U.t('Czech'), cs: U.t('Czech'),
144
+ rum: U.t('Romanian'), ron: U.t('Romanian'), ro: U.t('Romanian'), ukr: U.t('Ukrainian'), uk: U.t('Ukrainian'), tha: U.t('Thai'), th: U.t('Thai'),
145
+ vie: U.t('Vietnamese'), vi: U.t('Vietnamese'), ind: U.t('Indonesian'), id: U.t('Indonesian'), cat: U.t('Catalan'), ca: U.t('Catalan'),
146
+ bul: U.t('Bulgarian'), bg: U.t('Bulgarian'), hrv: U.t('Croatian'), hr: U.t('Croatian'), srp: U.t('Serbian'), sr: U.t('Serbian'),
147
+ per: U.t('Persian'), fas: U.t('Persian'), fa: U.t('Persian'), slo: U.t('Slovak'), slv: U.t('Slovenian'), may: U.t('Malay'), fil: U.t('Filipino'),
148
+ baq: U.t('Basque'), glg: U.t('Galician'), est: U.t('Estonian'), lav: U.t('Latvian'), lit: U.t('Lithuanian'), ice: U.t('Icelandic'),
149
+ tam: U.t('Tamil'), tel: U.t('Telugu'), ben: U.t('Bengali'), mul: U.t('Multiple languages'), zxx: U.t('No language'),
150
+ afr: U.t('Afrikaans'), alb: U.t('Albanian'), arg: U.t('Aragonese'), arm: U.t('Armenian'), ast: U.t('Asturian'), aze: U.t('Azerbaijani'),
151
+ bel: U.t('Belarusian'), bos: U.t('Bosnian'), bre: U.t('Breton'), bur: U.t('Burmese'), prs: U.t('Dari'), epo: U.t('Esperanto'), ext:
152
+ U.t('Extremaduran'), gla: U.t('Scottish Gaelic'), geo: U.t('Georgian'), ibo: U.t('Igbo'), ina: U.t('Interlingua'), gle: U.t('Irish'), kan:
153
+ U.t('Kannada'), kaz: U.t('Kazakh'), khm: U.t('Khmer'), kur: U.t('Kurdish'), ltz: U.t('Luxembourgish'), mac: U.t('Macedonian'), mal:
154
+ U.t('Malayalam'), mni: U.t('Manipuri'), mar: U.t('Marathi'), mon: U.t('Mongolian'), mne: U.t('Montenegrin'), nav: U.t('Navajo'), nep:
155
+ U.t('Nepali'), sme: U.t('Northern Sami'), oci: U.t('Occitan'), ori: U.t('Odia'), pan: U.t('Punjabi'), pus: U.t('Pashto'), sat: U.t('Santali'),
156
+ snd: U.t('Sindhi'), sin: U.t('Sinhala'), som: U.t('Somali'), swa: U.t('Swahili'), syr: U.t('Syriac'), tat: U.t('Tatar'), tok: U.t('Toki Pona'),
157
+ tuk: U.t('Turkmen'), urd: U.t('Urdu'), uzb: U.t('Uzbek'), wel: U.t('Welsh'),
158
+ und: U.t('Unknown language'), '': U.t('Unknown language') };
159
159
  function langName(lang) {
160
160
  var k = langKey(lang);
161
161
  if (LANG_NAMES[k]) { return LANG_NAMES[k]; }
162
162
  var raw = ('' + (lang || '')).trim();
163
- return raw ? raw.charAt(0).toUpperCase() + raw.slice(1) : 'Unknown language';
163
+ return raw ? raw.charAt(0).toUpperCase() + raw.slice(1) : U.t('Unknown language');
164
164
  }
165
165
  // Order for language groups: current choice, then the preferred languages, then by name.
166
166
  function langRank(k, prefs) {
@@ -105,10 +105,10 @@
105
105
  _ytRetried = false; // new pick → its one-shot retry is available again
106
106
  _autoRetried = false; // ...and so is the final Auto fallback
107
107
  _userPicked = true;
108
- var label = bw == null ? 'Auto quality' : (labelForBw(bw) || 'new quality');
109
- _startNote = bw == null ? 'Playing with Auto quality' : 'Playing at ' + label;
108
+ var label = bw == null ? U.t('Auto quality') : (labelForBw(bw) || U.t('new quality'));
109
+ _startNote = bw == null ? U.t('Playing with Auto quality') : U.t('Playing at {quality}', { quality: label });
110
110
  S.ctx.resumeSec = S.isLive ? 0 : S.cur;
111
- _switchNote = message || 'Switching to ' + label + '…';
111
+ _switchNote = message || U.t('Switching to {quality}…', { quality: label });
112
112
  U.spinner(true, _switchNote);
113
113
  // YouTube: don't re-open the same (cached, now-stale) master and lean on an AVPlay cap.
114
114
  // Rebuild the proxy URL so the service serves a single-rung master (&h=) from a FRESH
@@ -134,7 +134,7 @@
134
134
  S.ctx.resumeSec = S.isLive ? 0 : S.cur;
135
135
  S.ctx.url = YTPlay.resolverUrl(S.ctx.yt, retryHeight, true, S.ctx.ytLang);
136
136
  // Right after a switch this retry is routine: keep saying "Switching to …"
137
- U.spinner(true, _switchNote || ((retryHeight ? retryHeight + 'p' : 'The stream') + ' didn\'t start — retrying…'));
137
+ U.spinner(true, _switchNote || (retryHeight ? U.t('{quality} didn\'t start — retrying…', { quality: retryHeight + 'p' }) : U.t('The stream didn\'t start — retrying…')));
138
138
  _switchNote = null;
139
139
  if (P.useAV) { startAV(S.ctx.url, true); } else { startHTML5(S.ctx.url); }
140
140
  return true;
@@ -146,7 +146,7 @@
146
146
  if (_qualityBw == null) { return false; }
147
147
  var lower = nextLowerBw(_qualityBw);
148
148
  if (lower == null) { return false; }
149
- setQuality(lower, (labelForBw(_qualityBw) || 'That quality') + ' didn\'t start — trying ' + labelForBw(lower) + '…');
149
+ setQuality(lower, U.t('{quality} didn\'t start — trying {lower}…', { quality: labelForBw(_qualityBw) || U.t('That quality'), lower: labelForBw(lower) }));
150
150
  return true;
151
151
  }
152
152
 
@@ -162,8 +162,8 @@
162
162
  S.ctx.initialQualityHeight = 0;
163
163
  S.ctx.resumeSec = S.isLive ? 0 : S.cur;
164
164
  if (S.ctx.yt && typeof YTPlay !== 'undefined') { S.ctx.url = YTPlay.resolverUrl(S.ctx.yt, 0, true, S.ctx.ytLang); }
165
- _startNote = wasAuto ? '' : 'Playing with Auto quality';
166
- U.spinner(true, wasAuto ? 'Stream didn\'t start — retrying…' : 'Retrying with Auto quality…');
165
+ _startNote = wasAuto ? '' : U.t('Playing with Auto quality');
166
+ U.spinner(true, wasAuto ? U.t('Stream didn\'t start — retrying…') : U.t('Retrying with Auto quality…'));
167
167
  if (P.useAV) { startAV(S.ctx.url); } else { startHTML5(S.ctx.url); }
168
168
  return true;
169
169
  }
@@ -289,8 +289,8 @@
289
289
  S.ctx.resumeSec = S.cur;
290
290
  var v = variantByBw(_qualityBw);
291
291
  S.ctx.url = YTPlay.resolverUrl(S.ctx.yt, v ? v.h : (S.ctx.initialQualityHeight || 0), true, lang);
292
- _switchNote = 'Switching to ' + ytLangLabel(a) + '…';
293
- _startNote = 'Audio: ' + ytLangLabel(a);
292
+ _switchNote = U.t('Switching to {quality}…', { quality: ytLangLabel(a) });
293
+ _startNote = U.t('Audio: {track}', { track: ytLangLabel(a) });
294
294
  U.spinner(true, _switchNote);
295
295
  if (P.useAV) { startAV(S.ctx.url, true); } else { startHTML5(S.ctx.url); }
296
296
  }
@@ -300,20 +300,20 @@
300
300
  var idx = 0;
301
301
  var items = list.map(function (a, i) {
302
302
  if (a === cur) { idx = i; }
303
- return { label: ytLangLabel(a), detail: a.original ? 'Original' : 'AI-dubbed by YouTube', sel: a === cur,
303
+ return { label: ytLangLabel(a), detail: a.original ? U.t('Original') : U.t('AI-dubbed by YouTube'), sel: a === cur,
304
304
  run: function () { closeMenu(); setYtLanguage(a); } };
305
305
  });
306
- return { title: 'Audio language', items: items, idx: idx };
306
+ return { title: U.t('Audio language'), items: items, idx: idx };
307
307
  }
308
308
 
309
309
  function qualityLabel() {
310
- if (_qualityBw == null) { return 'Auto'; }
310
+ if (_qualityBw == null) { return U.t('Auto'); }
311
311
  for (var i = 0; i < _variants.length; i++) { if (_variants[i].bw === _qualityBw) { return _variants[i].label; } }
312
- return 'Auto';
312
+ return U.t('Auto');
313
313
  }
314
314
 
315
315
  function qualityMenu() {
316
- var items = [{ label: 'Auto', detail: 'Adapt to bandwidth', sel: _qualityBw == null,
316
+ var items = [{ label: U.t('Auto'), detail: U.t('Adapt to bandwidth'), sel: _qualityBw == null,
317
317
  run: function () { setQuality(null); closeMenu(); } }];
318
318
  _variants.forEach(function (v) {
319
319
  items.push({ label: v.label, detail: Math.round(v.bw / 1000) + ' kbps', sel: _qualityBw === v.bw,
@@ -321,7 +321,7 @@
321
321
  });
322
322
  var idx = 0;
323
323
  for (var i = 0; i < items.length; i++) { if (items[i].sel) { idx = i; break; } }
324
- return { title: 'Video quality', items: items, idx: idx };
324
+ return { title: U.t('Video quality'), items: items, idx: idx };
325
325
  }
326
326
 
327
327
  // ----- for the other parts (and js/player.js) -----