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

hyper-media-control

v1.5.3

Published

Extensible media player controller for Hyper.

Downloads

12

Readme

hyper-media-control

License hyper GitHub issues hyper-media-control

Extensible media player controller for Hyper. Displays the song currently playing in your media player at the bottom of the terminal and allows you to control your favorite music.

This is an empty shell for media player control. You must install another plugin for the media player of your choice.

hyper-media-control

Installation

Add hyper-media-control to your Hyper configuration, plus any control plugins you want.

Configuration

Configuration will depend largely on the control plugins you have installed, but there are some global configuration options available.

module.exports = {
    config: {
        ...
        hyperMedia : {
            showArtwork: true, // True if artwork should appear in the bottom right corner.
            autoPause: false, // If true, will attempt to pause when you switch away from a player.
            autoResume: false, // If true, will attempt to resume when you switch to a new player.
            shuffleRepeat: true, // If true, will show the shuffle / repeat buttons on the bottom bar.
            // Control plugins will place their config here.
        }
        ...
    }
}

Control Plugins

Here's a list of known control plugins. Submit a pull request if you create one!

Name | Description | Downloads ---- | ----------- | --------- hyper-media-control-gpmdp | Connect to GPMDP | hyper-media-control-gpmdp hyper-media-control-vlc | Connect to VLC Media Player | hyper-media-control-vlc hyper-media-control-foobar2000-httpcontrol | Connect to foobar2000 via the foo_httpcontrol component. | hyper-media-control-foobar2000-httpcontrol hyper-media-control-upnp | Connect to UPNP devices on your network. | hyper-media-control-upnp hyper-media-control-spotify-local | Connect to Spotify via the local web server. | hyper-media-control-spotify-local hyper-media-control-cast | Connect to Google Cast devices on your network. | hyper-media-control-cast

Development

This package relies on hyper-plugin-extend for integrating with control plugins. The parent plugin name is hyper-media-control.

To create a media control plugin, create a class that derives from EventEmitter and contains the following events / methods:

Method / Event Name | Description ----------- | ----------- constructor(playerManager, config) | Constructs a new instance of this player controller. The first argument is the PlayerManager instance from hyper-media-control. The second argument is the hyperMedia object from config in .hyper.js. playerName() | Returns the name of the player. By convention, this is all lowercase. iconUrl() | Returns a URL to the icon for the player. This should be 64x64 pixels. activate() | Activates the player, enabling it to return events. deactivate() | Deactivates the player, shutting down events. status | Emitted whenever a new status object is available. First argument is a Status object describing player status. playlist | Emitted whenever a new playlist is available. First argument is an array of Track objects. This event is currently unused.

Status object structure:

{
    isRunning: true | false, // True if the player this is intended to control is running. False otherwise.
    state: 'playing' | 'paused' | 'stopped', // The state of playback.
    progress: 3000, // Progress through the track, in milliseconds. This field is optional.
    repeat: 'one' | 'all' | 'none', // The player's repeat setting. This field is optional.
    shuffle: true | false, // The player's shuffle status. This field is optional.
    volume: 0.5, // The player's volume setting, as a fraction of 1. This field is currently unused.
    track: { ... } // A Track object representing the currently playing track.
}

Track object structure:

{
    name: 'name', // The playing track's name.
    artist: 'artist', // The playing track's artist.
    coverUrl: '...' // A URL pointing to this track's album art. This field is optional.
    duration: 3000 // The total length of the current track, in milliseconds. This field is optional.
}

The following methods are not required, but when implemented, enable hyper-media-control to control playback.

Method Name | Description ----------- | ----------- playPause() | Toggles playback. Can optionally return a Promise for a Status object. nextTrack() | Moves playback to the next track. Can optionally return a Promise for a Status object. previousTrack() | Moves playback to the previous track. Can optionally return a Promise for a Status object. toggleRepeat() | Cycle through available repeat modes. Can optionally return a Promise for a Status object. toggleShuffle() | Toggles shuffling. Can optionally return a Promise for a Status object. changeLibrary() | Attempts to move to the next available library, allowing the user to cycle through possible control targets. Return value is not used.

Special Thanks

Special thanks to @panz3r and his Hyper plugin hyper-spotify for inspiring me to create this plugin. I learned a lot about React and Hyper studying his code. Go give him a star/follow!