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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@silver-zepp/easy-media

v1.1.5

Published

EasyMedia - Sound Player and Recorder Library for ZeppOS.

Downloads

81

Readme

EasyMedia - Sound Player and Recorder Library for ZeppOS

The EasyMedia library provides two classes, SoundPlayer and SoundRecorder, for playing and recording sounds. The library further encapsulates our raw approach, is more user-friendly, and introduces extra features like play queue, play cancelation, and more.

Install the library from NPM registry

npm i @silver-zepp/easy-media

SoundPlayer

The SoundPlayer class allows you to play sound files. Here's an example of how to use it:

import { SoundPlayer } from '@silver-zepp/easy-media';

// create a new SoundPlayer
const player = new SoundPlayer(); 
player.play("assets://raw/media/my-sound.mp3"); // play any file by its path
// or
const player = new SoundPlayer({ file: "my-sound.mp3" }); 
player.play();  // plays the first file

// in case later you have to change the file (.mp3, .opus)
player.changeFile('path-to-another-audio-file');  // stops the first file and prepares the second one

// pause the playing sound
player.pause()

// resume playback
player.resume()

// stops the playing sound
player.stop();

// setters/getters
// (!) NOTE the change from `player.get.volume` to `player.get.volume()`
const volume = player.get.volume();       // get the current playback volume
const duration = player.get.duration();   // get the total duration of the currently playing media file
const title = player.get.title();         // get the title of the currently playing media file
const artist = player.get.artist();       // get the artist of the currently playing media file
const media_info = player.get.mediaInfo();// get the media info of the currently playing media file
const status = player.get.status();       // get the current status of the player

player.set.volume(50);  // set the playback volume to 50%

// ======================
// NEW (!) ADD: 1/19/2025
// ======================

// more verbose logs from the library (1-3), default 1 (critical logs)
SoundPlayer.SetLogLevel(3); 

// destroy the player and its callbacks
player.destroy(); 

// on play complete callback with usefull info
player.onComplete((info) => {
  // ...print filename, path, full path and exact duration in milliseconds
  console.log(`Name: ${info.name}`);
  // can print duration below 1s which the Media library missing - ie 324ms
  console.log(`Duration: ${info.duration} ms`); 
  console.log(`Full path: ${info.full_path}`);
  console.log(`Path: ${info.path}`);  
});

// reduce the fail detection timeout (default 3000ms). 
// lower numbers are less stable.
player.setFailTimeout(2000);

// executes if the playback fails
player.onFail((info) => {
  console.log(`Failed to play ${info.name}.`);
});

// check if the device has a speaker
player.isSpeakerAvailable((bool)=> {
  if (bool) {
    console.log("Speaker OK.");
  } else {
    console.log("Speaker NOT available.");
    console.log("Try connecting BLE Headphones.");
  }
})

// status name getter 
// IDLE, INITIALIZED, PREPARING, PREPARED, STARTED, PAUSED
const status = player.get.statusName();

// more status getters in the Get subclass: 
const is_playing = player.get.isPlaying(); 
player.get.isPaused();
player.get.isStopped();

Methods

play():

Starts playing the sound. If the sound is already playing, it stops and prepares the sound again.

stop():

Stops the sound. If the sound is playing, it stops the sound and releases the player.

changeFile(filename):

Changes the sound file to play.

destroy():

Destroys the player. If the sound is playing, it stops the sound and removes event listeners.

SoundRecorder

The SoundRecorder class allows you to record sounds. Here’s an example of how to use it:

import { SoundRecorder } from '@silver-zepp/easy-media/recorder';

const recorder = new SoundRecorder('mic-recording.opus');
recorder.start();

Methods

start():

Starts recording.

stop():

Stops recording.

changeFile(target_file):

Changes the target file for the recording.