@@ -26,8 +26,94 @@ const meta = {
2626 } ,
2727 argTypes : {
2828 provider : {
29+ description : '播放提供方:HTML5 / YouTube / Embed。不同 provider 会使用不同的输入参数。' ,
2930 control : { type : 'select' } ,
3031 options : [ 'html5' , 'youtube' , 'embed' ] ,
32+ table : { type : { summary : '"html5" | "youtube" | "embed"' } } ,
33+ } ,
34+
35+ title : {
36+ description : '标题(用于可访问性/Embed iframe title/文案展示)。' ,
37+ control : { type : 'text' } ,
38+ table : { type : { summary : 'string' } } ,
39+ } ,
40+
41+ src : {
42+ description : 'HTML5 视频地址(MP4 / HLS m3u8)。仅 provider=html5 时生效。' ,
43+ control : { type : 'text' } ,
44+ table : { type : { summary : 'string' } } ,
45+ } ,
46+
47+ youtubeId : {
48+ description : 'YouTube 视频 ID。仅 provider=youtube 时生效。' ,
49+ control : { type : 'text' } ,
50+ table : { type : { summary : 'string' } } ,
51+ } ,
52+
53+ embedUrl : {
54+ description : 'Embed iframe URL。仅 provider=embed 时生效。' ,
55+ control : { type : 'text' } ,
56+ table : { type : { summary : 'string' } } ,
57+ } ,
58+
59+ getEmbedUrl : {
60+ description : '动态生成 embed URL:getEmbedUrl(config) => string。优先级高于 embedUrl/youtubeId。' ,
61+ control : false ,
62+ table : { type : { summary : '(config) => string' } } ,
63+ } ,
64+
65+ externalUrl : {
66+ description : '点击“新窗口打开”时使用的外部 URL(优先级高于 sourceUrl/自动推导)。' ,
67+ control : { type : 'text' } ,
68+ table : { type : { summary : 'string' } } ,
69+ } ,
70+
71+ sourceUrl : {
72+ description : '源地址/落地页 URL(用于“新窗口打开”的兜底)。' ,
73+ control : { type : 'text' } ,
74+ table : { type : { summary : 'string' } } ,
75+ } ,
76+
77+ trackSrc : {
78+ description : '字幕 VTT 地址(可选)。未传时会尝试从 mp4 src 推导同名 .vtt。' ,
79+ control : { type : 'text' } ,
80+ table : { type : { summary : 'string' } } ,
81+ } ,
82+
83+ trackLang : {
84+ description : '字幕语言(用于 track srcLang/label)。' ,
85+ control : { type : 'text' } ,
86+ table : { type : { summary : 'string' } , defaultValue : { summary : '"en"' } } ,
87+ } ,
88+
89+ initialConfig : {
90+ description : '初始配置(非受控)。包含:lazyPlay/miniPlayer/autoPlay/autoMute/playbackRate/ytControls。' ,
91+ control : { type : 'object' } ,
92+ table : { type : { summary : 'Partial<Config>' } } ,
93+ } ,
94+
95+ config : {
96+ description : '受控配置(传入即受控)。' ,
97+ control : { type : 'object' } ,
98+ table : { type : { summary : 'Config' } } ,
99+ } ,
100+
101+ onConfigChange : {
102+ description : '受控模式下配置变化回调。' ,
103+ control : false ,
104+ table : { type : { summary : '(nextConfig) => void' } } ,
105+ } ,
106+
107+ onError : {
108+ description : '播放错误回调(含 provider/src/youtubeId/embedUrl 等上下文)。' ,
109+ control : false ,
110+ table : { type : { summary : '(err) => void' } } ,
111+ } ,
112+
113+ onEvent : {
114+ description : '可观测事件回调(例如 play/pause/seek/hlsError/embedTimeout 等)。' ,
115+ control : false ,
116+ table : { type : { summary : '(name, detail) => void' } } ,
31117 } ,
32118 } ,
33119 render : ( args ) => {
0 commit comments