Giter Site home page Giter Site logo

get-blob-duration's Introduction

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.2

  • Bump lodash from 4.17.15 to 4.17.19 pull #6
  • Audit fix + npm up

1.1.1

  • Update deps

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

get-blob-duration's People

Contributors

evictor avatar kandros avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.