@nusaplayer/react
v1.0.2
Published
React wrapper for NusaPlayer.
Readme
@nusaplayer/react
React wrapper for NusaPlayer.
Install
npm i @nusaplayer/core @nusaplayer/reactimport ReactPlayer from '@nusaplayer/react'
const plugins = [
ui({
pictureInPicture: true,
slideToSeek: 'always',
screenshot: true,
keyboard: { global: true }
}),
hls()
]
function PlayPage() {
const [source, setSource] = useState<any>()
const player = useRef<Player>(null)
useEffect(() => {
setSource(fetch(`xxxx`).then((it) => it))
}, [lastEpisode])
return (
<ReactPlayer
plugins={plugins}
ref={player}
autoplay={true}
source={source}
duration={lastDuration}
isLive={id == 'iptv'}
onEvent={(e) => {}}
/>
)
}