@yaneart/yaneplayer 0.1.0 → 0.1.1

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/GUIDE.md CHANGED
@@ -519,6 +519,12 @@ MP4/native HLS используют browser CORS/auth (`crossOrigin="anonymous"`
519
519
  для native path отклоняется. Для такого playback host предоставляет browser-compatible URL/auth;
520
520
  не используйте `request`, если строгая проверка origin/redirect не нужна.
521
521
 
522
+ С 0.1.1 `source.crossOrigin: "use-credentials"` включает browser cookies для native media
523
+ и credentials только исходного HLS origin в MSE. Cross-origin сервер должен разрешить
524
+ конкретный origin приложения и credentials; браузерная cookie policy продолжает действовать.
525
+ Это browser-compatible auth без строгой `request` policy: native transport не контролирует
526
+ redirect/nested origins. Для строгой политики используйте `request` и MSE.
527
+
522
528
  Preferences adapter и platform API описаны в разделе «Платформа» выше.
523
529
 
524
530
  ## Субтитры и локальные файлы
@@ -1,4 +1,4 @@
1
- import { i as e, o as t, s as n } from "./core-DSvEY8F-.js";
1
+ import { i as e, o as t, s as n } from "./core-Bl9Ox_wM.js";
2
2
  import { subtitleAssets as r } from "./subtitles/assets.js";
3
3
  import i from "./subtitles/jassub.js";
4
4
  // src/core/ass-renderer.ts
@@ -79,6 +79,8 @@ export interface PlayerSource {
79
79
  readonly kind: "mp4" | "hls";
80
80
  readonly src: string;
81
81
  readonly title?: string;
82
+ /** Browser CORS mode; use-credentials also enables cookies for the original HLS origin. */
83
+ readonly crossOrigin?: "anonymous" | "use-credentials";
82
84
  readonly metadata?: {
83
85
  readonly artist?: string;
84
86
  readonly album?: string;
@@ -1651,6 +1651,7 @@ function xn(e, t) {
1651
1651
  e.src
1652
1652
  ].some((e) => typeof e != "string" || !e.trim()) || !["mp4", "hls"].includes(e.kind)) throw Z("invalid-source", "source", "A source requires an id, revision and supported kind.");
1653
1653
  let n;
1654
+ if (e.crossOrigin !== void 0 && !["anonymous", "use-credentials"].includes(e.crossOrigin)) throw Z("invalid-source", "source", "Invalid browser credentials mode.");
1654
1655
  try {
1655
1656
  n = new URL(e.src, t);
1656
1657
  } catch {
@@ -1750,7 +1751,7 @@ async function wn(e, t) {
1750
1751
  let n = !!e.canPlayType("application/vnd.apple.mpegurl"), r = t.kind === "mp4" || t.hlsPlayback === "native";
1751
1752
  if (t.kind === "hls" && t.hlsPlayback === "native" && (!n || t.request)) throw Z("unsupported", "source", "Native HLS cannot play this source or enforce its request policy.");
1752
1753
  if (!r) {
1753
- let { hlsTransport: i, supportsMse: a } = await import("./hls-Cll783tL.js");
1754
+ let { hlsTransport: i, supportsMse: a } = await import("./hls-CrUfIOS7.js");
1754
1755
  if (a()) return i(e, t);
1755
1756
  if (r = t.hlsPlayback !== "mse" && n && !t.request, !r) throw Z("unsupported", "source", "No supported HLS transport can enforce this source's requirements.");
1756
1757
  }
@@ -1759,7 +1760,7 @@ async function wn(e, t) {
1759
1760
  media: e,
1760
1761
  attach() {},
1761
1762
  start() {
1762
- e.crossOrigin = "anonymous", e.src = t.src, e.load();
1763
+ e.crossOrigin = t.crossOrigin ?? "anonymous", e.src = t.src, e.load();
1763
1764
  },
1764
1765
  destroy() {}
1765
1766
  };
@@ -1931,7 +1932,7 @@ function kn(t, n, r, i) {
1931
1932
  }
1932
1933
  let c = await _n({ src: e.font }, a.baseURI, 5 * dn, y);
1933
1934
  r.push(c);
1934
- let { createAssRenderer: l } = await X(import("./ass-renderer-BnMSusia.js"), y);
1935
+ let { createAssRenderer: l } = await X(import("./ass-renderer-DmsQqR82.js"), y);
1935
1936
  h = await l(t, b, r, $(s) - d.delaySeconds, y, () => {
1936
1937
  f === v && (w(), S({
1937
1938
  status: "error",
@@ -3153,10 +3154,14 @@ function Ln(e) {
3153
3154
  id: t.id
3154
3155
  });
3155
3156
  }
3156
- n.positionSeconds !== void 0 && await q({
3157
- type: "seek",
3158
- seconds: n.positionSeconds
3159
- }), Y(o), await ce(o);
3157
+ if (n.positionSeconds !== void 0) {
3158
+ let e = C.durationSeconds, r = e === null ? n.positionSeconds : Math.min(n.positionSeconds, e), i = $(l);
3159
+ (i === null || Math.abs(t.currentTime + i - r) >= .001) && (l?.capabilities?.seek !== "host" && await re(() => Cn(H(), r), o), Y(o), await q({
3160
+ type: "seek",
3161
+ seconds: r
3162
+ }));
3163
+ }
3164
+ Y(o), await ce(o);
3160
3165
  } catch (e) {
3161
3166
  if (!o.aborted) {
3162
3167
  let t = m || h;
@@ -3340,7 +3345,7 @@ function Ln(e) {
3340
3345
  return e.preferences && (B = de.setPreferences(e.preferences).catch(() => {})), de;
3341
3346
  }
3342
3347
  // src/core/index.ts
3343
- var Rn = "0.1.0";
3348
+ var Rn = "0.1.1";
3344
3349
  function zn(e) {
3345
3350
  return Ln(e);
3346
3351
  }
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- export { t as createPlayer, n as version } from "./core-DSvEY8F-.js";
1
+ export { t as createPlayer, n as version } from "./core-Bl9Ox_wM.js";
@@ -1,4 +1,4 @@
1
- import { $ as e, A as t, a as n, at as r, ct as i, et as a, it as o, j as s, lt as c, nt as l, q as u, rt as d, st as f, tt as p } from "./core-DSvEY8F-.js";
1
+ import { $ as e, A as t, a as n, at as r, ct as i, et as a, it as o, j as s, lt as c, nt as l, q as u, rt as d, st as f, tt as p } from "./core-Bl9Ox_wM.js";
2
2
  // node_modules/@videojs/media/dist/default/core/bridge-events.js
3
3
  function m(e, t) {
4
4
  e.dispatchEvent &&= (e) => t.dispatchEvent(new e.constructor(e.type, e));
@@ -20657,7 +20657,7 @@ function Ep(e, t) {
20657
20657
  };
20658
20658
  },
20659
20659
  attach() {
20660
- o.attach(e), e.crossOrigin = "anonymous";
20660
+ o.attach(e), e.crossOrigin = t.crossOrigin ?? "anonymous";
20661
20661
  },
20662
20662
  async start() {
20663
20663
  o.source = {
@@ -20680,7 +20680,7 @@ function Ep(e, t) {
20680
20680
  ...o,
20681
20681
  headers: l,
20682
20682
  redirect: "error",
20683
- credentials: c ? i?.credentials ?? "same-origin" : "omit"
20683
+ credentials: c ? i?.credentials ?? (t.crossOrigin === "use-credentials" ? "include" : "same-origin") : "omit"
20684
20684
  });
20685
20685
  }
20686
20686
  } }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as v, T as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as E, at as D, b as O, c as k, ct as A, d as j, f as M, g as N, h as ee, k as P, l as te, lt as F, m as I, n as L, ot as R, p as z, q as B, r as ne, u as re, v as ie, w as ae, x as oe, y as se, z as V } from "./core-DSvEY8F-.js";
1
+ import { $ as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as v, T as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as E, at as D, b as O, c as k, ct as A, d as j, f as M, g as N, h as ee, k as P, l as te, lt as F, m as I, n as L, ot as R, p as z, q as B, r as ne, u as re, v as ie, w as ae, x as oe, y as se, z as V } from "./core-Bl9Ox_wM.js";
2
2
  import { autoCaptionAssets as ce } from "./auto-captions/assets.js";
3
3
  // node_modules/@videojs/utils/dist/dom/attributes.js
4
4
  function le(e, t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaneart/yaneplayer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Universal video player Web Component with a TypeScript core",
5
5
  "publishConfig": {
6
6
  "access": "public"