# ommr

> Play sound from JavaScript with HTML5 audio tag backend.

Latest version **1.1.2** (published 2016-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install ommr
pnpm add ommr
yarn add ommr
bun add ommr
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2016-04-07 |
| First published | 2015-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Fraina |
| Maintainers | fraina |
| Keywords | audio, html5, play sound |

## Links

- npm: https://www.npmjs.com/package/ommr
- Repository: https://github.com/Fraina/-Ommr
- Homepage: https://github.com/Fraina/-Ommr#readme
- Issues: https://github.com/Fraina/-Ommr/issues
- npm.io page: https://npm.io/package/ommr

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2016-04-07
- 0.1.2 — 2016-04-07
- 0.1.1 — 2016-01-08
- 0.1.0 — 2016-01-08
- 0.0.4 — 2016-01-08
- 0.0.3 — 2015-12-11

## README

♪ommr
=========

[![npm](https://img.shields.io/npm/l/express.svg?style=flat)](https://opensource.org/licenses/MIT)
[![npm](https://img.shields.io/npm/v/ommr.svg?style=flat)](https://www.npmjs.com/package/ommr)
[![Bower](https://img.shields.io/bower/v/ommr.svg)](https://github.com/Fraina/-ommr)

Play sound from JavaScript with HTML5 audio tag backend.


## Initialization ##
Import plugin: ommr.js.
```
var audio = new Ommr();
audio.init({
  'sounds': {
    'track_alias': {
      'file': 'track_fileName',
      'type': 'ogg'
    },
    'soundA': {
      'file': 'A_fileName',
      'volume': 1,
      'preload': false
    },
    'soundB': {
      'file': 'B_fileName',
      'loop': false
    }
  },
  'path': 'path/',
  'volume': 0.7,
  'autoplay': true,
  'preload': true,
  'multiplay': true,
  'callbacks': {
    // play, stop ...
  }
});
```

## Usage ##

### Settings ###

 - path (General)
 - autoplay (General)
 - callbacks (General):
   * play
   * ended
   * pause
   * timeupdate
   * durationchange
   * volumechange
 - loop (Sound object)
 - preload (General, Sound object)
 - volume (General, Sound object)
 - type (General, Sound object)

### API ###

 - play
```
audio.play('soundA');
audio.play('soundA', 'ogg');
audio.play();   // the last played track
```
 - pause
```
audio.pause('soundA');
audio.pause();   // the last played track
```
 - pauseAll
 - stop
```
audio.stop('soundA');
audio.stop();   // the last played track
```
 - stopAll
 - changeProgress('newCurrentTime')
 - toggleMuted
 - setSoundVolume
```
audio.setSoundVolume('soundA', 0.5);
audio.setSoundVolume(0.5);   // change the last played track's volume to 0.5
```
 - setVolume

   This method will influence all tracks, including those tracks were changed by `setSoundVolume`.
 - status
 - getTrackList

## License ##
MIT

---
_Source: https://npm.io/package/ommr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
