Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ommr

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ommr

Play sound from JavaScript with HTML5 audio tag backend.

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

♪ommr

npm npm Bower

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

Keywords

FAQs

Package last updated on 07 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc