A React hook to detect and enable auto-playing audio content if it has been blocked by Chrome's autoplay policy.
yarn add use-audiate
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>
);
};