npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

osx-wifi-volume-remote

v1.0.4

Published

A web-based html5 / node.js app to control OS X system volume from iPhone, Android, etc

Downloads

13

Readme

Daplie is Taking Back the Internet!

Stop serving the empire and join the rebel alliance!

OS X WiFi Volume Remote

A web-based html5 / node.js app to control OS X system volume from iPhone, Android, etc

Installation & Usage

  1. Get Node.js

  2. Open Terminal

  3. Install osx-wifi-volume-remote like so

     npm install -g osx-wifi-volume-remote
  4. Start the server like so (and note that it shows the name of your computer)

     osx-wifi-volume-server 4040
  5. Type the http://<your-computer-name>.local:4040/ whatever onto your phone's browser (NOTE: Your phone or whatever device must be on the same WiFi or ethernet network as your computer)

  6. Enjoy controlling your MacBook's volume over wifi!

Tunneling outside of your local network

Use with serve-https to be able to use this with your own domain (i.e. <username>.daplie.me) over the Internet (i.e. your laptop on WiFi and your phone on 3g/4g/LTE).

npm install --global daplie-tools
npm install --global [email protected]

git clone https://git.daplie.com/coolaj86/osx-wifi-volume-remote.git

Register a domain with daplie.me:

daplie domains:search

Run the tunnel server

USER=jane               # or whatever
[email protected]  # or whatever

serve-https \
  --servername $USER.daplie.me \
  --agree-tos --email $EMAIL \
  --tunnel \
  --express-app osx-wifi-volume-remote/app.js

Initiate (the very first time) with curl:

curl "https://$USER.daplie.com"

API Example

npm install --save osx-wifi-volume-remote
(function () {
  'use strict';

  var applvol = require('osx-wifi-volume-remote')
    ;

  // All callbacks have the same arguments
  applvol.get(function (err, volume, muted) {
    console.log('Volume is set to ' + volume + '% and is ' + (muted ? '' : 'not ') + 'muted');
  });
}());

API

  • get(cb) read the current volume level and mute status
  • fade(cb, level, duration) specify a volume level to fade to
  • fadeBy(cb, difference, duration) specify a positive or negative difference in volume to fade to
  • mute(cb, duration) fades to 0, mutes, then restores volume while muted
  • unmute(cb, duration) sets volume to 0, unmutes, then fades back in to volume level
  • set(cb, level) hard set a volume without fading
  • all callbacks have the arguments err, volume, muted

NOTE: The callbacks all must come first (it was just easier to write the code that way).

Development

If you want to develop, here's the clone and build process:

git clone https://git.daplie.com/coolaj86/osx-wifi-volume-remote.git
pushd osx-wifi-volume-remote

npm install -g jade
jade browser/index.jade; mv browser/index.html public/

npm install
node app 4040

AppleScript

I had to learn a bit of AppleScript to get this all together. I'll give the gist of it below an you can also read the article on my blog.

# Check volume level and mute status
osascript -e "output volume of (get volume settings) & output muted of (get volume settings)"

# Mute
osascript -e "set volume with output muted"

# Unmute
osascript -e "set volume without output muted"

# Mute status
osascript -e "output muted of (get volume settings)"

# Set volume by 100ths
osascript -e "set volume output volume 51 --100%"

# Set to 0% without muting (the secret lowest possible setting)
osascript -e "set volume without output muted output volume 0 --100%"

# Set to non-0 without unmuting
osascript -e "set volume with output muted output volume 42 --100%"

# Decrement the current volume by 1
osascript -e "set volume output volume (output volume of (get volume settings) - 1) --100%"

It turns out that AppleScript takes about 80ms to start up and run, so for the fade I actually create a file with the whole loop unrolled and it looks like this:

set volume without output muted output volume 18 --100%
delay 0.033
set volume without output muted output volume 17 --100%
delay 0.033
set volume without output muted output volume 16 --100%