0.0.11 • Published 1 year ago

tailwind-player v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Tailwind Audio Player

A lightweight TailwindCSS React wrapper for the default audio element.

Installation

npm install --save tailwind-player

You should have the react and react-dom installed.

Usage

import TailwindPlayer from 'tailwind-player';
//...
<TailwindPlayer
  src="https://youtu.be/dQw4w9WgXcQ?si=Id6V7AafrYLSmgNd"
  loop
  autoplay
/>

Example

See the example directory for a basic working example of using this project. To run it locally, run npm install in the example directory and then npm start.

Props

PropTypeDefault
autoPlayBooleanfalse
childrenElementnull
classNameStringempty string
controlsBooleanfalse
crossOriginStringempty string
controlsListStringempty string
idStringempty string
loopBooleanfalse
mutedBooleanfalse
volumeNumber1.0
preloadString'metadata'
srcStringempty string
styleObject---
PropTypeDescription
presetObjectAdditional properties for the preset
preset.showSliderBooleanDetermines whether to show the slider. Default is true.
preset.showFastForwardBooleanDetermines whether to show the fast forward button. Default is true.
preset.showPlaybackSpeedBooleanDetermines whether to show the playback speed control. Default is true.
preset.showMuteBooleanDetermines whether to show the mute button. Default is true.
preset.showDownloadBooleanDetermines whether to show the download button. Default is true.
preset.showPlaylistBooleanDetermines whether to show the playlist button. Default is true.
PropTypeDescription
listenIntervalNumberIndicates how often to call the onListened prop during playback, in milliseconds. Default is 10000.
onAbortFunctioncalled when unloading the audio player, like when switching to a different src file. Passed the event.
onCanPlayFunctioncalled when enough of the file has been downloaded to be able to start playing. Passed the event.
onCanPlayThroughFunctioncalled when enough of the file has been downloaded to play through the entire file. Passed the event.
onEndedFunctioncalled when playback has finished to the end of the file. Passed the event.
onErrorFunctioncalled when the audio tag encounters an error. Passed the event.
onListenFunctioncalled every listenInterval milliseconds during playback. Passed the event.
onPauseFunctioncalled when the user pauses playback. Passed the event.
onPlayFunctioncalled when the user taps play. Passed the event.
onSeekedFunctioncalled when the user drags the time indicator to a new time. Passed the event.
onVolumeChangedFunctioncalled when the user changes the volume, such as by dragging the volume slider
onLoadedMetadataFunctioncalled when the metadata for the given audio file has finished downloading. Passed the event.
0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.6

1 year ago

0.0.1

1 year ago