Skip to content

Commit fca542b

Browse files
Video html element not changin when selecting different video files in the UI for OSMO dataset (#249)
1 parent 4aad106 commit fca542b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ui/src/app/datasets/components/FilePreviewer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const FilePreviewer: React.FC<{ file: FileData }> = ({ file }) => {
3535
const windowSize = useWindowSize();
3636
const [height, setHeight] = useState(0);
3737
const { setSafeTimeout } = useSafeTimeout();
38+
const videoRef = useRef<HTMLVideoElement>(null);
3839

3940
useEffect(() => {
4041
if (containerRef?.current) {
@@ -72,6 +73,10 @@ const FilePreviewer: React.FC<{ file: FileData }> = ({ file }) => {
7273
};
7374
}, [fileExtension, setSafeTimeout]);
7475

76+
useEffect(() => {
77+
videoRef.current?.load();
78+
}, [file.thumbnailUrl]);
79+
7580
const handleIframeError = () => {
7681
setIframeError(true);
7782
if (timerRef.current) {
@@ -91,6 +96,7 @@ const FilePreviewer: React.FC<{ file: FileData }> = ({ file }) => {
9196
case "mp4":
9297
return (
9398
<video
99+
ref={videoRef}
94100
controls
95101
style={{ maxHeight: `${height}px` }}
96102
className="object-fit"

0 commit comments

Comments
 (0)