About this project
Xosms is a cross-platform native media service library built in Rust and exposed to Node.js, intended for integration with the media service of the host platform. According to the README, it supports Windows, macOS, and Linux (via MPRIS).
The API centres on a MediaPlayer class. Developers create an instance with an identifier and display name, then set metadata such as title, artist, album title, volume, playback rate and allowed minimum/maximum playback rates. It also exposes flags for next, previous, play, pause, stop and seek buttons, a fullscreen flag, and a thumbnail created through MediaPlayerThumbnail.create(uri, url).
Event handling is done through callbacks, which may be asynchronous; the library waits for each callback to finish before processing the next media service event. Documented callbacks cover button presses, position changes, seek requests, loop changes, rate changes, shuffle changes and volume changes.
Changes to MediaPlayer properties are presented only after calling update(). The player is registered to the platform with activate(), and resources should be released with dispose() to avoid relying on garbage collection for platform natives. The helper platformSharesMediaPlayers() detects platforms such as macOS where the media service is a singleton per process, in which case only a single MediaPlayer instance should be used.
For local development, the project requires Rust and pnpm; after cloning, pnpm and pnpm build are used to install dependencies and build.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.