DASH parser
This module is available to use in your EdgeWorkers code bundle to parse and modify Dynamic Adaptive Streaming over HTTP (DASH) Media Presentation Description (MPD) files.
The protocols for transferring unbounded streams of multimedia data as described in the Guidelines for Implementation: DASH-IF Interoperability Points were applied when creating this EdgeWorkers module.
👍 Refer to Import a JavaScript module for instructions on how to load an external JavaScript module into the EdgeWorkers
main.jsfile.
Code samples and use cases
Go to the the EdgeWorkers GitHub repo for access to the DASH module, the main helper class you need to import into your main.js file and the TypeScript definition file.
To help you learn more about how to use the DASH Parser module, we’ve added the following use cases to this guide. You can also find the code samples in the EdgeWorkers GitHub repo.
-
Manifest and Playlist Manipulation
Dynamically create personalized renditions of available Video on demand (VOD) manifest files using the DASH parser. -
Content insertion
Dynamically add auxiliary media content to an existing Video on Demand (VOD) asset using Pre-Roll, Mid-Roll, and Post-Roll operations.
Manifest parsing
parseMPD()
Parses and creates an internal object such as a MPD file using the input text manifest. This function does not return a value.
getJSON()
Returns the internal object such as an MPD created using parseMPD().
stringifyMPD()
Converts the JavaScript Object (MPD) back to an XML string. Returns a string representation of the object parsed using parseMPD().
Variant Manipulation
filterRepresentationsByBandwidth()
Removes variants other than the matched bitrates passed as the input. Tolerance is also taken into account. This function does not return a value.
filterRepresentationsByResolution()
Removes variants with resolutions higher than the specified maxSupportedResolution. Returns true if a variant is deleted by this function, false otherwise.
filterAdaptationSetsByAudioLanguage()
Removes audio variants with languages not specified. This function does not return a value.
filterAdaptationSetsBySubtitlesLanguage()
Removes subtitle variants with languages not specified. This function does not return a value.
Content (bumper) insertion
The following restrictions apply to bumper insertion.
- The bumper MPD and primary MPD must be present on the origin server.
- You can insert the bumper MPD as pre (before), mid (middle), post (after) roll. The roll refers to the primary MPD.
- You need to specify the
segmentTemplateandsegmentTimelineand preferably use the same segment durations for audio, video, and subtitles while encoding. There is currently no error to inform you if the audio and video segment durations are incompatible. - You should configure the
afterSecondsparameter for a mid roll bumper insertion to be greater than0. You should also create multiple segment durations as it is not possible to split a segment.
bumperInsertion()
Used for pre, post, or mid-roll bumper insertions. This function does not return a value.
Bumper
A holder for an bumper Dash MPD, that will be inserted into the main Dash MPD at the specified duration.