How to use mpd-parser - 3 common examples

To help you get started, we’ve selected a few mpd-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github videojs / http-streaming / src / dash-playlist-loader.js View on Github external
parseMasterXml() {
    const master = parseMpd(this.masterXml_, {
      manifestUri: this.srcUrl,
      clientOffset: this.clientOffset_,
      sidxMapping: this.sidxMapping_
    });

    master.uri = this.srcUrl;

    // Set up phony URIs for the playlists since we won't have external URIs for DASH
    // but reference playlists by their URI throughout the project
    // TODO: Should we create the dummy uris in mpd-parser as well (leaning towards yes).
    for (let i = 0; i < master.playlists.length; i++) {
      const phonyUri = `placeholder-uri-${i}`;

      master.playlists[i].uri = phonyUri;
    }
github videojs / http-streaming / src / dash-playlist-loader.js View on Github external
export const filterChangedSidxMappings = (masterXml, srcUrl, clientOffset, oldSidxMapping) => {
  // Don't pass current sidx mapping
  const master = parseMpd(masterXml, {
    manifestUri: srcUrl,
    clientOffset
  });

  const videoSidx = compareSidxEntry(master.playlists, oldSidxMapping);
  let mediaGroupSidx = videoSidx;

  forEachMediaGroup(master, (properties, mediaType, groupKey, labelKey) => {
    if (properties.playlists && properties.playlists.length) {
      const playlists = properties.playlists;

      mediaGroupSidx = mergeOptions(
        mediaGroupSidx,
        compareSidxEntry(playlists, oldSidxMapping)
      );
    }
github videojs / http-streaming / src / dash-playlist-loader.js View on Github external
syncClientServerClock_(done) {
    const utcTiming = parseUTCTiming(this.masterXml_);

    // No UTCTiming element found in the mpd. Use Date header from mpd request as the
    // server clock
    if (utcTiming === null) {
      this.clientOffset_ = this.masterLoaded_ - Date.now();
      return done();
    }

    if (utcTiming.method === 'DIRECT') {
      this.clientOffset_ = utcTiming.value - Date.now();
      return done();
    }

    this.request = this.hls_.xhr({
      uri: resolveUrl(this.srcUrl, utcTiming.value),
      method: utcTiming.method,

mpd-parser

mpd parser

Apache-2.0
Latest version published 6 days ago

Package Health Score

86 / 100
Full package analysis

Popular mpd-parser functions