# j-Sounds

> This component contains some predefined sounds like beep, fail, success, etc... Path contains a volume control in percentage, 0 disables playing.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: a25786ca81f7a7f72a534aaa09ad7d9efc63d100a561c235d6334e150ec54ee9
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

This component contains some predefined sounds like `beep`, `fail`, `success`, etc... Path contains a volume control in percentage, `0` disables playing.


__Configuration__:

- `url {String}` URL address to sound library (default: `https://cdn.componentator.com/sounds/`)
- `volume {Number}` (default: `50`)

__Good to know__:

`path` can contain `{Number}`, which will control volume or `{Boolean}` which will enable or disable sounds.

__Methods__:

- `component.play(sound)` supported sounds:
	- `alert`
	- `message`
	- `badges`
	- `notifications`
	- `beep`
	- `confirm`
	- `done`
	- `drum`
	- `fail`
	- `success`
- `component.success()`
- `component.fail()`
- `component.alert()`, `component.error()`
- `component.warning()`
- `component.notify()`
- `component.badge()`
- `component.confirm()`
- `component.beep()`
- `component.drum()`

Use it with `<ui-component name="sounds">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="sounds" path="volume"></ui-component>

<script>
	var volume = 80;

	setTimeout(function() {
		SETTER('sounds/play', 'beep');
	}, 1000);

	setTimeout(function() {
		SETTER('sounds/play', 'drum');
	}, 3000);

	setTimeout(function() {
		SETTER('sounds/play', 'fail');
	}, 7000);

</script>
```
