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

@cinesend/atlas-player-core

v0.2.0

Published

Framework-free playback engine for the CineSend Atlas player: media selection, DRM attachment and play-event reporting.

Readme

@cinesend/atlas-player-core

The framework-free playback engine behind the CineSend Atlas player: which media to play, how to attach it with DRM, how to report on it — and, since the hosted iframe and the React player were reconciled, how their shared controls behave and look.

Most people want @cinesend/atlas-player-react instead. Use this package directly only if you are integrating without React.

npm i @cinesend/atlas-player-core

What it does

  • selectPlayback(media, keySystems) — decides what to play. Atlas sends both an HLS and a DASH manifest when both exist, because it cannot know which key system the client supports: FairPlay rides HLS, Widevine rides DASH. This picks, and falls back to whichever manifest is present.
  • detectKeySystems() — asks the browser which key systems it has. Any failure answers "not FairPlay-only", which routes to DASH/Widevine — the path that works everywhere except Safari, so a detection failure degrades to the common case.
  • attachStream(video, url, drm, signal?) — loads shaka-player on demand and attaches to your <video>. It owns none of the DOM.
  • attachSource(video, source, signal?) — the source path: a live channel's own HLS manifest, or a progressive file. Loads hls.js on demand where the browser has no native HLS, and hands the URL to the element where it does — so Safari never downloads the engine.
  • EventsClient — the play-event loop: heartbeats while playing, a position anchor on pause, and play_end on finish or teardown.
  • bindPageLifecycle(events, options) — reports the page itself going away. A real unload sends play_end; a back/forward-cache entry sends a position anchor and leaves the session open, because the page can come back. Returns the unbind.

The chrome layer

The hosted iframe and @cinesend/atlas-player-react render their own markup — one with innerHTML, one with elements — but everything behind that markup is here, so the two players cannot drift apart again:

  • Behaviour — createStallWatcher (the 400 ms debounce that stops a spinner flashing over live frames), createIdleWatcher (the 5 s fade, pinned while paused), toggleFullscreen / watchFullscreen (the three fallback paths and both event families), playMaybeMuted, keyCommand, seekBy, seekToRatio, remainingLabel, isIOS, prefersMutedAutoplay.
  • chromeIcons — the icon set as path data, plus iconSvg() for a caller building markup as a string.
  • chromeStyles / ensureChromeStyles() — the stylesheet, and the class contract both players render against. A string rather than a .css file, so nothing has to be configured to consume it and nothing is injected unless a player asks.

None of it runs at import and none of it touches a framework. Import only the engine and none of it reaches your bundle.

Attachment ownership

You own the returned handle and must destroy() it, from either attach function. A shaka Player — and an Hls instance — stays attached to the <video> until destroyed, so attaching twice without destroying leaves two engines fighting over one element, and on a live channel the abandoned one keeps pulling segments. Where attachSource needed no engine at all, destroy() still detaches the element (native HLS keeps streaming otherwise), and leaves a newer attachment on the same element alone.

Pass an AbortSignal if the target can change mid-load: the dynamic import, the FairPlay certificate fetch and the manifest load are all awaited, and without it a cancelled attach still completes.

const attached = await attachStream(video, stream.dash, stream.drm, controller.signal);
// later
await attached.destroy();

shaka-player and hls.js are dependencies but dynamically imported, so each lands as a separate chunk in your bundle rather than in your entry — and a consumer who only ever plays one kind of media only ever fetches one of them.

Licence

MIT