JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q47923F
  • License MIT

For checking video codecs and then use in video.canPlayType()

Package Exports

  • check-video-codec

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (check-video-codec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

check-video-codec

JavaScript library that use both mediainfo.js and mp4box for detect video codec

Example

const fs = require('fs')
const CheckMp4Codec = require('check-video-codec')

const filePath = './video/android_open_vpn.mp4' // path to video
const fileStream = fs.createReadStream(filePath)

const checkMp4Codec = new CheckMp4Codec()
// waiting when mediainfo.js will be init
checkMp4Codec.init().then( () => {
    let buf = Buffer.alloc(0)
    fileStream.on('data', async (chunk) => {
        buf = Buffer.concat([chunk])
        // get information about video codec
        const res = await checkMp4Codec.check(buf)
        if (res) {
            console.log(res)
            fileStream.destroy()
        }
    })
})