dasha 4.4.4 → 4.4.5

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 (2) hide show
  1. package/dist/index.mjs +19 -0
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1416,6 +1416,7 @@ const BACKING_TYPE_AUDIO = "audio";
1416
1416
  const BACKING_TYPE_VIDEO = "video";
1417
1417
  const BASE_INPUT_PATCHED = Symbol.for("dasha.base-mediabunny-input-patched");
1418
1418
  const PRESERVE_SUBTITLE_BACKINGS = Symbol.for("dasha.preserve-subtitle-backings");
1419
+ const resolvedHlsSegmentLocations = /* @__PURE__ */ new WeakSet();
1419
1420
  const getDefaultAudioTrackFormats = (source) => {
1420
1421
  return isLikelyDashPath(source instanceof SourceRef ? source.source : source) ? [DASH, ...ALL_FORMATS$1] : [...ALL_FORMATS$1, DASH];
1421
1422
  };
@@ -1579,6 +1580,22 @@ const getSegmentedInputForTrack = (track) => {
1579
1580
  const internalTrack = backing.internalTrack;
1580
1581
  return internalTrack.demuxer.getSegmentedInputForPath(internalTrack.fullPath);
1581
1582
  };
1583
+ const isHlsSegment = (segment) => !("sourcePath" in segment.location);
1584
+ const resolveHlsSegmentLocation = async (source, location) => {
1585
+ if (resolvedHlsSegmentLocations.has(location)) return;
1586
+ location.path = await resolvePathedSourcePath(source, {
1587
+ path: location.path,
1588
+ isRoot: false
1589
+ });
1590
+ resolvedHlsSegmentLocations.add(location);
1591
+ };
1592
+ const resolveHlsSegments = async (source, segments) => {
1593
+ for (const segment of segments) {
1594
+ if (!isHlsSegment(segment)) continue;
1595
+ if (segment.initSegment) await resolveHlsSegmentLocation(source, segment.initSegment.location);
1596
+ await resolveHlsSegmentLocation(source, segment.location);
1597
+ }
1598
+ };
1582
1599
  const getTrackBacking = (track) => track._backing;
1583
1600
  const getTrackSource = (track) => {
1584
1601
  return getTrackBacking(track).getSource?.() ?? track.input.source;
@@ -1602,11 +1619,13 @@ const addSegmentAccess = (track) => new Proxy(track, { get(target, prop) {
1602
1619
  if (prop === "getSegments") return async () => {
1603
1620
  const segmentedInput = getSegmentedInputForTrack(target);
1604
1621
  if (segmentedInput.segments.length === 0) await segmentedInput.runUpdateSegments();
1622
+ await resolveHlsSegments(getTrackSource(target), segmentedInput.segments);
1605
1623
  return segmentedInput.segments;
1606
1624
  };
1607
1625
  if (prop === "refreshSegments") return async () => {
1608
1626
  const segmentedInput = getSegmentedInputForTrack(target);
1609
1627
  await segmentedInput.runUpdateSegments();
1628
+ await resolveHlsSegments(getTrackSource(target), segmentedInput.segments);
1610
1629
  return segmentedInput.segments;
1611
1630
  };
1612
1631
  const value = Reflect.get(target, prop, target);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dasha",
3
- "version": "4.4.4",
3
+ "version": "4.4.5",
4
4
  "description": "Streaming manifest parser",
5
5
  "files": [
6
6
  "dist"