1.0.0 • Published 6 years ago

dash-segment-analyzer v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

dash-segment-analyzer

Description

The analyzer creates an instance of Map, which will contain the following keys:

  • timescale
  • duration
  • earliest_presentation_time

If an initial segment is passed, then the Map instance will be empty.

Requirements

A modern web browser with support for:

  • BigInt
  • DataView (with BigInt methods implementation)

Install

$ npm install dash-segment-analyzer

Usage

import { DashSegmentAnalyzer } from 'dash-segment-analyzer';

async function analyze() {
    const response = await fetch('path/to/segment');

    const data = await response.blob();
    //const data = await response.arrayBuffer(); // Alternative

    const analyzer = new DashSegmentAnalyzer({ segment: data });

    const analyzedData = await analyzer.analyze(); // Will return an instance of Map

    if (analyzedData.size > 0) {
        const timescale = analyzedData.get('timescale');
        const duration = analyzedData.get('duration');
        const startTime = analyzedData.get('earliest_presentation_time');

        console.log(`timescale:${timescale};duration:${duration};startTime:${startTime}`);
    }
}

analyze();
1.0.0

6 years ago