@solid-primitives/audio
Advanced tools
Comparing version 1.1.0 to 1.1.5
@@ -5,3 +5,3 @@ // src/server.ts | ||
player: {}, | ||
state: () => ({}), | ||
state: () => AudioState.LOADING, | ||
setState: (_state) => { | ||
@@ -17,3 +17,3 @@ } | ||
}, | ||
state: () => ({}), | ||
state: () => AudioState.LOADING, | ||
player: {} | ||
@@ -29,3 +29,3 @@ }; | ||
currentTime: () => 0, | ||
state: () => ({}), | ||
state: () => AudioState.LOADING, | ||
duration: () => 0, | ||
@@ -32,0 +32,0 @@ seek: () => { |
{ | ||
"name": "@solid-primitives/audio", | ||
"version": "1.1.0", | ||
"version": "1.1.5", | ||
"description": "Primitives to manage audio and single sounds.", | ||
@@ -5,0 +5,0 @@ "author": "David Di Biase <dave.dibiase@gmail.com>", |
@@ -7,24 +7,40 @@ # @solid-primitives/audio | ||
Primitive to manage audio playback in the browser. This primitive is comprised of three composed primitives: | ||
Primitive to manage audio playback in the browser. The primitives are easily composable and extended. To create your own audio element, consider using createAudioPlayer which allows you to supply a player instance that matches the built-in standard Audio API. | ||
`createAudioPlayer` - Provides a very basic interface for wrapping listeners to a supplied or default audio player. | ||
Each primitive also exposes the audio instance for further custom extensions. Within an SSR context this audio primitive performs noops but never interrupts the process. Time values and durations are zero'd and in LOADING state. | ||
`createAudio` - Creates a very basic audio/sound player. | ||
## Installation | ||
`createAudioManager` - Creates a full featured audio manager. | ||
``` | ||
npm install @solid-primitives/audio | ||
# or | ||
yarn add @solid-primitives/audio | ||
``` | ||
The primitives are easily composable and extended. To create your own audio element, consider using createBaseAudio which allows you to supply a player instance that matches the built-in standard Audio API. | ||
## How to use it | ||
### createAudioPlayer | ||
A foundational primitive with no player controls but exposes the raw player object. | ||
```ts | ||
const { play, pause } = createAudio("example.wav"); | ||
const { player } = createAudioPlayer("example.wav"); | ||
``` | ||
and | ||
### createAudio | ||
Provides a very basic interface for wrapping listeners to a supplied or default audio player. | ||
```ts | ||
const { play, duration, currentTime, seek, setVolume, pause } = createAudioManager("example.wav"); | ||
const { play, pause } = createAudioManager("example.wav"); | ||
``` | ||
### createAIdop | ||
Creates a very basic audio/sound player. | ||
```ts | ||
const { play, pause, duration, currentTime, seek, setVolume } = createAudioManager("example.wav"); | ||
``` | ||
## Demo | ||
@@ -51,3 +67,3 @@ | ||
1.1.0 | ||
1.1.5 | ||
@@ -54,0 +70,0 @@ Added proper SSR support. |
10801
71