Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: keep portrait acceptance video controls usable (#20997)

Bryan55a8c1e6bc21
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx
index 808f93e117e..2ed5a8b1f03 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx
@@ -132,7 +132,7 @@ export const VideoControlBar = ({
const step = stepAt(chapters, time);
return (
- <Flexbox horizontal align={'center'} gap={2}>
+ <Flexbox horizontal align={'center'} gap={2} wrap={'wrap'}>
<button
aria-label={paused ? t('acceptance.video.play') : t('acceptance.video.pause')}
className={styles.barButton}
@@ -167,7 +167,6 @@ export const VideoControlBar = ({
{t('acceptance.video.frame', { frame: frameOf(time) })}
{step?.label ? ` · ${step.label}` : ''}
</span>
- <div style={{ flex: 1 }} />
{onToggleCaptions && claimsOf(chapters).length > 0 && (
<button
aria-pressed={captions}
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx
index afe67108d8e..eeec8b970a8 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx
@@ -4,7 +4,7 @@ import { isFullFrameRect } from '@lobechat/const/verify';
import type { AcceptanceReviewAnnotation, VerifyEvidenceChapter } from '@lobechat/types';
import { Flexbox, Icon } from '@lobehub/ui';
import { Play } from 'lucide-react';
-import type { ReactNode } from 'react';
+import type { CSSProperties, ReactNode } from 'react';
import { memo, useRef, useState } from 'react';
import { styles } from './styles';
@@ -22,6 +22,8 @@ import { VideoTimeline } from './VideoTimeline';
/** Matches the plain `<video>` this replaces, so rows keep their rhythm. */
const MAX_HEIGHT = 360;
+/** Leave room for the controls even when the recording is portrait. */
+const MIN_PLAYER_WIDTH = 480;
interface VideoEvidencePlayerProps {
/** The evidence description — laid out under the player, at the content area's width. */
@@ -51,14 +53,20 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>(
const timed = notes.flatMap((note) => (note.time ? [{ ...note, time: note.time }] : []));
const claims = captions ? claimsAt(chapters, time) : [];
const aspect = size ? size.width / size.height : 16 / 9;
+ const frameWidth = Math.round(MAX_HEIGHT * aspect);
return (
<Flexbox gap={8} width={'100%'}>
<div
className={styles.player}
ref={rootRef}
- style={{ maxWidth: `min(100%, ${Math.round(MAX_HEIGHT * aspect)}px)` }}
tabIndex={0}
+ style={
+ {
+ '--acceptance-video-frame-width': `${frameWidth}px`,
+ 'maxWidth': `min(100%, ${Math.max(MIN_PLAYER_WIDTH, frameWidth)}px)`,
+ } as CSSProperties
+ }
onKeyDown={(event) => {
if (status === 'ready' && handlePlaybackKey(event, clock)) event.preventDefault();
}}
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/styles.ts b/src/features/Acceptance/Viewer/Evidence/Video/styles.ts
index b5cee367964..ef634335814 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/styles.ts
+++ b/src/features/Acceptance/Viewer/Evidence/Video/styles.ts
@@ -20,10 +20,18 @@ export const styles = createStaticStyles(({ css }) => ({
&:focus-visible {
box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};
}
+
+ &:fullscreen > :first-child {
+ max-width: 100%;
+ }
`,
frame: css`
position: relative;
+
width: 100%;
+ max-width: var(--acceptance-video-frame-width, 100%);
+ margin-inline: auto;
+
background: #000;
video {
@@ -185,7 +193,9 @@ export const styles = createStaticStyles(({ css }) => ({
`,
frameNo: css`
overflow: hidden;
+ flex: 1;
+ min-width: 0;
margin-inline-start: 8px;
font-family: ${cssVar.fontFamilyCode};