https://github.com/dzucconi/use-audiate
A React hook to detect and enable auto-playing audio content if it has been blocked by Chrome's autoplay policy.
https://github.com/dzucconi/use-audiate
audio autoplay react react-hooks
Last synced: 3 months ago
JSON representation
A React hook to detect and enable auto-playing audio content if it has been blocked by Chrome's autoplay policy.
- Host: GitHub
- URL: https://github.com/dzucconi/use-audiate
- Owner: dzucconi
- License: mit
- Created: 2019-10-23T01:58:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-30T23:26:33.000Z (over 1 year ago)
- Last Synced: 2025-04-01T13:15:58.435Z (7 months ago)
- Topics: audio, autoplay, react, react-hooks
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/use-audiate
- Size: 729 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 45
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# use-audiate
[](https://github.com/semantic-release/semantic-release) [](https://www.npmjs.com/package/use-audiate) [](https://travis-ci.org/dzucconi/use-audiate)
## What is this?
A React hook to detect and enable auto-playing audio content if it has been blocked by [Chrome's autoplay policy](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes).
## Installation
```bash
yarn add use-audiate
```## Usage
```javascript
import React from "react";
import { useAudiate } from "use-audiate";const App: React.FC = () => {
const [audioContextState, isEnabled] = useAudiate();
return (
{JSON.stringify({ audioContextState, isEnabled })}
);
};
```