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

@mebius-io/react

v0.4.2

Published

React hooks for the Mebius Web SDK — a thin layer over @mebius-io/web.

Readme

@mebius-io/react

React hooks untuk Mebius Web SDK — lapisan tipis di atas @mebius-io/web. Konsep inti (auth, mode, events, error code) ada di README @mebius-io/web; di sini fokus API hooks.

npm version license

Install

Sudah live di npm (public). Satu perintah cukup — @mebius-io/web (dependency) dan react (peer) ikut otomatis dari registry:

npm i @mebius-io/react
# atau: pnpm add @mebius-io/react / yarn add @mebius-io/react

Butuh install offline / tanpa registry? Pakai tarball — di mode ini @mebius-io/web TIDAK ikut otomatis, jadi install kedua tarball (web + react) dalam satu perintah. Detail di README @mebius-io/web.

Hooks

| Hook | Return | |---|---| | useMebius({ appId, gateway, token, deliveries?, beaconToken?, beaconUrl?, userId? }) | { client, status, error } | | useBroadcaster(client, options?) | { broadcaster, previewRef, start, stop, switchCamera, setMicEnabled, setCameraEnabled, isLive } | | usePlayer(client, { mode }) | { player, videoRef, play, stop, setVolume, isPlaying } |

Broadcast

import { useMebius, useBroadcaster } from "@mebius-io/react";

function Broadcast({ token }: { token: string }) {
  const { client } = useMebius({ appId: "app_123", gateway: "https://gateway.mebius.io", token });
  const { previewRef, start, stop, switchCamera, setMicEnabled, isLive } = useBroadcaster(client);
  return (
    <div>
      <video ref={previewRef} autoPlay muted playsInline />
      <button onClick={() => (isLive ? stop() : start("my-stream"))}>
        {isLive ? "Stop" : "Go live"}
      </button>
      <button onClick={switchCamera}>Flip</button>
      <button onClick={() => setMicEnabled(false)}>Mute</button>
    </div>
  );
}

Watch

import { useMebius, usePlayer } from "@mebius-io/react";

function Watch({ token, streamId }: { token: string; streamId: string }) {
  const { client } = useMebius({ appId: "app_123", gateway: "https://gateway.mebius.io", token });
  const { videoRef, play, setVolume } = usePlayer(client, { mode: "low-latency" });
  return (
    <div>
      <video ref={videoRef} autoPlay playsInline />
      <button onClick={() => play(streamId)}>Play</button>
      <input type="range" min={0} max={1} step={0.1} onChange={(e) => setVolume(+e.target.value)} />
    </div>
  );
}

Next.js: render komponen ini sebagai client component ("use client") dan import dinamis dengan { ssr: false } karena SDK butuh WebRTC browser.

deliveries / beaconToken / beaconUrl

Ketiganya datang dari response token yang sama, dan diteruskan apa adanya ke @mebius-io/web:

const { token, deliveries, beaconToken, beaconUrl } = await (await fetch("/api/mebius-token")).json();
const { client } = useMebius({ appId, gateway, token, deliveries, beaconToken, beaconUrl });
  • deliveries — rute playback pilihan gateway. Tanpa itu playback tetap jalan, tapi setiap penonton dilayani dari origin Mebius, bukan edge terdekat. Memoize array-nya: identitas array baru tiap render me-reconnect client, sama seperti token yang berubah.
  • beaconToken + beaconUrl — mengisi Quality → Publish / Play di dashboard Mebius dan jadi dasar hitung viewer minutes. Tanpa keduanya stream jalan normal, kamu cuma tak melihat data kualitasnya. Aman di client: kredensialnya terikat klaim bertanda tangan ke satu stream dan satu project. Tambah userId kalau ingin laporan membawa id penggunamu.

Mengubah beaconToken atau beaconUrl me-reconnect client, sama seperti token.

License

MIT