From c50ee2ef3ab1f295f13220b7dcdd619678c956d7 Mon Sep 17 00:00:00 2001 From: nuanyang233 <528944303@qq.com> Date: Tue, 21 Dec 2021 19:58:08 +0800 Subject: [PATCH 1/9] feat: implementing asset player with media-viewer --- .../Collectible/SNSAdaptor/ArticleTab.tsx | 33 ++----------------- packages/shared/package.json | 2 ++ .../src/UI/components/AssetPlayer/index.tsx | 12 +++++++ packages/shared/src/UI/components/index.ts | 1 + pnpm-lock.yaml | 26 ++++++++++++++- 5 files changed, 43 insertions(+), 31 deletions(-) create mode 100644 packages/shared/src/UI/components/AssetPlayer/index.tsx diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx index a71f6e132023..29cdaba1f242 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx @@ -1,9 +1,7 @@ -import type { FC } from 'react' -import { Link } from '@mui/material' import { makeStyles } from '@masknet/theme' -import { Video } from '../../../components/shared/Video' import { CollectibleTab } from './CollectibleTab' import { CollectibleState } from '../hooks/useCollectibleState' +import { AssetPlayer } from '@masknet/shared' const useStyles = makeStyles()({ body: { @@ -17,23 +15,6 @@ const useStyles = makeStyles()({ }, }) -interface AssetPlayerProps { - src?: string - alt: string -} - -// opensea supports: JPG, PNG, GIF, SVG, MP4, WEBM, MP3, WAV, OGG, GLB, GLTF. -const AssetPlayer: FC = ({ src, alt }) => { - const { classes } = useStyles() - if (!src) return null - const isVideo = src.match(/\.(mp4|webm)$/i) - return isVideo ? ( -