react-hooks-audio
Version:
Custom audio playback for React Hooks
38 lines (23 loc) • 3.25 kB
Markdown
# react-hooks-audio
suitable for use in React 16.x technology stack projects.
# 🚀 Features
- Custom audio playback
- Implemented based on React Hooks
# 🎉 Live demo
https://winfans.github.io/react-hooks-audio/
# Installation
```
npm install --save react-hooks-audio
```
# Usage
<a href="https://github.com/Winfans/react-hooks-audio/blob/main/example/components/audio-player/index.tsx">demo</a>
```
import { useAudio } from 'react-hooks-audio';
const { playing, play, pause, currentTime, audioTime, setCurrentTime, init, rePlay } = useAudio({ value: 'xxx' });
```
# Browser compatibility
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Safari |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IE11, Edge | last 3 versions | last 3 versions | last 2 versions |
# Open source agreement
react-hooks-audio follow [MIT License](https://github.com/Winfans/react-hooks-audio/LICENSE)。