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

@kirknock/node-openxr-video-source

v0.1.1

Published

Live phone camera feeds in a Node.js OpenXR scene: the xrcam protocol client (encrypted WebSocket, reconnects, pause/resume), H.264 decoding through the system's libavcodec (VAAPI, NVDEC or software, via koffi) in one worker per feed, and Babylon.js video

Readme

@kirknock/node-openxr-video-source

CI npm

Live phone camera feeds as video panes in a Node.js OpenXR scene (Babylon.js, WebGL2 or WebGPU). Each feed is one phone running the Android camera app (node-openxr-android-camera-server, protocol in its PROTOCOL.md).

  • video-source-api/: the xrcam protocol client, no Babylon: protocol.ts, stream-choice.ts and xrcam-socket.ts (copies from node-openxr-android-camera-web, kept in step with it), and VideoPanelAPI (video-panel-api.ts: the lasting connection, reconnects, pause/resume, supportedModes()).
  • video-source-node/: the video in the scene: libav.ts + h264-decoder.ts (libavcodec through koffi), feed-worker.ts + video-feed.ts (one worker per feed), frame-slots.ts (shared-memory triple buffer), nv12-material.ts, video-pane.ts (VideoPane), video-pane-plugin.ts (VideoPanePlugin), video-pane-config.ts (VideoPaneConfig, the "videoPanes" section of an app's config file). Tool: openxr-video-probe-decoder.

Linux only, Node.js ≥ 24. Decoding uses the system's libavcodec, FFmpeg 6, 7 or 8 (Ubuntu 24.04: libavcodec60). Hardware decoding needs the VAAPI driver (vainfo should list H.264) or the NVIDIA driver; a hardware decoder that doesn't open falls back to software, and the log says why. openxr-video-probe-decoder lists which decoders open.

Install

npm install @kirknock/node-openxr-video-source @babylonjs/[email protected] [email protected] @napi-rs/[email protected]

The peers are shared with the @kirknock/node-openxr-* platform packages. Modules are imported by path, e.g. @kirknock/node-openxr-video-source/video-source-node/video-pane-plugin.js.

Usage

import { VideoPaneConfig } from "@kirknock/node-openxr-video-source/video-source-node/video-pane-config.js";
import { VideoPanePlugin } from "@kirknock/node-openxr-video-source/video-source-node/video-pane-plugin.js";

const config = VideoPaneConfig.fromJSON(json.videoPanes ?? {});
const plugin = new VideoPanePlugin(scene, xr, config); // one feed + pane per entry
// later: plugin.storePoses() writes the panes' poses back into config; save it yourself

VideoPane draws its messages ("Waiting for feed", "Paused") with the font at assets/fonts/DejaVuSans-Bold.ttf, relative to the working directory (the app ships it); without it the system's font is used.

How the video moves:

  1. One worker thread per feed (feed-worker.ts) holds the WebSocket and its decryption, the protocol and the decoder, so the XR frame loop never waits on the network.
  2. Falling behind: when the oldest waiting frame is more than 100 ms old, the worker drops frames to the next keyframe and asks the phone for one.
  3. Handover: the decoded picture, packed NV12, goes into a triple buffer in shared memory (frame-slots.ts); neither side waits.
  4. Upload: each rendered frame uploads it, only when new, into an R8 luma and an RG8 chroma texture; a GLSL or WGSL shader converts it to RGB (nv12-material.ts).

Development

npm ci
npm run build        # dist/
npm run lint && npm run typecheck
npm run test:pure    # config, xrcam protocol, frame slots, decoder, a feed against fake phones (libavcodec 60+)
npm run test:gl      # EGL/GLES 3 context (llvmpipe ok): VideoPane's NV12 shader
npm run probe:decoder
npm run fake-phone -- <key> [port]   # serves tests/fixtures/camera.xrcam over xrcam, no phone needed

Tests run on the nodexr-test runner from @kirknock/node-openxr-core.

Releasing

Bump version in package.json, commit, then push a matching tag:

npm version patch    # or minor / major / prerelease --preid beta
git push --follow-tags

The Release workflow checks the tag, lints, runs the pure and gl tests (gl on Mesa llvmpipe), publishes to npm via trusted publishing (with provenance) and creates a GitHub release with the tarball attached.

License

MIT