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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nomercy-entertainment/media-session

v0.2.3

Published

Media Session API for Capacitor and web

Downloads

86

Readme

MediaSession for Capacitor & Web

NPM Version NPM Downloads License

TypeScript Framework Agnostic GitHub Stars


About

A cross-platform Media Session API wrapper for Capacitor and web. Provides unified media controls, metadata, and playback state management for audio/video apps.

Empowers media experiences in NoMercyTV and other NoMercy projects.


Features

  • Unified API: Works seamlessly on web and Capacitor platforms
  • Media Metadata: Set title, artist, album, and artwork
  • Playback State: Control and reflect play, pause, stop, etc.
  • Position State: Sync duration, position, and playback rate
  • Action Handlers: Respond to play, pause, seek, next/previous, and more
  • TypeScript Support: Full typings for safe integration
  • Framework Agnostic: Use with any frontend framework

🚀 Quick Start

Installation

npm install @nomercy-entertainment/media-session

Basic Usage

import MediaSession from '@nomercy-entertainment/media-session';

const mediaSession = new MediaSession();

// Set metadata
mediaSession.setMetadata({
  title: 'Song Title',
  artist: 'Artist Name',
  album: 'Album Name',
  artwork: 'https://example.com/artwork.jpg'
});

// Set playback state
mediaSession.setPlaybackState('playing');

const audioElement = document.createElement('audio');

// Set position state
mediaSession.setPositionState({
  duration: audioElement.duration,
  playbackRate: audioElement.playbackRate,
  position: audioElement.currentTime
});

// Set action handlers
mediaSession.setActionHandler({
  play: () => audioElement.play(),
  pause: () => audioElement.pause(),
  stop: () => {
    audioElement.pause();
    audioElement.currentTime = 0;
    audioElement.removeAttribute('src');
  },
  previous: () => {},
  next: () => {},
  seek: (time) => audioElement.currentTime = time,
  getPosition: () => audioElement.currentTime,
});

🎛️ Advanced Features

Media Session Integration

  • Native OS media controls (lock screen, notification, hardware buttons)
  • Customizable action handlers for all major media events
  • Automatic artwork resizing for platform compatibility

🔧 Browser & Platform Support

| Feature | Chrome | Firefox | Safari | Edge | |-------------------|:------:|:-------:|:------:|:----:| | Media Session API | ✅ | ✅ | ✅ | ✅ | | Capacitor | ✅ | N/A | N/A | N/A |


🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
https://github.com/NoMercy-Entertainment/MediaSession.git
cd MediaSession

# Install dependencies
npm install

# Build and test
npm run build
npm run test

📄 License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.


🏢 About NoMercy Entertainment

NoMercy Entertainment builds open-source media tools that give developers full control over their audio and video.

Our Ecosystem

Links


Built with ❤️ by the NoMercy Engineering Team