@krx3d/tizentube2 1.30.660 → 1.30.680

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.660",
4
+ "version": "1.30.680",
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",
@@ -329,11 +329,13 @@
329
329
  var STATUS_TEXT = {
330
330
  en: {
331
331
  waiting: 'Waiting for the network\u2026 ({s}s)',
332
- continuing: 'Still no network, starting anyway\u2026'
332
+ continuing: 'Still no network, starting anyway\u2026',
333
+ dns: 'Network is up but names cannot be resolved (DNS). Waiting\u2026 ({s}s)'
333
334
  },
334
335
  de: {
335
336
  waiting: 'Warte auf das Netzwerk\u2026 ({s}s)',
336
- continuing: 'Immer noch kein Netzwerk, starte trotzdem\u2026'
337
+ continuing: 'Immer noch kein Netzwerk, starte trotzdem\u2026',
338
+ dns: 'Netzwerk da, aber Namen k\u00f6nnen nicht aufgel\u00f6st werden (DNS). Warte\u2026 ({s}s)'
337
339
  }
338
340
  };
339
341
 
@@ -347,6 +349,40 @@
347
349
  } catch (e) { }
348
350
  }
349
351
 
352
+ // Whether the link is up but names cannot be resolved.
353
+ //
354
+ // Captured on the 6.5: a video froze with its buffer drained to zero
355
+ // while the page itself kept running, every page then failed, and a
356
+ // restart landed on the webview's own error page reading
357
+ // ERR_NAME_NOT_RESOLVED with an untranslated Tizen string id. The TV
358
+ // had lost DNS. navigator.onLine stays true for that — the link is
359
+ // there — so the check below was skipped and this page handed over to
360
+ // YouTube, which could only fail.
361
+ //
362
+ // An address needs no resolving, so a probe to one tells the two apart:
363
+ // if the IP answers and the name does not, it is DNS, and that has a
364
+ // specific remedy (a static DNS server on the TV or in the router)
365
+ // which "no network" does not.
366
+ var DNS_PROBE_URL = 'http://1.1.1.1/';
367
+ var DNS_PROBE_TIMEOUT_MS = 3000;
368
+
369
+ function probeByAddress(whenDone) {
370
+ var settled = false;
371
+ function finish(reachable) {
372
+ if (settled) return;
373
+ settled = true;
374
+ whenDone(reachable);
375
+ }
376
+ try {
377
+ var timer = setTimeout(function () { finish(false); }, DNS_PROBE_TIMEOUT_MS);
378
+ fetch(DNS_PROBE_URL, { mode: 'no-cors', cache: 'no-store' })
379
+ .then(function () { clearTimeout(timer); finish(true); })
380
+ .catch(function () { clearTimeout(timer); finish(false); });
381
+ } catch (e) {
382
+ finish(false);
383
+ }
384
+ }
385
+
350
386
  function waitForNetworkThen(next) {
351
387
  var started = Date.now();
352
388
  var attempts = 0;
@@ -355,11 +391,8 @@
355
391
  // it was waiting and for how long.
356
392
  breadcrumb('network-wait');
357
393
  var delay = 1000;
358
-
359
- if (navigator.onLine !== false) {
360
- next();
361
- return;
362
- }
394
+ // Set once the address answers while the name does not.
395
+ var looksLikeDns = false;
363
396
  sendLog('INFO', 'Started offline, waiting for the network before loading YouTube');
364
397
  setStatus('waiting', 0);
365
398
 
@@ -372,9 +405,19 @@
372
405
  next();
373
406
  return;
374
407
  }
375
- setStatus('waiting', Math.round((Date.now() - started) / 1000));
408
+ setStatus(looksLikeDns ? 'dns' : 'waiting', Math.round((Date.now() - started) / 1000));
376
409
  if (attempts === 1 || attempts % 5 === 0) {
377
410
  sendLog('INFO', 'Waiting for network (' + reason + ', attempt ' + attempts + ')');
411
+ // Asked once the name probe has failed, and only then: on a
412
+ // normal start nothing here runs at all.
413
+ probeByAddress(function (reachable) {
414
+ if (!reachable || looksLikeDns) return;
415
+ looksLikeDns = true;
416
+ breadcrumb('dns-failure');
417
+ sendLog('ERROR', 'The network is up (' + DNS_PROBE_URL + ' answered) but names cannot be resolved. '
418
+ + 'This is DNS, not connectivity: the player starves as its segment hosts stop resolving, and a '
419
+ + 'restart lands on ERR_NAME_NOT_RESOLVED. Set a static DNS server on the TV or in the router.');
420
+ });
378
421
  }
379
422
  // Whichever comes first — the delay or the link coming back —
380
423
  // runs the next attempt, and cancels the other. Leaving the