From bc27ded3f3b0189f45761acf272a85e592a6649a Mon Sep 17 00:00:00 2001 From: gingervitis Date: Sat, 20 Feb 2021 15:14:50 -0800 Subject: [PATCH] add video passthrough field --- .../config/form-status-indicator.tsx | 4 +- web/components/config/video-variant-form.tsx | 108 ++++++++++++------ web/styles/config-video-variants.scss | 7 +- 3 files changed, 80 insertions(+), 39 deletions(-) diff --git a/web/components/config/form-status-indicator.tsx b/web/components/config/form-status-indicator.tsx index a80fd75c6..8d1fb38ee 100644 --- a/web/components/config/form-status-indicator.tsx +++ b/web/components/config/form-status-indicator.tsx @@ -14,9 +14,9 @@ export default function FormStatusIndicator({ status }: FormStatusIndicatorProps empty: !message, }); return ( -
+ {icon ? {icon} : null} {message ? {message} : null} -
+ ); } diff --git a/web/components/config/video-variant-form.tsx b/web/components/config/video-variant-form.tsx index 82ef6698b..fc70c429a 100644 --- a/web/components/config/video-variant-form.tsx +++ b/web/components/config/video-variant-form.tsx @@ -1,6 +1,7 @@ // This content populates the video variant modal, which is spawned from the variants table. import React from 'react'; -import { Row, Col, Slider, Collapse, Typography } from 'antd'; +import { Popconfirm, Row, Col, Slider, Collapse, Typography } from 'antd'; +import { ExclamationCircleFilled } from '@ant-design/icons'; import { FieldUpdaterFunc, VideoVariant, UpdateArgs } from '../../types/config-section'; import TextField from './form-textfield'; import { DEFAULT_VARIANT_STATE } from '../../utils/config-constants'; @@ -71,9 +72,6 @@ export default function VideoVariantForm({ const handleVideoBitrateChange = (value: number) => { onUpdateField({ fieldName: 'videoBitrate', value }); }; - const handleVideoPassChange = (value: boolean) => { - onUpdateField({ fieldName: 'videoPassthrough', value }); - }; const handleVideoCpuUsageLevelChange = (value: number) => { onUpdateField({ fieldName: 'cpuUsageLevel', value }); }; @@ -91,9 +89,21 @@ export default function VideoVariantForm({ if (isNaN(value)) { return; } - onUpdateField({ fieldName: 'scaledHeight', value: value || '' }); }; + + // Video passthrough handling + const handleVideoPassConfirm = () => { + onUpdateField({ fieldName: 'videoPassthrough', value: true }); + }; + // If passthrough is currently on, set it back to false on toggle. + // Else let the Popconfirm turn it on. + const handleVideoPassthroughToggle = (value: boolean) => { + if (dataState.videoPassthrough) { + onUpdateField({ fieldName: 'videoPassthrough', value }); + } + }; + const framerateDefaults = VIDEO_VARIANT_DEFAULTS.framerate; const framerateMin = framerateDefaults.min; const framerateMax = framerateDefaults.max; @@ -171,17 +181,6 @@ export default function VideoVariantForm({ Read more about CPU usage.

- - {/* VIDEO PASSTHROUGH FIELD - currently disabled */} -
- -
@@ -215,28 +214,65 @@ export default function VideoVariantForm({ -

- Resizing your content will take additional resources on your server. If you wish to - optionally resize your content for this stream output then you should either set the - width or the height to keep your aspect ratio.{' '} - Read more about resolutions. -

- - - + + +
+ Resolution +

+ Resizing your content will take additional resources on your server. If you wish to + optionally resize your content for this stream output then you should either set the + width or the height to keep your aspect ratio.{' '} + Read more about resolutions. +

+
+ + +
+ + + {/* VIDEO PASSTHROUGH FIELD */} +
+ Video Passthrough +

+ Description + link. +

+ } + onConfirm={handleVideoPassConfirm} + okText="Yes" + cancelText="No" + > + {/* adding an tag to force Popcofirm to register click on toggle */} + {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} + + + + +
+ +
{/* FRAME RATE FIELD */} -
+
Frame rate

{VIDEO_VARIANT_DEFAULTS.framerate.tip}

diff --git a/web/styles/config-video-variants.scss b/web/styles/config-video-variants.scss index a0d57711c..340f6bb93 100644 --- a/web/styles/config-video-variants.scss +++ b/web/styles/config-video-variants.scss @@ -18,11 +18,16 @@ .cpu-usage-container, .bitrate-container { - height: 20em; + min-height: 22em; } .advanced-settings { margin-top: 1em; + + .resolution-module, + .video-passthroug-module { + min-height: 30em; + } } }