Socket
Socket
Sign inDemoInstall

use-is-audio-active

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    use-is-audio-active

It is react custom hook to detect whether provided audio source is active


Version published
Weekly downloads
6
decreased by-14.29%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

use-is-audio-active

It is react custom hook to detect whether provided audio source is active

NPM JavaScript Style Guide

Install

npm install --save use-is-audio-active

Usage

import * as React from 'react'

import useIsAudioActive from 'use-is-audio-active'

const Example = () => {
  const [stream, setStream] = React.useState(null)
  const isActive = useIsAudioActive({ source: stream });

  React.useEffect(() => {
    (async function createStream() {
      const stream = await navigator.mediaDevices.getUserMedia({
        audio: true,
        video: true,
      });
      setStream(stream)
    })()
  }, [])  
  
  return (
    <p>
      Am I speaking: {' '} { isActive ? 'yes, you are 🕺' : "seems like ain't 🦻" }
    </p>
  )
}

License

MIT © olzh2102 evitla

FAQs

Last updated on 23 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc