Files
jiang13-bbs/frontend/components/markdown/MdVideo.tsx
freefire 99c0f0319d feat: 品牌裁剪弹窗/Markdown 行内短代码与详情视频块等
新增:
- BrandCropModal 品牌图裁剪弹窗 + cropImage 工具
- Markdown 行内短代码(inlineShortcodes + remark 插件)
- MdDetails 折叠块、MdVideo 视频块组件
- directiveBlocks/inlineShortcodes 测试

其它:
- 聊天后端(handler/service chat)调整
- Markdown 渲染链路、编辑器、全局样式与品牌相关面板更新
2026-10-02 01:40:06 +08:00

36 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
type VideoProvider = "bilibili" | "youtube";
type MdVideoProps = {
provider: VideoProvider;
/** bilibili 为 BV 号;youtube 为视频 ID(parseVideoLine 已校验) */
id: string;
};
function embedUrl(provider: VideoProvider, id: string): string {
if (provider === "bilibili") {
return `https://player.bilibili.com/player.html?bvid=${encodeURIComponent(
id
)}&autoplay=0&danmaku=0&high_quality=1`;
}
return `https://www.youtube-nocookie.com/embed/${encodeURIComponent(id)}`;
}
/**
* [bilibili]…[/bilibili] / [youtube]…[/youtube] 视频嵌入:
* 16:9 容器 + 懒加载 iframe(bilibili 官方播放器 / youtube 隐私域名),纯静态无 JS。
*/
export default function MdVideo({ provider, id }: MdVideoProps) {
return (
<div className="j13-md-video">
<iframe
src={embedUrl(provider, id)}
title={provider === "bilibili" ? `bilibili 视频 ${id}` : `YouTube 视频 ${id}`}
loading="lazy"
allowFullScreen
referrerPolicy="no-referrer"
allow="accelerometer; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
/>
</div>
);
}