feat: support mobile video previews
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
} from "react";
|
||||
import type { Attachment } from "../../types/post";
|
||||
import { AttachmentDownloadPill } from "./AttachmentDownloadPill";
|
||||
import { useVideoPreviewSource } from "./hooks/useVideoPreviewSource";
|
||||
import { useVideoPlayer } from "./overlays/VideoPlayer";
|
||||
|
||||
function pad2(n: number): string {
|
||||
@@ -127,6 +128,7 @@ export function MessageInlineVideo({
|
||||
const [snapProgress, setSnapProgress] = useState(false);
|
||||
|
||||
const t = TOKENS[size];
|
||||
const videoSrc = useVideoPreviewSource(attachment);
|
||||
|
||||
useEffect(() => {
|
||||
const v = videoRef.current;
|
||||
@@ -270,7 +272,7 @@ export function MessageInlineVideo({
|
||||
<>
|
||||
<video
|
||||
ref={videoRef}
|
||||
src={attachment.url}
|
||||
src={videoSrc}
|
||||
poster={attachment.posterUrl}
|
||||
playsInline
|
||||
autoPlay={autoPlay}
|
||||
|
||||
Reference in New Issue
Block a user