
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
@interactify-live/player-react
Advanced tools
A React component for playing interactive media with MQTT connectivity.
A React component for playing interactive media with MQTT connectivity.
npm install @interactify-live/player-react
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}
/>
);
}
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);
}}
/>
);
}
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,
});
}
};
You can publish events (like "like" actions):
const handleLike = () => {
if (playerRef.current) {
playerRef.current.publishEvent("like");
}
};
| 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) |
interface MediaObject {
id: string;
type: "video" | "image";
url: string;
thumbnail?: string;
alt?: string;
}
interface ConnectionOptions {
user_id: string;
token: string;
scope: "short" | "live";
space_slug: string;
slug: string;
session: string;
display_name: string;
brokerUrl?: string;
}
| 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 |
interface MessageObject {
text: string;
avatar?: string;
displayName?: string;
visible?: boolean;
replyTo?: {
text: string;
userID: string;
displayName: string;
};
}
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;
};
}
The connection can have the following statuses:
"CONNECTING" - Attempting to connect"CONNECTED" - Successfully connected"RECONNECTING" - Attempting to reconnect"OFFLINE" - Disconnected"ERROR" - Connection errorISC
FAQs
A React component for playing interactive media with MQTT connectivity.
We found that @interactify-live/player-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.