dzucconi / use-audiate

A React hook to detect and enable auto-playing audio content if it has been blocked by Chrome's autoplay policy.

Home Page:https://www.npmjs.com/package/use-audiate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use-audiate

semantic-release npm Build Status

What is this?

A React hook to detect and enable auto-playing audio content if it has been blocked by Chrome's autoplay policy.

Installation

yarn add use-audiate

Usage

import React from "react";
import { useAudiate } from "use-audiate";

const App: React.FC = () => {
  const [audioContextState, isEnabled] = useAudiate();
  return (
    <pre>
      <code>{JSON.stringify({ audioContextState, isEnabled })}</code>
    </pre>
  );
};

About

A React hook to detect and enable auto-playing audio content if it has been blocked by Chrome's autoplay policy.

https://www.npmjs.com/package/use-audiate

License:MIT License


Languages

Language:TypeScript 75.3%Language:HTML 17.7%Language:CSS 3.8%Language:JavaScript 3.2%