mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
remove video autoplay from lists
This commit is contained in:
@@ -31,6 +31,7 @@ const NFTItem = ({ token, value, isLoading, withTokenLink, ...tokenInstance }: P
|
||||
animationUrl={ tokenInstance?.animation_url ?? null }
|
||||
imageUrl={ tokenInstance?.image_url ?? null }
|
||||
isLoading={ isLoading }
|
||||
autoplayVideo={ false }
|
||||
/>
|
||||
</Link>
|
||||
<Flex justifyContent="space-between" w="100%" flexWrap="wrap">
|
||||
|
||||
@@ -18,9 +18,10 @@ interface Props {
|
||||
className?: string;
|
||||
isLoading?: boolean;
|
||||
withFullscreen?: boolean;
|
||||
autoplayVideo?: boolean;
|
||||
}
|
||||
|
||||
const NftMedia = ({ imageUrl, animationUrl, className, isLoading, withFullscreen }: Props) => {
|
||||
const NftMedia = ({ imageUrl, animationUrl, className, isLoading, withFullscreen, autoplayVideo }: Props) => {
|
||||
const [ isMediaLoading, setIsMediaLoading ] = React.useState(true);
|
||||
const [ isLoadingError, setIsLoadingError ] = React.useState(false);
|
||||
|
||||
@@ -71,7 +72,7 @@ const NftMedia = ({ imageUrl, animationUrl, className, isLoading, withFullscreen
|
||||
|
||||
switch (type) {
|
||||
case 'video':
|
||||
return <NftVideo { ...props }/>;
|
||||
return <NftVideo { ...props } autoPlay={ autoplayVideo }/>;
|
||||
case 'html':
|
||||
return <NftHtml { ...props }/>;
|
||||
case 'image':
|
||||
|
||||
@@ -5,15 +5,17 @@ import { mediaStyleProps, videoPlayProps } from './utils';
|
||||
|
||||
interface Props {
|
||||
src: string;
|
||||
autoPlay?: boolean;
|
||||
onLoad: () => void;
|
||||
onError: () => void;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const NftVideo = ({ src, onLoad, onError, onClick }: Props) => {
|
||||
const NftVideo = ({ src, autoPlay = true, onLoad, onError, onClick }: Props) => {
|
||||
return (
|
||||
<chakra.video
|
||||
{ ...videoPlayProps }
|
||||
autoPlay={ autoPlay }
|
||||
src={ src }
|
||||
onCanPlayThrough={ onLoad }
|
||||
onError={ onError }
|
||||
|
||||
@@ -18,6 +18,7 @@ const NftVideoFullscreen = ({ src, isOpen, onClose }: Props) => {
|
||||
src={ src }
|
||||
maxH="90vh"
|
||||
maxW="90vw"
|
||||
autoPlay={ true }
|
||||
/>
|
||||
</NftMediaFullscreenModal>
|
||||
);
|
||||
|
||||
@@ -41,7 +41,6 @@ export const mediaStyleProps = {
|
||||
};
|
||||
|
||||
export const videoPlayProps = {
|
||||
autoPlay: true,
|
||||
disablePictureInPicture: true,
|
||||
loop: true,
|
||||
muted: true,
|
||||
|
||||
@@ -23,6 +23,7 @@ const TokenInventoryItem = ({ item, token, isLoading }: Props) => {
|
||||
animationUrl={ item.animation_url }
|
||||
imageUrl={ item.image_url }
|
||||
isLoading={ isLoading }
|
||||
autoplayVideo={ false }
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user