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

@interactify-live/player-react

v1.0.25

Published

A React component for playing interactive media with MQTT connectivity.

Readme

@interactify-live/player-react

A React component for playing interactive media with MQTT connectivity.

Features

  • Video and image playback
  • Interactive elements overlay
  • MQTT real-time messaging
  • Connection status management
  • Message subscription capabilities

Installation

npm install @interactify-live/player-react

Basic Usage

import React, { useRef } from "react";
import {
  InteractifyPlayer,
  InteractifyPlayerHandle,
} from "@interactify-live/player-react";

function App() {
  const playerRef = useRef<InteractifyPlayerHandle>(null);

  const handleStatusChange = (status: string) => {
    console.log("Connection status:", status);
  };

  const handleMessagesReceived = (messages: any[]) => {
    console.log("New messages received:", messages);
    // Handle new messages here
  };

  return (
    <InteractifyPlayer
      ref={playerRef}
      media={{
        id: "video1",
        type: "video",
        url: "https://example.com/video.mp4",
      }}
      interactions={[]}
      options={{
        user_id: "user123",
        token: "your-token",
        scope: "short",
        space_slug: "space1",
        slug: "video1",
        session: "session123",
      }}
      onStatusChange={handleStatusChange}
      onMessagesReceived={handleMessagesReceived}
    />
  );
}

Advanced Usage - Manual Message Subscription

You can also subscribe to messages manually using the player ref:

import React, { useRef, useEffect } from "react";
import {
  InteractifyPlayer,
  InteractifyPlayerHandle,
} from "@interactify-live/player-react";

function App() {
  const playerRef = useRef<InteractifyPlayerHandle>(null);

  useEffect(() => {
    if (playerRef.current) {
      // Subscribe to new messages
      const unsubscribe = playerRef.current.subscribeToNewMessages(
        (message) => {
          console.log("New message received:", message.text);
          console.log("From:", message.display_name);
          console.log("Timestamp:", message.created_at);
        }
      );

      // Cleanup subscription on unmount
      return unsubscribe;
    }
  }, []);

  return (
    <InteractifyPlayer
      ref={playerRef}
      media={{
        id: "video1",
        type: "video",
        url: "https://example.com/video.mp4",
      }}
      interactions={[]}
      options={{
        user_id: "user123",
        token: "your-token",
        scope: "short",
        space_slug: "space1",
        slug: "video1",
        session: "session123",
      }}
      onNewMessageReceived={(message) => {
        console.log("New message received:", message.text);
      }}
    />
  );
}

Sending Messages

You can send messages using the player ref:

const handleSendMessage = () => {
  if (playerRef.current) {
    playerRef.current.sendMessage({
      text: "Hello, world!",
      displayName: "User Name",
      avatar: "https://example.com/avatar.jpg",
      visible: true,
    });
  }
};

Publishing Events

You can publish events (like "like" actions):

const handleLike = () => {
  if (playerRef.current) {
    playerRef.current.publishEvent("like");
  }
};

Props

InteractifyPlayerProps

| Prop | Type | Required | Description | | ---------------------- | -------------------------- | -------- | ------------------------------------------- | | media | MediaObject | Yes | Media configuration | | interactions | any[] | Yes | Array of interactive elements | | options | ConnectionOptions | No | MQTT connection options | | onStatusChange | (status: string) => void | No | Connection status callback | | onNewMessageReceived | (message: any) => void | No | New message received callback | | autoPlay | boolean | No | Auto-play media (default: false) | | muted | boolean | No | Mute media (default: false) | | loop | boolean | No | Loop media (default: false) | | isDraggable | boolean | No | Enable interaction dragging (default: true) |

MediaObject

interface MediaObject {
  id: string;
  type: "video" | "image";
  url: string;
  thumbnail?: string;
  alt?: string;
}

ConnectionOptions

interface ConnectionOptions {
  user_id: string;
  token: string;
  scope: "short" | "live";
  space_slug: string;
  slug: string;
  session: string;
  display_name: string;
  brokerUrl?: string;
}

Methods

InteractifyPlayerHandle

| Method | Parameters | Returns | Description | | ---------------------------------- | ------------------------ | ------------ | ------------------------- | | play() | - | void | Play the media | | pause() | - | void | Pause the media | | mute() | - | void | Mute the media | | unmute() | - | void | Unmute the media | | getCurrentTime() | - | number | Get current playback time | | setCurrentTime(time) | number | void | Set playback time | | isMuted() | - | boolean | Check if muted | | isPlaying() | - | boolean | Check if playing | | sendMessage(message) | MessageObject | void | Send a chat message | | publishEvent(type) | string | void | Publish an event | | subscribeToNewMessages(callback) | (message: any) => void | () => void | Subscribe to new messages |

MessageObject

interface MessageObject {
  text: string;
  avatar?: string;
  displayName?: string;
  visible?: boolean;
  replyTo?: {
    text: string;
    userID: string;
    displayName: string;
  };
}

Message Structure

Messages received from the MQTT connection have the following structure:

interface ShortMessage {
  avatar: string;
  text: string;
  created_at: string;
  user_id: string;
  display_name: string;
  live_slug: string;
  space_slug: string;
  visible: boolean;
  slug: string;
  reply_to?: {
    text: string;
    user_id: string;
    display_name: string;
  };
}

Connection Status

The connection can have the following statuses:

  • "CONNECTING" - Attempting to connect
  • "CONNECTED" - Successfully connected
  • "RECONNECTING" - Attempting to reconnect
  • "OFFLINE" - Disconnected
  • "ERROR" - Connection error

License

ISC