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

play-audio-notify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

play-audio-notify

HTML5 Audio Player

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63
decreased by-28.41%
Maintainers
1
Weekly downloads
 
Created
Source

play-audio-notfiy

Lightweight Wrapper For HTML5 Audio API

play = require('play-audio-notfiy')

play('song.mp3').autoplay()
  • Example 1: Playing An Alert Sound
  • Example 2: Music player
  • Example 3: alert library

Install

$ npm install play-audio-notfiy

Browser Compatibility

play(['song.mp3', 'song.ogg']).play()

Displaying Controls

parent = document.querySelector('.my-player')
play(['song.mp3', 'song.ogg'], parent).autoplay.controls()

How to use without NPM?

If your application isn't structured as a CommonJS package, you can download the distribution file;

$ wget https://raw.github.com/rajvantchahal/play-audio-notify/master/dist/play-audio-notfiy.js

And include it on your page:

<script src="play-audio.js"></script>
<script>
  playAudio(['song.mp3', 'song.ogg'])
</script>

Changing Source After Initialization

p = play(['song.mp3', 'song.ogg']).autoplay()
p.src()
// => ['song.mp3', 'song.ogg']

p.src(['new.mp3', 'new.ogg']).play()
p.src()
// => ['new.mp3', 'new.ogg']

API

Example:

play('foo.mp3').volume(0.3).controls().loop().on('ended', function(){
  console.log('End of the song reached')
})

Reference:

  • play(uri, parentElement)
  • .controls
  • .currentTime
  • .element
  • .loop
  • .muted
  • .on(event, function)
  • .pause
  • .play
  • .preload
  • .src(url)
  • .volume(number)

Events

  • abort
  • durationchange
  • ended
  • error
  • pause
  • play
  • progress
  • timeupdate

See complete reference

Keywords

FAQs

Package last updated on 24 Apr 2020

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