@booyaka101/fudog-js
v1.0.0
Published
React NDI preview component for MJPEG streams on Linux.
Maintainers
Readme
@booyaka101/fudog-js
React components for previewing NDI sources via MJPEG streams on Linux.
Installation
npm install @booyaka101/fudog-js
# or
yarn add @booyaka101/fudog-jsUsage
import NDIPreview, { MJPEG } from '@booyaka101/fudog-js'
function Example() {
return (
<NDIPreview
sourceName="NDI Source Name"
sessionId="unique-session-id"
baseUrl="http://localhost:3000" // your backend providing /preview
maxHeight={300}
showLabel
/>
)
}NDIPreview internally uses the MJPEG component to render a live MJPEG stream from:
${baseUrl}/preview?stream=${encodeURIComponent(sourceName)}&session=${encodeURIComponent(sessionId)}Peer dependencies
This package expects the following to be present in your app:
- react
- react-dom
- @mui/material
- @emotion/react
- @emotion/styled
Development
- Build:
npm run build - Watch build:
npm run dev - The package is built with
tsupand outputs both CJS (dist/index.cjs) and ESM (dist/index.js).
API
NDIPreview
sourceName– NDI source name to preview (required for preview)sessionId– unique session identifierbaseUrl– base URL of your backend (e.g.http://localhost:3000)maxHeight– maximum height in pixels (default: 300)showLabel– whether to show the source name label (default: true)containerSx– MUIsxfor the outerPaperpaperProps– props forwarded to the outerPaperpreviewBoxProps– props forwarded to the inner previewBoxmjpegProps– additional props forwarded to the underlyingMJPEGcomponent
MJPEG
url– MJPEG stream URLcontainerSx– MUIsxfor the outer containerframeSx– MUIsxfor the frame wrapperonResolution(width, height)– called when the stream resolution is knownmaxRetries– maximum number of retry attempts (default: 3)retryDelay– delay between retries in ms (default: 1000)connectTimeout– timeout before considering the initial connection as failed (default: 1500ms)onLoad()– called when the stream has loadedonError(error)– called when an error occursonLoadingChange(loading)– called whenever loading state changesdebug– enables verbose console logging when true
Publishing
Log in to npm:
npm loginBuild:
npm run build(Optional) Test the tarball:
npm packPublish as public scoped package:
npm publish --access public
