Socket
Socket
Sign inDemoInstall

afplay

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    afplay

Apple Audio File Play wrapper for Node.js


Version published
Weekly downloads
19
decreased by-48.65%
Maintainers
1
Install size
5.12 kB
Created
Weekly downloads
 

Readme

Source

Afplay

Afplay - Apple Audio File Play wrapper for Node.js

NPM Version Build Status Dependency Status

Afplay is a wrapper for Apple Audio File Play (afplay).

Use Afplay to play audio files on OS X via afplay. Afplay afplay!

Installation

Afplay was written for Node.js 4+.

npm install --save afplay

Usage

Afplay is super simple to use!

Play a Local File

let Afplay = require('afplay');

// Instantiate a new player
let player = new Afplay;

// Play a sound, handle result within a Promise
player.play('/tmp/my-file.mp3')
  .then(() => {
    console.log('Audio done playing');
  })
  .catch(error => {
    console.log('Error playing file');
  });

Configure Volume & Play Time

It is possible to configure volume and play time (in seconds).

player.play('/tmp/my-file.mp3', {volume: 100, time: 15})
  .then(() => {
    console.log('Loud, short duration audio done playing');
  })
  .catch(error => {
  	console.log('Error playing file');
  });

Examples

View the examples directory.

Afplay's initial logo was designed by scorpion6 on Fiverr. Font used is Lato Black.

License

This software is licensed under the MIT License. View the license.

Copyright © 2015 Michael K. Squires

Keywords

FAQs

Last updated on 19 May 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc