@geekapps/silo-elements-nextjs 0.3.19 → 0.3.20

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/dist/index.js CHANGED
@@ -1585,6 +1585,68 @@ function deviceSupportsAudioCodec(codec) {
1585
1585
  return true;
1586
1586
  }
1587
1587
  }
1588
+ var LANG_NAMES = {
1589
+ pt: "Portugu\xEAs",
1590
+ "pt-br": "Portugu\xEAs (Brasil)",
1591
+ "pt-pt": "Portugu\xEAs (Portugal)",
1592
+ en: "English",
1593
+ "en-us": "English (US)",
1594
+ "en-gb": "English (UK)",
1595
+ es: "Espa\xF1ol",
1596
+ "es-419": "Espa\xF1ol (Latino)",
1597
+ fr: "Fran\xE7ais",
1598
+ de: "Deutsch",
1599
+ it: "Italiano",
1600
+ ja: "\u65E5\u672C\u8A9E",
1601
+ ko: "\uD55C\uAD6D\uC5B4",
1602
+ zh: "\u4E2D\u6587",
1603
+ "zh-cn": "\u666E\u901A\u8BDD",
1604
+ "zh-tw": "\u7E41\u9AD4\u4E2D\u6587",
1605
+ ru: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439",
1606
+ ar: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629",
1607
+ hi: "\u0939\u093F\u0928\u094D\u0926\u0940",
1608
+ nl: "Nederlands",
1609
+ pl: "Polski",
1610
+ sv: "Svenska",
1611
+ tr: "T\xFCrk\xE7e",
1612
+ und: "Original"
1613
+ };
1614
+ var CODEC_LABELS = {
1615
+ "truehd": "Dolby TrueHD",
1616
+ "atmos": "Dolby Atmos",
1617
+ "eac3": "Dolby Digital Plus",
1618
+ "ec-3": "Dolby Digital Plus",
1619
+ "e-ac-3": "Dolby Digital Plus",
1620
+ "ac3": "Dolby Digital",
1621
+ "ac-3": "Dolby Digital",
1622
+ "dts-hd": "DTS-HD",
1623
+ "dts-hd ma": "DTS-HD MA",
1624
+ "dtshd": "DTS-HD MA",
1625
+ "dts": "DTS",
1626
+ "aac": "AAC",
1627
+ "opus": "Opus",
1628
+ "mp3": "MP3",
1629
+ "flac": "FLAC",
1630
+ "alac": "ALAC"
1631
+ };
1632
+ var CHANNEL_LABELS = {
1633
+ 1: "Mono",
1634
+ 2: "Est\xE9reo",
1635
+ 6: "5.1",
1636
+ 7: "6.1",
1637
+ 8: "7.1"
1638
+ };
1639
+ function friendlyAudioLabel(rawName, lang, codec, channels) {
1640
+ const langKey = (lang ?? "").toLowerCase();
1641
+ const langLabel = LANG_NAMES[langKey] ?? (lang ? lang.toUpperCase() : null);
1642
+ const codecKey = Object.keys(CODEC_LABELS).find((k) => codec.toLowerCase().includes(k));
1643
+ const codecLabel = codecKey ? CODEC_LABELS[codecKey] : null;
1644
+ const chLabel = channels ? CHANNEL_LABELS[channels] ?? `${channels}ch` : null;
1645
+ const looksHuman = rawName && !/^(und|dts|ac3|eac3|aac|opus|truehd|atmos|\w{2,3}-\d+ch|\w{2})/i.test(rawName) && rawName.length > 1;
1646
+ const baseName = looksHuman ? rawName : langLabel ?? "\xC1udio";
1647
+ const suffix = [codecLabel, chLabel].filter(Boolean).join(" ");
1648
+ return suffix ? `${baseName} \u2014 ${suffix}` : baseName;
1649
+ }
1588
1650
  function isHdrLevel(level) {
1589
1651
  const range = level?.videoRange ?? level?.video_range ?? "";
1590
1652
  return range === "PQ" || range === "HLG" || range === "HDR10" || typeof level?.name === "string" && /hdr/i.test(level.name);
@@ -2392,7 +2454,8 @@ function Video({
2392
2454
  tracks.map((t, i) => {
2393
2455
  const codec = (t.attrs?.CODECS ?? t.codecSet ?? "").split(",")[0]?.trim() ?? "";
2394
2456
  const supported = deviceSupportsAudioCodec(codec);
2395
- return { id: i, label: t.name ?? t.lang ?? `Track ${i + 1}`, supported };
2457
+ const label = friendlyAudioLabel(t.name, t.lang, codec, t.channels ?? t.attrs?.CHANNELS);
2458
+ return { id: i, label, supported };
2396
2459
  })
2397
2460
  );
2398
2461
  if (pinnedAudio === -1) setSelectedAudio(hls.audioTrack ?? 0);
@@ -2409,7 +2472,8 @@ function Video({
2409
2472
  tracks.map((t, i) => {
2410
2473
  const codec = (t.attrs?.CODECS ?? t.codecSet ?? "").split(",")[0]?.trim() ?? "";
2411
2474
  const supported = deviceSupportsAudioCodec(codec);
2412
- return { id: i, label: t.name ?? t.lang ?? `Track ${i + 1}`, supported };
2475
+ const label = friendlyAudioLabel(t.name, t.lang, codec, t.channels ?? t.attrs?.CHANNELS);
2476
+ return { id: i, label, supported };
2413
2477
  })
2414
2478
  );
2415
2479
  }