Skip to content

ddayguerrero/use-media-capabilities

Repository files navigation


use-media-capabilities

A React hook to extract information about the decoding and encoding capabilities of a given audio or video format.


Getting Started

Quick Start

npm install use-media-capabilities

Example

import { useAudioCapabilities } from 'use-media-capabilities';

function EncodingStatus() {
  const {encodingProfile} = useAudioCapabilities({
    contentType: "audio/flac",
    channels: "2",
    bitrate: 128000,
    samplerate: 16000,
  });

  return (
   <div> Encoding for audio configuration is {encodingProfile.type === 'valid' && encodingProfile.powerEfficient ? '' : 'not' } power efficient.
    </div>
  );
}