evictor/get-blob-duration


Convenience method to patch Chromium bug when getting duration of HTML5 video or audio Blob.

Language: JavaScript


get-blob-duration

Convenience method to patch Chromium bug when getting duration of HTML5 video or audio Blob.

Installation

npm install --save get-blob-duration

or

yarn add get-blob-duration

Usage

Import the method however you like (browser, module, etc.). Once you have it in scope:

// Returns Promise<Number>
getBlobDuration(blob).then(function(duration) {
  console.log(duration + ' seconds');
});

Or use ECMAScript 6:

import getBlobDuration from 'get-blob-duration'

(async function() {
  const duration = await getBlobDuration(blob)
  console.log(duration + ' seconds')
})()

Or pass an object URL string if you already have one:

import getBlobDuration from 'get-blob-duration'

(async function() {
  const blobUrl = 'blob:https://mdn.mozillademos.org/012345678-9abc-def0-1234-56789abcdef0'
  const duration = await getBlobDuration(blobUrl)
  console.log(duration + ' seconds')
})()

Changelog

1.1.0

  • Allow usage with blob URL - kandros
  • Typescript typings - kandros
  • Fix npm audits + various package upgrades

1.0.1

  • Typescript defs (thanks kandros)
  • Fix audits + gulp update to ^4.0.0

1.0.0

Initial release

Project Statistics

Sourcerank 3
Repository Size 101 KB
Stars 11
Forks 1
Watchers 1
Open issues 0
Dependencies 634
Contributors 2
Tags 3
Created
Last updated
Last pushed

Top Contributors See all

Ezekiel Victor Jaga Santagostino

Packages Referencing this Repo

get-blob-duration
Convenience method to patch Chromium bug when getting duration of HTML5 video or audio Blob.
Latest release 1.1.0 - Updated - 11 stars

Recent Tags See all

1.1.0 July 27, 2019
1.0.1 December 19, 2018
1.0.0 February 15, 2018

Something wrong with this page? Make a suggestion

Last synced: 2019-07-27 21:43:09 UTC

Login to resync this repository