chore: disable video preview autoplay when embedded in a super note [skip e2e]
This commit is contained in:
@@ -90,7 +90,14 @@ const PreviewComponent: FunctionComponent<Props> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file.mimeType.startsWith('video/')) {
|
if (file.mimeType.startsWith('video/')) {
|
||||||
return <VideoPreview file={file} filesController={application.filesController} objectUrl={objectUrl} />
|
return (
|
||||||
|
<VideoPreview
|
||||||
|
file={file}
|
||||||
|
filesController={application.filesController}
|
||||||
|
objectUrl={objectUrl}
|
||||||
|
isEmbeddedInSuper={isEmbeddedInSuper}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.mimeType.startsWith('audio/')) {
|
if (file.mimeType.startsWith('audio/')) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ type Props = {
|
|||||||
file: FileItem
|
file: FileItem
|
||||||
filesController: FilesController
|
filesController: FilesController
|
||||||
objectUrl: string
|
objectUrl: string
|
||||||
|
isEmbeddedInSuper: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +18,7 @@ type Props = {
|
|||||||
* when not using the <source/> tag.
|
* when not using the <source/> tag.
|
||||||
* We show an error message if neither works.
|
* We show an error message if neither works.
|
||||||
*/
|
*/
|
||||||
const VideoPreview = ({ file, filesController, objectUrl }: Props) => {
|
const VideoPreview = ({ file, filesController, objectUrl, isEmbeddedInSuper }: Props) => {
|
||||||
const [showError, setShowError] = useState(false)
|
const [showError, setShowError] = useState(false)
|
||||||
const [shouldTryFallback, setShouldTryFallback] = useState(false)
|
const [shouldTryFallback, setShouldTryFallback] = useState(false)
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ const VideoPreview = ({ file, filesController, objectUrl }: Props) => {
|
|||||||
<video
|
<video
|
||||||
className="h-full w-full"
|
className="h-full w-full"
|
||||||
controls
|
controls
|
||||||
autoPlay
|
autoPlay={!isEmbeddedInSuper}
|
||||||
onError={() => {
|
onError={() => {
|
||||||
setShouldTryFallback(true)
|
setShouldTryFallback(true)
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user