New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dash-validator

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dash-validator

JS library to validate MPEG DASH manifests and segments

  • 0.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status

A Javascript library to validate content with the MPEG DASH streaming format

Usage (Node JS)

npm install --save dash-validator

Example implementation:

const DashValidator = require("dash-validator");

const validator = new DashValidator("http://example.com/test.mpd");
validator.load().then(() => {
  console.log("Loaded manifest");
  console.log(validator.duration());
  validator.verifyAllSegments(verifyFn).then(result => {
    console.log(result);
  });
}).catch(console.error);

function verifyFn(headers) {
  return (typeof headers["x-my-custom-header"] !== "undefined");
}

To verify dynamically updating manifests:

validator.load().then(() => {
  validator.validateDynamicManifest(5).then((result) => {
    console.log(result);
  });
  validator.on("invalidplayhead", (data) => {
    console.log(data);
  });
  validator.on("checking", data => {
    const mpd = data.mpd;
    const headers = data.headers;
    console.log("Playhead: " + new Date(mpd.timeAtHead));
  });
});

Usage (Browser)

<script src="/dist/dashvalidator.min.js"></script>
<script>
  var validator = new DashValidator("http://example.com/test.mpd");
  validator.load().then(function() {
    return validator.validateDynamicManifest(2);
  }).then(function(result) {
    var status = document.getElementById("status");
    if (result.ok == result.iterations) {
      status.innerHtml = "All OK";
    }
  });
</script>

FAQs

Package last updated on 06 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc