npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

media-stream-validator

v1.0.0

Published

Node wrapper for Apple's mediastreamvalidator tool to validate HLS streams. Written in TypeScript with complete typing coverage.

Downloads

1,557

Readme

media-stream-validator

Apple's mediastreamvalidator tool is an extremely picky way to evaluate your HLS streams against the specifications. It often reports "must fix" errors in the stream that in reality will probably not cause failures. However, if you are having issues with HLS stream failures or inconsistencies across devices (especially on iOS devices) it is a great utility to validate your streams.

This project is a simple Node wrapper, written in TypeScript with full typing goodness, that you can use in your manual or automated testing of streams.

Please note that it can take a while to run because it downloads and evaluates the entire video, including each rendition.

import { mediaStreamValidator } from "mediastreamvalidator";

const streamUri = "YOUR_STREAM_URL_HERE";

(async () => {
    const results = await mediaStreamValidator(streamUri);
    console.log(results);
})();

There are more usages examples in the the examples folder.

Options

The first argument of mediaStreamValidator is the URI to the stream, which is required. The second is optional. It has various options, which should mainly be self-explanatory thanks to intellisense.

But here are some quick notes on them.

path: string

Use this to use a custom path to the mediastreamvalidator executable. You can also use the MEDIA_STREAM_VALIDATOR_PATH environment variable instead.

outputFile: string

The mediastreamvalidator insists on writing its JSON output to a file. So there is a temporary file created and then quickly deleted after this library parses it. If, for some reason, you want to customize where that temporary file is written this option is for you. By default, it creates it as mediastreamvalidator_output.json in the current folder.

processPlaylistOnly: boolean

Running the script and downloading all of the video can be very time consuming. If you want to only evaluate the manifests and not the segments, set this option to true. It will run a lot faster and give you great high level information about your stream. But it's less likely to uncover issues.

timeoutSeconds: number

The default timeout for the script is five minutes. If you want to set this shorter or longer, use this option.

userAgent: string

If, for some reason, you want to set the user agent of the requests for the manifests and segments, here you go.

device: string

In case you need to emmulate being a certain device, you can specific that here. Possible values are: ipod, iphone, atv or ipad.