Skip to content

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

License

Notifications You must be signed in to change notification settings

dzucconi/use-audiate

Repository files navigation

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>
  );
};