Skip to content

Commit

Permalink
Simplify MetaPlaylist Manifest loading by relying on the same code th…
Browse files Browse the repository at this point in the history
…an other transports

I was PoCing protocol-detection when initially parsing the Manifest, so
application developers wouldn't e.g. have to tell to us that they want
to play "dash".

While doing that, I noticed that all transports had close to the same
logic for Manifest fetching. Only differences I've seen are:

  - DASH may add integrity checks if the `checkManifestIntegrity` option
    is set

  - DASH may ask the browser to obtain the response as an ArrayBuffer
    (and not as a default JS string) if it is probable that we will rely
    on the WASM MPD parser

  - the `local` transport throws if no custom `manifestLoader` is
    declared.

As such, those differences look minor and straightforward enough so the
corresponding logic can be factorized into e.g. a single parameterized
`createManifestLoader` function.

This was already done for DASH and Smooth, but I don't know why we
didn't use it for the experimental MetaPlaylist feature. This commit
fixes this.

We could also use it for the experimental `local` transport in the
future, though I'm unsure of how we could generically make sense of its
peculiar rule (no real loading).
  • Loading branch information
peaBerberian committed Sep 4, 2024
1 parent 683b02e commit e3c71ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 78 deletions.
74 changes: 0 additions & 74 deletions src/transports/metaplaylist/manifest_loader.ts

This file was deleted.

12 changes: 8 additions & 4 deletions src/transports/metaplaylist/pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import type {
ITransportOptions,
ITransportPipelines,
} from "../types";
import generateManifestLoader from "./manifest_loader";
import generateManifestLoader from "../utils/generate_manifest_loader";

/**
* Get base - real - content from an offseted metaplaylist content.
Expand Down Expand Up @@ -113,9 +113,13 @@ function getMetaPlaylistPrivateInfos(segment: ISegment): IMetaPlaylistPrivateInf
export default function (options: ITransportOptions): ITransportPipelines {
const transports: Partial<Record<string, ITransportPipelines>> = {};

const manifestLoader = generateManifestLoader({
customManifestLoader: options.manifestLoader,
});
const manifestLoader = generateManifestLoader(
{
customManifestLoader: options.manifestLoader,
},
"text",
null,
);

// remove some options that we might not want to apply to the
// other streaming protocols used here
Expand Down

0 comments on commit e3c71ee

Please sign in to comment.