// This content populates the video variant modal, which is spawned from the variants table. import React from 'react'; import { Slider, Switch, Collapse, Typography } from 'antd'; import { FieldUpdaterFunc, VideoVariant, UpdateArgs } from '../../types/config-section'; import TextField from './form-textfield'; import { DEFAULT_VARIANT_STATE } from '../../utils/config-constants'; import InfoTip from '../info-tip'; import CPUUsageSelector from './cpu-usage'; const { Panel } = Collapse; const VIDEO_VARIANT_DEFAULTS = { framerate: { min: 10, max: 90, defaultValue: 24, unit: 'fps', incrementBy: 1, tip: 'You prob wont need to touch this unless youre a hardcore gamer and need all the bitties', }, videoBitrate: { min: 600, max: 6000, defaultValue: 1200, unit: 'kbps', incrementBy: 100, tip: 'This is importatnt yo', }, audioBitrate: { min: 600, max: 1200, defaultValue: 800, unit: 'kbps', incrementBy: 100, tip: 'nothing to see here', }, videoPassthrough: { tip: 'If No is selected, then you should set your desired Video Bitrate.', }, audioPassthrough: { tip: 'If No is selected, then you should set your desired Audio Bitrate.', }, scaledWidth: { fieldName: 'scaledWidth', label: 'Resized Width', maxLength: 4, placeholder: '1080', tip: "Optionally resize this content's width.", }, scaledHeight: { fieldName: 'scaledHeight', label: 'Resized Height', maxLength: 4, placeholder: '720', tip: "Optionally resize this content's height.", }, }; interface VideoVariantFormProps { dataState: VideoVariant; onUpdateField: FieldUpdaterFunc; } export default function VideoVariantForm({ dataState = DEFAULT_VARIANT_STATE, onUpdateField, }: VideoVariantFormProps) { const handleFramerateChange = (value: number) => { onUpdateField({ fieldName: 'framerate', value }); }; const handleVideoBitrateChange = (value: number) => { onUpdateField({ fieldName: 'videoBitrate', value }); }; const handleVideoPassChange = (value: boolean) => { onUpdateField({ fieldName: 'videoPassthrough', value }); }; const handleVideoCpuUsageLevelChange = (value: number) => { onUpdateField({ fieldName: 'cpuUsageLevel', value }); }; const handleScaledWidthChanged = (args: UpdateArgs) => { const value = Number(args.value); // eslint-disable-next-line no-restricted-globals if (isNaN(value)) { return; } onUpdateField({ fieldName: 'scaledWidth', value: value || '' }); }; const handleScaledHeightChanged = (args: UpdateArgs) => { const value = Number(args.value); // eslint-disable-next-line no-restricted-globals if (isNaN(value)) { return; } onUpdateField({ fieldName: 'scaledHeight', value: value || '' }); }; const framerateDefaults = VIDEO_VARIANT_DEFAULTS.framerate; const framerateMin = framerateDefaults.min; const framerateMax = framerateDefaults.max; const framerateUnit = framerateDefaults.unit; const videoBitrateDefaults = VIDEO_VARIANT_DEFAULTS.videoBitrate; const videoBRMin = videoBitrateDefaults.min; const videoBRMax = videoBitrateDefaults.max; const videoBRUnit = videoBitrateDefaults.unit; const selectedVideoBRnote = `Selected: ${dataState.videoBitrate}${videoBRUnit} - it sucks`; const selectedFramerateNote = `Selected: ${dataState.framerate}${framerateUnit} - whoa there`; const selectedPresetNote = ''; return (
Say a thing here about how this all works. Read more{' '} here.
{VIDEO_VARIANT_DEFAULTS.videoBitrate.tip}