livstream-player
Version:
A lightweight livestream player SDK for React apps
28 lines (27 loc) • 1.78 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { useEffect } from 'react';
import { streamCameras } from '../../constants/mock-stream';
import { useLivestream } from '../../contexts/contexts';
import { useLivestreamSDK } from '../../hooks/useLivestreamSDK';
import ViewStreamComponent from '../VideoStream/index';
import { VIEW_STREAM_SERVICE_EXTEND } from '../../constants/system.keys';
function WatchLivestreamComponent() {
const { streamInfo } = useLivestream();
// const { initialize } = useLivestreamSDK();
// useEffect(() => {
// if (!streamInfo || Object.keys(streamInfo).length === 0) {
// initialize({ ...streamCameras[0] });
// }
// }, [streamInfo, initialize]);
return (_jsx(_Fragment, { children: streamInfo && Object.keys(streamInfo).length > 0 && (_jsx("div", { className: 'fsc', children: _jsx(ViewStreamComponent, Object.assign({}, streamInfo, { allScreen: true, isViewAll: true, zoomState: {
dataZoomStates: [
{
resolution: Number(streamInfo.resolution),
zoomState: Number(streamInfo.zoomState)
}
],
zoomState: Number(streamInfo.zoomState),
resolution: Number(streamInfo.resolution)
}, name: streamInfo.name, typeCamera: streamInfo.typeCamera, resolution: Number(streamInfo.resolution), serviceId: VIEW_STREAM_SERVICE_EXTEND.normal, state: streamInfo.state, serial: streamInfo.serial, gatewaySerial: streamInfo.gatewaySerial, thumbnail: streamInfo.thumbnail, permission: streamInfo.permission, isAllowStreaming: streamInfo.isAllowStreaming })) })) }));
}
export default WatchLivestreamComponent;