@krx3d/tizentube2 1.30.690 → 1.30.700

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@krx3d/tizentube2",
3
3
  "appName": "TizenTube",
4
- "version": "1.30.690",
4
+ "version": "1.30.700",
5
5
  "description": "TizenTube is an ad-free and sponsor-free solution for your favourite streaming website on your Tizen (Samsung) TVs.",
6
6
  "packageType": "mods",
7
7
  "websiteURL": "https://youtube.com/tv?additionalDataUrl=http%3A%2F%2Flocalhost%3A8085%2Fdial%2Fapps%2FYouTube",
@@ -343,6 +343,8 @@
343
343
  try {
344
344
  var el = document.getElementById('tt-status');
345
345
  if (!el) return;
346
+ // null clears it, which is how a wait that ended removes its
347
+ // own line instead of leaving a number frozen on screen.
346
348
  if (!key) { el.textContent = ''; return; }
347
349
  var lang = String(navigator.language || 'en').toLowerCase().indexOf('de') === 0 ? 'de' : 'en';
348
350
  el.textContent = STATUS_TEXT[lang][key].replace('{s}', String(seconds || 0));
@@ -383,29 +385,66 @@
383
385
  }
384
386
  }
385
387
 
388
+ // How long a wait has to last before it is worth putting on screen.
389
+ //
390
+ // Reported: a network label with "0s" appeared on every start and on
391
+ // every resume, and never showed anything but 0s. Both halves were one
392
+ // mistake of mine — the early return below went missing when the DNS
393
+ // probe was added, so every start entered this wait, announced itself,
394
+ // and then handed over a moment later with the counter never having
395
+ // been updated.
396
+ //
397
+ // Nothing is shown now until the wait has actually lasted, and while
398
+ // it lasts the number is ticked every second rather than only when an
399
+ // attempt happens to end.
400
+ var STATUS_AFTER_MS = 2000;
401
+ var statusTicker = null;
402
+
403
+ function stopStatusTicker() {
404
+ if (statusTicker === null) return;
405
+ clearInterval(statusTicker);
406
+ statusTicker = null;
407
+ setStatus(null);
408
+ }
409
+
386
410
  function waitForNetworkThen(next) {
387
411
  var started = Date.now();
388
412
  var attempts = 0;
413
+ var delay = 1000;
414
+ // Set once the address answers while the name does not.
415
+ var looksLikeDns = false;
416
+
417
+ // The ordinary case: the link is there, so there is nothing to
418
+ // wait for, nothing to say, and nothing to probe. Deliberately
419
+ // before everything else — a check that misbehaved on some
420
+ // firmware must not be able to slow down a normal start.
421
+ if (navigator.onLine !== false) {
422
+ next();
423
+ return;
424
+ }
425
+
389
426
  // On screen this is "Warte auf das Netzwerk…", which is what a
390
427
  // stalled start looks like to the user, so the trail says whether
391
428
  // it was waiting and for how long.
392
429
  breadcrumb('network-wait');
393
- var delay = 1000;
394
- // Set once the address answers while the name does not.
395
- var looksLikeDns = false;
396
430
  sendLog('INFO', 'Started offline, waiting for the network before loading YouTube');
397
- setStatus('waiting', 0);
431
+ statusTicker = setInterval(function () {
432
+ var waited = Date.now() - started;
433
+ if (waited < STATUS_AFTER_MS) return;
434
+ setStatus(looksLikeDns ? 'dns' : 'waiting', Math.round(waited / 1000));
435
+ }, 1000);
398
436
 
399
437
  function retry(reason) {
400
438
  if (Date.now() - started >= NETWORK_WAIT_MAX_MS) {
401
439
  // Past this point waiting further is not helping; proceed and
402
440
  // let the existing paths do what they did before this check.
403
441
  sendLog('ERROR', 'Network still not ready after ' + (Date.now() - started) + 'ms (' + reason + '), continuing anyway');
442
+ clearInterval(statusTicker);
443
+ statusTicker = null;
404
444
  setStatus('continuing');
405
445
  next();
406
446
  return;
407
447
  }
408
- setStatus(looksLikeDns ? 'dns' : 'waiting', Math.round((Date.now() - started) / 1000));
409
448
  if (attempts === 1 || attempts % 5 === 0) {
410
449
  sendLog('INFO', 'Waiting for network (' + reason + ', attempt ' + attempts + ')');
411
450
  // Asked once the name probe has failed, and only then: on a
@@ -457,6 +496,7 @@
457
496
  clearTimeout(timer);
458
497
  sendLog('INFO', 'Network ready after ' + (Date.now() - started) + 'ms, ' + attempts + ' check(s)');
459
498
  breadcrumb('network-ready', Date.now() - started);
499
+ stopStatusTicker();
460
500
  next();
461
501
  })
462
502
  .catch(function (e) {