nowhear
Cross-platform library for monitoring media playback information in Rust.
Features
- 🎵 Get currently playing media information across Linux, macOS, and Windows
- 📡 Subscribe to media events via async streams
- 🔄 Unified API across all platforms
- ⚡ Async/await support with Tokio
- 🦀 Pure Rust implementation
Supported Platforms
| Platform | API | Supported Players |
|---|---|---|
| Linux | MPRIS (D-Bus) | Spotify, VLC, Rhythmbox, Chromium, Firefox, and any MPRIS-compatible player |
| macOS | AppleScript (JXA) | Music.app, Spotify |
| Windows | Windows Media Control | Spotify, Windows Media Player, VLC, iTunes, Chrome/Edge, and any SMTC-compatible app |
Installation
Add this to your Cargo.toml:
[]
= "0.1"
= { = "1.0", = ["macros", "rt-multi-thread"] }
= "0.3"
Usage
Basic Example
use ;
async
Event Stream Example
use StreamExt;
use ;
async
API Overview
MediaSource Trait
Events
Track Information
Examples
Run the included examples:
# Basic usage - list players and get current playback info
# Stream events - monitor media events in real-time
Platform-Specific Notes
Linux
- Requires D-Bus and MPRIS-compatible media players
- Works out of the box on most modern Linux distributions
- Event-driven architecture using native D-Bus signals for real-time updates
- Build requirements:
libdbus-1-devandpkg-configpackages are required# Debian/Ubuntu # Fedora/RHEL # Arch Linux
macOS
- Uses AppleScript (JXA) to communicate with media players
- Requires macOS 10.10 Yosemite or later (JXA support required)
- Does not launch media applications if they're not already running
- Supports Music.app and Spotify
- Polling interval: 1000ms
Windows
- Uses the Windows Media Control API (Windows 10 version 1809 or later)
- Supports any application that integrates with System Media Transport Controls (SMTC)
- Volume information is not available through the Windows Media Control API
- Polling interval: 1000ms
Development
Run build for all platforms:
Run build for a specific platform:
# Linux
# macOS
# Windows