1.0.12 • Published 5 months ago

@jswork/audio-utils v1.0.12

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

audio-utils

Audio utils.

version license size download

installation

yarn add @jswork/audio-utils

usage

import { checkPermission, watchAmplitude } from '@jswork/audio-utils';

// checkPermission
checkPermission().then((res) => {
  console.log(res);
});

// watchAmplitude when recorder
useEffect(() => {
  if (!isPlaying) return;
  const res = watchAmplitude({
    type: 'recorder',
    context: recorder,
    callback: (v) => {
      console.log('volumn: ', v);
    },
  });
  return res.destroy;
}, [isPlaying]);

// watchAmplitude when howler
useEffect(() => {
  if (!isPlaying) return;
  const res = watchAmplitude({
    type: 'howler',
    context: Howler,
    callback: (v) => {
      console.log('volumn: ', v);
    },
  });
  return res.destroy;
}, [isPlaying]);

// watchAmplitude when audio
useEffect(() => {
  if (!isPlaying) return;
  const res = watchAmplitude({
    type: 'audio',
    context: document.querySelector('#audio1'),
    callback: (v) => {
      console.log('volumn: ', v);
    },
  });
  return res.destroy;
}, [isPlaying]);

types

/// <reference types="@jswork/audio-utils/global.d.ts" />

license

Code released under the MIT license.

1.0.12

5 months ago

1.0.11

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago