Skip to content

Commit d0c7c86

Browse files
committed
feat: fake preview hover on playing VT
1 parent 24aae09 commit d0c7c86

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/webui/src/client/ui/FloatingInspectors/VTFloatingInspector.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { UIStudio } from '@sofie-automation/meteor-lib/dist/api/studios'
1313
import { ITranslatableMessage, translateMessage } from '@sofie-automation/corelib/dist/TranslatableMessage'
1414
import { IFloatingInspectorPosition, useInspectorPosition } from './IFloatingInspectorPosition'
1515
import { ReadonlyDeep } from 'type-fest'
16+
import { getIgnorePieceContentStatus } from '../../lib/localStorage'
1617

1718
interface IProps {
1819
status: PieceStatusCode | undefined
@@ -109,19 +110,25 @@ export const VTFloatingInspector: React.FC<IProps> = ({
109110
const { t } = useTranslation()
110111
const inspectorRef = useRef<HTMLDivElement>(null)
111112

113+
// a fake preview (only hover at On Air of playing VT) can be shown
114+
// by adding ?ignore_piece_content_status=1 to the url
115+
// this is only used for development purposes
116+
const debugMode = getIgnorePieceContentStatus()
117+
const playPreviewUrl = debugMode ? 'http://some-ip-here:3000/preview.mp4' : previewUrl || ''
118+
112119
const itemDuration = content?.sourceDuration || renderedDuration || 0
113120
const seek = content?.seek ?? 0
114121
const loop = content?.loop ?? false
115122

116123
const offsetTimePosition = timePosition + seek
117124

118-
const showVideoPlayerInspector = !hideHoverscrubPreview && previewUrl
125+
const showVideoPlayerInspector = !hideHoverscrubPreview && (previewUrl || debugMode)
119126
const showMiniInspectorClipData = shouldShowFloatingInspectorContent(status ?? PieceStatusCode.UNKNOWN, content)
120127
const showMiniInspectorNotice = noticeLevel !== null
121128
const showMiniInspectorData = showMiniInspectorNotice || showMiniInspectorClipData
122129
const showAnyFloatingInspector = Boolean(showVideoPlayerInspector) || showMiniInspectorData
123130

124-
const shown = showMiniInspector && itemElement !== undefined && showAnyFloatingInspector
131+
const shown = showMiniInspector && (itemElement !== undefined || debugMode) && showAnyFloatingInspector
125132

126133
const { style: floatingInspectorStyle, isFlipped } = useInspectorPosition(position, inspectorRef, shown)
127134

@@ -157,7 +164,7 @@ export const VTFloatingInspector: React.FC<IProps> = ({
157164
ref={inspectorRef}
158165
loop={loop}
159166
seek={seek}
160-
previewUrl={previewUrl}
167+
previewUrl={playPreviewUrl}
161168
timePosition={offsetTimePosition}
162169
studioSettings={studio?.settings}
163170
floatingInspectorStyle={floatingInspectorStyle}

0 commit comments

Comments
 (0)