Fusion Player is a higher-level wrapper built on top of the Lite Player. It supports pluggable Widget components and comes with a set of built-in control methods — ready to use out of the box.
If your business scenario requires built-in features like snapshot, recording, two-way talk, PTZ control, battery status display, etc., with no need to develop them from scratch, Fusion Player is your best choice.
Additionally, Fusion Player supports customization and extension to meet your personalized needs.
The player exposes a variety of data externally, such as whether it is currently in fullscreen mode, or whether two-way talk is active.
For details, please refer to the RetAtom type data in the return value of the useCtx API.
To avoid unnecessary updates caused by unrelated data changes, the exposed data is wrapped with jotai.
To access the actual state values, you need to use useStore.
Widget is a customizable component rendered on top of the player.
You can dynamically insert or remove widgets using instance methods like addContent and deleteContent returned from the useCtx hook.
The props of each Widget automatically receive the context object from the useCtx hook, making it easy to access player state and control APIs within the component.
Widgets shown in the diagram — such as battery level, temperature & humidity, two-way talk, and fullscreen toggle — are common widgets provided by the platform.
You can insert them easily via API, as demonstrated below:
import { useEffect } from 'react'import { useCtx, IPCPlayerIntegration, Features } from '@ray-js/ipc-player-integration';import '@ray-js/ipc-player-integration/iconfont/iconfont.css';function Page() { const deviceId = '1234567890xxxxxx'; const instance = useCtx({ devId: deviceId, }); useEffect(() => { // Initialize Widgets // Calling this method will add all the widgets used in the project to the player Features.initPlayerWidgets(instance); }, []) return ( <IPCPlayerIntegration instance={instance} devId={deviceId} /> )}
Calling Features.initPlayerWidgets will add the same widgets to the player as those on the current component.
The Features.initPlayerWidgets method accepts some parameters. For details, please refer to: initPlayerWidgets
The event system is implemented using a publish-subscribe model.
It allows communication between Widgets, or external components to receive information from Widgets, while keeping them decoupled.
The event system instance can be accessed from the return value of useCtx.
Each player instance has its own independent event system.