Skip to content

Standalone implementation of the HTML5 Media TimeRanges interface.

License

Notifications You must be signed in to change notification settings

zentrick/time-ranges

Repository files navigation

time-ranges

npm Dependencies Build Status Coverage Status JavaScript Standard Style

Standalone implementation of the HTML5 Media TimeRanges interface. Always normalized.

Installation

npm i --save time-ranges

Usage

import TimeRanges from 'time-ranges'

const timeRanges = new TimeRanges()

timeRanges.add(1, 2)
timeRanges.add(3, 4)

for (let i = 0; i < timeRanges.length; ++i) {
  const start = timeRanges.start(i)
  const end = timeRanges.end(i)
  console.log(`Range ${i}: ${start}${end}`)
}

// Output:
// Range 0: 1 → 2
// Range 1: 3 → 4

Maintainer

Tim De Pauw

License

MIT

About

Standalone implementation of the HTML5 Media TimeRanges interface.

Resources

License

Stars

Watchers

Forks

Packages

No packages published