Convenience method to patch Chromium bug when getting duration of HTML5 video or audio Blob.
npm install --save get-blob-duration
or
yarn add get-blob-duration
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')
})()
- Misc: Adopted MIT license
- Security: Update deps
- Bug: Fix #8 (thx @fheyen for bug report)
- Task: Pin deps
- Improvement: Introduce Github Actions
- Improvement: Promise rejects if video el throws an error (thx @Stopa for code)
- Bump lodash from 4.17.15 to 4.17.19 pull #6
- Audit fix + npm up
- Update deps
- Allow usage with blob URL - kandros
- Typescript typings - kandros
- Fix npm audits + various package upgrades
- Typescript defs (thanks kandros)
- Fix audits + gulp update to ^4.0.0
Initial release