{"id":13767454,"url":"https://github.com/videojs/mpd-parser","last_synced_at":"2025-05-10T22:31:51.064Z","repository":{"id":15853113,"uuid":"78889661","full_name":"videojs/mpd-parser","owner":"videojs","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-09T19:06:08.000Z","size":1410,"stargazers_count":81,"open_issues_count":18,"forks_count":56,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-28T05:42:58.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://videojs.github.io/mpd-parser/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/videojs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-13T21:52:55.000Z","updated_at":"2025-03-17T05:51:27.000Z","dependencies_parsed_at":"2024-01-07T09:41:57.812Z","dependency_job_id":"d4dc4388-a838-4a2a-880c-452b204bda51","html_url":"https://github.com/videojs/mpd-parser","commit_stats":{"total_commits":125,"total_committers":26,"mean_commits":"4.8076923076923075","dds":0.848,"last_synced_commit":"3fc0486cbc06114635055d540606f850477c8c5d"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fmpd-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fmpd-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fmpd-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fmpd-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/videojs","download_url":"https://codeload.github.com/videojs/mpd-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252425290,"owners_count":21745849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T16:01:08.773Z","updated_at":"2025-05-10T22:31:49.530Z","avatar_url":"https://github.com/videojs.png","language":"JavaScript","funding_links":[],"categories":["DASH","HarmonyOS"],"sub_categories":["Talks Presentations Podcasts","Windows Manager"],"readme":"# mpd-parser\n\n[![Build Status](https://travis-ci.org/videojs/mpd-parser.svg?branch=master)](https://travis-ci.org/videojs/mpd-parser)\n[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/mpd-parser.svg)](https://greenkeeper.io/)\n[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com)\n\n[![NPM](https://nodei.co/npm/mpd-parser.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/mpd-parser/)\n\nmpd parser\n\n## Table of Contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Parsed Output](#parsed-output)\n- [Including the Parser](#including-the-parser)\n  - [`\u003cscript\u003e` Tag](#script-tag)\n  - [Browserify](#browserify)\n  - [RequireJS/AMD](#requirejsamd)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n## Installation\n\n```sh\nnpm install --save mpd-parser\n```\n\n## Usage\n\n```js\n// get your manifest in whatever way works best\n// for example, by reading the file from the filesystem in node\n// or using fetch in a browser like so:\n\nconst manifestUri = 'https://example.com/dash.xml';\nconst res = await fetch(manifestUri);\nconst manifest = await res.text();\n\n// A callback function to handle events like errors or warnings\nconst eventHandler = ({ type, message }) =\u003e console.log(`${type}: ${message}`);\n\nvar parsedManifest = mpdParser.parse(manifest, { manifestUri, eventHandler });\n```\n\nIf dealing with a live stream, then on subsequent calls to parse, the previously parsed\nmanifest object should be provided as an option to `parse` using the `previousManifest`\noption:\n\n```js\nconst newParsedManifest = mpdParser.parse(\n  manifest,\n  // parsedManifest comes from the prior example\n  { manifestUri, previousManifest: parsedManifest }\n);\n```\n\n### Parsed Output\n\nThe parser ouputs a plain javascript object with the following structure:\n\n```js\nManifest {\n  allowCache: boolean,\n  contentSteering: {\n    defaultServiceLocation: string,\n    proxyServerURL: string,\n    queryBeforeStart: boolean,\n    serverURL: string\n  },\n  endList: boolean,\n  mediaSequence: number,\n  discontinuitySequence: number,\n  playlistType: string,\n  playlists: [\n    {\n      attributes: {},\n      Manifest\n    }\n  ],\n  mediaGroups: {\n    AUDIO: {\n      'GROUP-ID': {\n        default: boolean,\n        autoselect: boolean,\n        language: string,\n        uri: string,\n        instreamId: string,\n        characteristics: string,\n        forced: boolean\n      }\n    },\n    VIDEO: {},\n    'CLOSED-CAPTIONS': {},\n    SUBTITLES: {}\n  },\n  dateTimeString: string,\n  dateTimeObject: Date,\n  targetDuration: number,\n  totalDuration: number,\n  discontinuityStarts: [number],\n  segments: [\n    {\n      byterange: {\n        length: number,\n        offset: number\n      },\n      duration: number,\n      attributes: {},\n      discontinuity: number,\n      uri: string,\n      timeline: number,\n      key: {\n        method: string,\n        uri: string,\n        iv: string\n      },\n      map: {\n        uri: string,\n        byterange: {\n          length: number,\n          offset: number\n        }\n      },\n      'cue-out': string,\n      'cue-out-cont': string,\n      'cue-in': string\n    }\n  ]\n}\n```\n\n## Including the Parser\n\nTo include mpd-parser on your website or web application, use any of the following methods.\n\n### `\u003cscript\u003e` Tag\n\nThis is the simplest case. Get the script in whatever way you prefer and include it on your page.\n\n```html\n\u003cscript src=\"//path/to/mpd-parser.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var mpdParser = window['mpd-parser'];\n  var parsedManifest = mpdParser.parse(manifest, { manifestUri });\n\u003c/script\u003e\n```\n\n### Browserify\n\nWhen using with Browserify, install mpd-parser via npm and `require` the parser as you would any other module.\n\n```js\nvar mpdParser = require('mpd-parser');\n\nvar parsedManifest = mpdParser.parse(manifest, { manifestUri });\n```\n\nWith ES6:\n```js\nimport { parse } from 'mpd-parser';\n\nconst parsedManifest = parse(manifest, { manifestUri });\n```\n\n### RequireJS/AMD\n\nWhen using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the parser as you normally would:\n\n```js\nrequire(['mpd-parser'], function(mpdParser) {\n  var parsedManifest = mpdParser.parse(manifest, { manifestUri });\n});\n```\n\n## License\n\nApache-2.0. Copyright (c) Brightcove, Inc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideojs%2Fmpd-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvideojs%2Fmpd-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideojs%2Fmpd-parser/lists"}