2021-01-09 13:12:14 -08:00
|
|
|
import React, { useContext, useEffect } from 'react';
|
|
|
|
import { Typography, Form, Slider } from 'antd';
|
2020-11-13 04:43:27 -08:00
|
|
|
import { ServerStatusContext } from '../utils/server-status-context';
|
2020-10-29 10:16:13 -07:00
|
|
|
|
2021-01-09 13:12:14 -08: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';
|
2021-01-09 13:12:14 -08:00
|
|
|
|
2020-10-29 10:16:13 -07:00
|
|
|
const { Title } = Typography;
|
|
|
|
|
2021-01-09 13:12:14 -08:00
|
|
|
export default function VideoConfig() {
|
2021-01-17 00:40:46 -08:00
|
|
|
// const [form] = Form.useForm();
|
2021-01-09 13:12:14 -08:00
|
|
|
const serverStatusData = useContext(ServerStatusContext);
|
2021-01-17 00:40:46 -08:00
|
|
|
const { serverConfig } = serverStatusData || {};
|
|
|
|
const { videoSettings } = serverConfig || {};
|
2021-01-09 13:12:14 -08:00
|
|
|
// 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-11-19 21:56:29 -08:00
|
|
|
|
2020-10-29 10:16:13 -07:00
|
|
|
return (
|
2021-01-09 13:12:14 -08:00
|
|
|
<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'}}>
|
2021-01-16 19:46:19 -08:00
|
|
|
{JSON.stringify(videoSettings)}
|
2021-01-17 00:40:46 -08:00
|
|
|
</div> */}
|
|
|
|
|
|
|
|
<VideoSegmentsEditor />
|
|
|
|
|
|
|
|
<br /><br />
|
|
|
|
{/* <div className="config-video-misc">
|
2021-01-09 13:12:14 -08:00
|
|
|
<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
|
|
|
|
2021-01-09 13:12:14 -08:00
|
|
|
<VideoVariantsTable />
|
2020-10-29 10:16:13 -07:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|