A React hook to extract information about the decoding and encoding capabilities of a given audio or video format.
npm install use-media-capabilities
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>
);
}