0
owncast/web/pages/config-video.tsx

69 lines
2.4 KiB
TypeScript
Raw Normal View History

import React, { useContext, useEffect } from 'react';
import { Typography, Form, Slider } from 'antd';
import { ServerStatusContext } from '../utils/server-status-context';
2020-10-29 10:16:13 -07:00
import VideoVariantsTable from './components/config/video-variants-table';
import TextField, { TEXTFIELD_TYPE_NUMBER } from './components/config/form-textfield';
import { TEXTFIELD_DEFAULTS } from './components/config/constants';
2021-01-17 00:40:46 -08:00
import VideoSegmentsEditor from './components/config/video-segments-editor';
2020-10-29 10:16:13 -07:00
const { Title } = Typography;
export default function VideoConfig() {
2021-01-17 00:40:46 -08:00
// const [form] = Form.useForm();
const serverStatusData = useContext(ServerStatusContext);
2021-01-17 00:40:46 -08:00
const { serverConfig } = serverStatusData || {};
const { videoSettings } = serverConfig || {};
// const { numberOfPlaylistItems, segmentLengthSeconds } = videoSettings || {};
2020-10-29 10:16:13 -07:00
2021-01-17 00:40:46 -08:00
// const videoSettings = serverStatusData?.serverConfig?.videoSettings;
// const { numberOfPlaylistItems, segmentLengthSeconds } = videoSettings || {};
// const initialValues = {
// numberOfPlaylistItems,
// segmentLengthSeconds,
// };
2020-10-29 10:16:13 -07:00
2021-01-17 00:40:46 -08:00
// useEffect(() => {
// form.setFieldsValue(initialValues);
// }, [serverStatusData]);
2020-10-29 10:16:13 -07:00
2021-01-17 00:40:46 -08:00
// const handleResetValue = (fieldName: string) => {
// const defaultValue = TEXTFIELD_DEFAULTS.videoSettings[fieldName] && TEXTFIELD_DEFAULTS.videoSettings[fieldName].defaultValue || '';
2020-10-29 10:16:13 -07:00
2021-01-17 00:40:46 -08:00
// form.setFieldsValue({ [fieldName]: initialValues[fieldName] || defaultValue });
// }
2020-10-29 10:16:13 -07:00
2021-01-17 00:40:46 -08:00
// const extraProps = {
// handleResetValue,
// initialValues: videoSettings,
// configPath: 'videoSettings',
// };
2020-10-29 10:16:13 -07:00
return (
<div className="config-video-variants">
<Title level={2}>Video configuration</Title>
2021-01-17 00:40:46 -08:00
<p>Learn more about configuring Owncast <a href="https://owncast.online/docs/configuration">by visiting the documentation.</a></p>
2020-10-29 10:16:13 -07:00
2021-01-17 00:40:46 -08:00
{/* <div style={{ wordBreak: 'break-word'}}>
{JSON.stringify(videoSettings)}
2021-01-17 00:40:46 -08:00
</div> */}
<VideoSegmentsEditor />
<br /><br />
{/* <div className="config-video-misc">
<Form
form={form}
layout="vertical"
>
<TextField fieldName="numberOfPlaylistItems" type={TEXTFIELD_TYPE_NUMBER} {...extraProps} />
<TextField fieldName="segmentLengthSeconds" type={TEXTFIELD_TYPE_NUMBER} {...extraProps} />
</Form>
2021-01-17 00:40:46 -08:00
</div> */}
2021-01-10 02:37:22 -08:00
<VideoVariantsTable />
2020-10-29 10:16:13 -07:00
</div>
);
}