Skip to content

媒体流程组件

@mbjia/components

媒体流程组件

负责视频下载、素材拆条、视频截取等长链路业务。

媒体流程组件负责视频下载、素材拆条、视频截取等长链路业务。

模块定位

处理视频下载、素材拆条、视频截取、分段播放等长链路任务,通常和权益校验、任务轮询、结果下载联动。

下载流程拆条流程视频抓取

接入前确认

需要 eventBus、权益接口、任务接口、视频素材数据。部分流程会打开会员或点数弹窗。

eventBus权益校验任务轮询

接入速览

什么时候用

视频下载、镜头拆分、视频抓取、素材 AI 分析这类长链路任务,优先使用流程组件。

最少必填

多数流程都需要 eventBus;下载流程还需要记录 id、确认下载和权益相关回调。

返回什么

流程组件主要通过回调和事件通知状态;拆条、抓取、下载结果通常来自服务接口或事件 payload。

容易漏什么

长链路通常还会触发权益弹窗、任务轮询和失败处理,不建议绕过流程组件只单独调接口。

组件

组件说明
MbjiaDownloadFlow视频下载流程
MediaSplittingFlow素材拆条流程
VideoCaptureFlow视频截取/抓取流程
SegmentedProgressBar分段进度条
MusicBox音乐素材卡片
PlayerContainer音频封面和悬浮试听容器
ScriptBox脚本素材卡片
ScriptStructs脚本结构标签
ScriptTable脚本列表表格
ScriptInfo脚本分镜表格详情
PreviewScript脚本预览弹窗
ScriptModal脚本选择弹窗
VideoClipper视频裁剪器
MediaSplittingModal 导出组镜头拆分确认、进行中、完成、失败和强度选择弹窗
VideoCaptureModal 导出组视频抓取、解析、下载、成功和次数不足弹窗
AssetsAnalysisFlow素材 AI 分析扣费与任务流程
SetMainContentOfMaterialFlow批量设置素材主体流程
BatchGenerateFlow批量生成扣费与提交流程

媒体素材展示预览

脚本库
产品开箱卖点介绍共 8 个镜头

脚本与音频素材

脚本卡片、脚本表格、脚本预览和音乐试听通常配合素材接口与事件总线使用。

MbjiaDownloadFlow

ts
interface PropsType {
  record_id?: string | string[]
  logId?: string | number
  beforeJudgePhone?: Function
  notEnoughAction?: Function
  hasEnoughAction?: Function
  confirmDownload: Function
  judgePhoneOtherCondition?: Function
  showBigDownloadOverModal?: boolean
  chargeOver?: Function
  eventBus: any
  finishModal: boolean
  downloadCall?: Function
  typeOfWork?: 'template' | 'jianji' | 'ai'
  hasSelfLoadingModal?: boolean
  confirmTitle?: string
}

核心事件:

事件说明
global:PlaneEditing:startDownload开始下载
global:downloadVideosDirectly直接下载
global:showNotEnoughVideoPoints显示点数不足
global:WaitingMemo:close关闭等待弹窗
personalCenter:finalcut:download:success下载成功

回调出参:

回调出参说明
beforeJudgePhone由业务实现决定判断手机号前的扩展逻辑。
notEnoughAction由业务实现决定权益或点数不足时触发。
hasEnoughAction由业务实现决定权益足够时触发。
confirmDownload由业务实现决定确认下载时触发,必传。
chargeOver由业务实现决定扣费结束后触发。
downloadCall由业务实现决定下载动作回调。

MediaSplittingFlow

ts
interface PropsType {
  eventBus: any
  [key: string]: any
}

type SplitItem = {
  id: string
  assetId: string
  duration: number
  assetType: number
}

核心事件:

事件说明
global:beginGetSplittingDetail开始获取拆条详情
vip:modal:open权益不足时打开会员弹窗

数据结构:

类型字段说明
SplitItemid拆条项 id。
SplitItemassetId素材 id。
SplitItemduration时长。
SplitItemassetType素材类型。

VideoCaptureFlow

ts
interface PropsType {
  eventBus: any
  dirId: string | null
}

核心事件:

事件说明
global:beginCaptrueVideo打开抓取视频弹窗
global:reFetchVideo重新抓取视频
global:beginDownloadVideoByCapture开始下载抓取结果
global:AllUserInterests:BuyPoint:open打开点数购买
global:AllUserInterests:UpgradeVip:changeState切换会员升级状态

SegmentedProgressBar

ts
export interface Segment {
  start: number
  end: number
  color?: string
  id: string
  detail: string
  title?: string
}

interface ProgressBarProps {
  segments: Segment[]
  startTime: number
  endTime: number
  onSegmentClick?: (segment: Segment) => void
  onClick: (time: number) => void
  currentTime: number
  isPlaying: boolean
  onPause: () => void
  onPlay: () => void
  offsetTime?: { start: number; end: number }
  highLightMoment?: string
}

回调出参:

回调出参说明
onSegmentClickSegment点击分段时返回当前分段。
onClicktime: number点击进度条时返回时间。
onPause暂停回调。
onPlay播放回调。

Segment 字段:

字段类型说明
startnumber分段开始时间。
endnumber分段结束时间。
colorstring分段颜色。
idstring分段 id。
detailstring分段详情。
titlestring分段标题。

MusicBox

音乐素材卡片。点击卡片触发选中,右键可透出上下文操作,内部使用 PlayerContainer 实现悬浮试听。

tsx
<MusicBox
  eventBus={eventBus}
  theme="ai"
  data={music}
  onCheck={(item) => setSelected(item)}
  onContextMenu={(item) => openMenu(item)}
/>

数据结构:

ts
export interface MusicBoxDataType {
  id: string
  assetId: string
  name: string
  url: string
  coverUrl: string
  assetStyle: number
  assetType: number
  assetVersion: number
  duration: number
  checked: boolean
}

Props:

字段类型必填默认值说明
dataMusicBoxDataType-音乐素材数据。
onCheck(item: MusicBoxDataType) => void-点击卡片时返回当前音乐。
onContextMenu(data: MusicBoxDataType) => void-右键菜单回调。
eventBusany-播放互斥和重置事件总线。
theme'ai' | 'mbjia''ai'封面主题。

PlayerContainer

音频封面和悬浮试听容器。鼠标移入时创建 Howler 实例播放音频,鼠标移出时停止并释放实例。

tsx
<PlayerContainer
  eventBus={eventBus}
  url={music.url}
  coverUrl={music.coverUrl}
  checked={music.checked}
  theme="mbjia"
/>

Props:

字段类型必填默认值说明
urlstring-音频地址。
coverUrlstring主题默认封面音频封面。
checkedboolean-是否选中。
eventBusany-用于广播和监听音频重置事件。
theme'ai' | 'mbjia''ai'默认封面主题。
compressCoverbooleanfalse为 true 时封面地址追加 !220
speednumber-播放速率。
shape'circle' | 'square''square'封面形状。

事件协议:

事件方向说明
musicEdit:musicBox:reset监听/触发停止其他音乐卡片播放。
captionEdit:audioBox:reset监听/触发停止字幕音频卡片播放。

ScriptBox

脚本素材卡片。展示封面、脚本名称、分镜数量和结构标签,悬浮时展示“预览”和“使用”操作。

tsx
<ScriptBox
  data={script}
  onPreview={(item) => openPreview(item)}
  onUse={(item) => useScript(item)}
/>
字段类型必填默认值说明
dataScriptAssetModel-脚本素材。
onUse(data: ScriptAssetModel) => void-点击“使用”时返回当前脚本。
onPreview(data: ScriptAssetModel) => void-点击“预览”时返回当前脚本。

ScriptAssetModel 关键字段:

字段类型说明
idstring脚本 id。
namestring脚本名称。
urlstring脚本预览视频地址,继承自素材模型。
coverUrlstring封面地址,继承自素材模型。
jsonstring脚本 JSON。
scenesCountnumber分镜数量。
cidstring分类 id。
structsStructItemType[]脚本结构标签。

ScriptStructs

脚本结构标签展示。默认最多直接展示 3 个标签,超过 3 个时通过 Tooltip 展示更多。

tsx
<ScriptStructs
  structs={[
    { id: '1', name: '产品开箱' },
    { id: '2', name: '卖点介绍' },
  ]}
/>
字段类型必填默认值说明
structsStructItemType[]-结构标签数组。
largebooleanundefined是否使用大尺寸标签。

ScriptTable

脚本列表表格。提供预览、使用、复制、编辑、删除、移动分组和行内改名入口。

tsx
<ScriptTable
  data={scripts}
  page={1}
  pageSize={8}
  moreAction
  onPreview={(item) => openPreview(item)}
  onUse={(item) => useScript(item)}
  onDelete={(item) => removeScript(item)}
/>
字段类型必填默认值说明
dataScriptItem[]-脚本列表。
onUse(data: ScriptAssetModel) => void-使用脚本。
onPreview(data: ScriptAssetModel) => void-预览脚本。
pageSizenumber8每页数量,用于计算序号。
pagenumber1当前页,用于计算序号。
onDelete(data: ScriptAssetModel) => void-删除脚本。
onCopy(data: ScriptAssetModel) => void-创建副本。
onEdit(data: ScriptAssetModel) => void-修改脚本。
onMove(data: ScriptAssetModel) => void-移动分组。
onEditName(data: ScriptAssetModel) => void-行内改名完成后触发。
moreActionbooleanfalse是否展示更多操作。
actionNamesstring[]['预览', '使用', '更多']操作文案。
moreActionsstring[]['copy', 'edit', 'delete', 'move']更多操作 key。

ScriptInfo

脚本分镜表格详情。可以通过 id 拉取脚本详情,也可以传入 jsonvJson 直接渲染。

tsx
<ScriptInfo
  id={script.id}
  height={443}
  load={({ info, asset, columns, tableWidth }) => {
    setScriptInfo(info)
    setScriptAsset(asset)
  }}
/>
字段类型必填默认值说明
heightnumber-表格滚动高度。
widthnumber'100%'初始表格宽度。
idstring-脚本素材 id;存在时内部请求详情。
jsonany[]-直接传入脚本 JSON。
vJsonVeScriptInfo-直接传入解析后的脚本信息。
cidnumber-配合 json 使用的分类 id。
load(res) => void-表格初始化完成后返回解析信息。

load 出参:

字段类型说明
infoVeScriptInfo解析后的脚本表格信息。
assetAssetModel脚本素材模型。
onResetColumnsFunction重置列配置函数。
columnsany[]AntD Table 列配置。
tableWidthnumber计算后的表格宽度。

PreviewScript

脚本预览弹窗。内部使用 ScriptInfo 渲染分镜表格,如果脚本素材有视频地址,会在左侧展示视频预览。

tsx
<PreviewScript
  id={script.id}
  open={previewOpen}
  onClose={() => setPreviewOpen(false)}
  onUse={() => useCurrentScript()}
/>
字段类型必填默认值说明
idstring-脚本 id。
openboolean-弹窗是否打开。
onClose() => void-关闭弹窗。
onUse() => void-点击“使用该脚本”时触发。

ScriptModal

脚本选择弹窗。包含“我的脚本/脚本库”切换、分组、搜索、瀑布流/表格列表、预览和创建脚本入口。

tsx
<ScriptModal
  open={open}
  listId="script-modal"
  keyword=""
  cid=""
  loadType="waterfall"
  initialWidth={845}
  onClose={() => setOpen(false)}
  onUse={(item) => useScript(item)}
  onPreview={(item) => previewScript(item)}
  onCreateScript={() => createScript()}
/>
字段类型必填默认值说明
openbooleantrue弹窗是否打开。
onClose() => void-关闭弹窗。
onUse(data: ScriptAssetModel) => void-使用脚本。
onPreview(data: ScriptAssetModel) => void-预览脚本。
onCreateScript() => void-创建脚本。
keywordstring''推荐脚本搜索关键词。
cidstring''推荐脚本分类 id。
loadTypekeyof typeof loadListTypewaterfall列表展示方式。
initialWidthnumber845初始内容宽度。
listIdstring-列表容器 id。
defaultCurrTabstring'1'默认 tab,1 为我的脚本,2 为脚本库。
createTab{ key: string; name: string; render: React.ReactNode }-自定义创建 tab。
customDirReact.ReactNode-自定义目录区域。
modalWidthnumber1098弹窗宽度。

VideoClipper

视频裁剪器。用于在固定轨道上调整开始时间和裁剪时长,支持播放预览、拖动裁剪区域和拖动左右边界。

tsx
<VideoClipper
  videoUrl={video.url}
  duration={10}
  startTime={0}
  minDuration={3}
  updateInfo={(info) => setClipInfo(info)}
/>
字段类型必填默认值说明
videoUrlstring-视频地址。
durationnumber0初始裁剪时长。
startTimenumber0初始开始时间。
canChangeDurationbooleantrue是否允许拖动左右边界调整时长。
minDurationnumber-最小裁剪时长。
sitestring'main'站点类型;ai 场景下开始时间越界处理不同。
updateInfo(info) => void-初始化和拖拽结束时返回裁剪信息。

updateInfo 出参:

字段类型说明
totalTimenumber视频总时长。
startTimenumber裁剪开始时间。
endTimenumber裁剪结束时间。
durationnumber裁剪时长。

MediaSplittingModal 导出组

镜头拆分流程弹窗集合,通常由 MediaSplittingFlow 统一编排。

组件说明关键入参
MediaSplittingConfirmModal拆分前扣费确认opendeductPointsrestPointscostInfoisBatch
SplittingModal拆分中提示,5 秒倒计时关闭openonOpenChange
SplittingOverModal拆分完成提示openonOpenChange
SplittingFailModal拆分失败提示openassetHasProblem
ExerciseIntensityModal选择镜头运动强度openonOk(selected)isBatch
TimeTooLongModal视频过长无法拆分提示由流程按限制触发
NonComplianceAssetNoticeModal批量拆分存在不合规素材提示由流程按校验结果触发

VideoCaptureModal 导出组

视频抓取流程弹窗集合,通常由 VideoCaptureFlow 统一编排。

组件说明关键入参
GrabVideoPopupModal输入视频分享链接并勾选免责声明opendirIdonOk(text)onShowDisclaimer
GrabVideoResultModal解析失败、下载成功、下载失败、素材过长等结果提示opentitlecontenttype
UndercountModal使用次数不足或试用提示流程内按权益状态触发
VideoDownloadModal视频下载中提示open
VideoParsingModal视频解析中提示open
VideoParseSuccessModal解析成功并展示视频信息open、素材信息、确认回调

AssetsAnalysisFlow

素材 AI 分析流程组件。通过事件启动,查询扣费、展示明细、处理点数不足,并提交分析任务。

tsx
<AssetsAnalysisFlow eventBus={eventBus} />

eventBus.emit('beginAssetsAnalysisFlow', {
  dir_id: '1001',
  id_list: ['asset_1'],
  organize_type: 0,
})
字段类型必填默认值说明
eventBusany-监听 beginAssetsAnalysisFlow,并在成功后触发结果刷新。

主要事件:

事件方向说明
beginAssetsAnalysisFlowon开始素材分析流程。
global:getAssetAnalysisResultemit提交任务成功后刷新分析结果。
global:cancelCantAnalysisAssetAndBeginAnalysisemit批量分析时取消不可分析素材并继续。

SetMainContentOfMaterialFlow

批量设置素材主体流程。通过全局事件接收素材列表,先检查哪些素材允许修改,再展示确认/输入弹窗。

tsx
<SetContentOfMaterial />

eventBus.emit('global:setMainContentOfMaterial', selectedAssets)
事件方向说明
global:setMainContentOfMaterialon接收待设置主体的素材列表。
global:hideManageemit设置成功后隐藏管理态。
assets:fission:getCurrentListemit设置成功后刷新当前素材列表。

依赖接口:

接口用途
modifiablePrincipalName检查哪些素材允许设置主体。
updatePrincipalName提交素材主体。

BatchGenerateFlow

批量生成流程。通过事件接收作品 id 列表,查询扣费和不可生成作品,点数足够则提交批量生成,点数不足则进入权益不足流程。

tsx
<BatchGenerateFlow />

eventBus.emit('global:batchGenerate', {
  batchType: 'ai',
  ids: ['product_1', 'product_2'],
  callBack: () => refreshList(),
})

事件入参:

字段类型说明
batchTypestring批量生成类型;包含 ai 时支持查看计费明细。
idsstring[]作品 id 列表。
callBack() => void批量生成提交成功后刷新当前页面。

依赖接口:

接口用途
getBatchRenderCost查询批量生成扣费。
getBatchRenderCostList查询计费明细。
submitBatchRender提交批量生成。

流程预览

用户选择媒体任务判断任务类型
任务类型
下载流程拆条流程视频抓取流程
权益检查权益足够:提交任务/轮询结果权益不足:会员或点数弹窗

MBJIA Tools 文档