跳到正文
Skillpedia
网站与界面(前端)75k · #3073

video-captions

它能做什么

这个技能检查预先录制和直播的视频是否有字幕,以及字幕文件是否正确关联。它面向发布视频的网站团队。

适用场景

  • ✓视频元素有音频但没有字幕轨道的时候。
  • ✓嵌入的 YouTube 或 Vimeo 视频关闭了字幕的时候。
  • ✓网站上线前需要满足 WCAG 字幕要求的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/video-captions/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/video-captions/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我在网站上添加了一个培训视频。我要怎样添加字幕,让聋人观众也能看懂?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查每个视频是否有字幕轨道,并确认其文件有效。然后它会添加该轨道,并在需要的地方让字幕默认开启。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Provide captions for video content

Approximately 15% of adults have some degree of hearing loss. Captions are essential for deaf and hard-of-hearing users who cannot access audio content. They also benefit users in sound-sensitive environments (libraries, open offices), users watching without headphones in public, non-native speakers, and users with auditory processing disorders. WCAG SC 1.2.2 is a Level AA requirement — its absence is a legal compliance failure under the ADA, EN 301 549, and similar regulations worldwide.

Quick Reference

  • Prerecorded video with audio: synchronized captions required — WCAG 2.1 SC 1.2.2 (Level AA)
  • Live video with audio: real-time captions required — WCAG 2.1 SC 1.2.4 (Level AA)
  • Use <track kind='captions'> with a .vtt (WebVTT) file for HTML5 <video> elements
  • Captions must include all spoken dialogue, speaker identification, and relevant non-speech audio (music, sound effects)
  • Subtitles and captions are different: captions include non-speech audio; subtitles translate dialogue only

Check

Find all <video> elements and video embeds (<iframe> from YouTube, Vimeo, etc.). For each <video> with audio: check for a <track> child element with kind='captions' and a valid src pointing to a .vtt file. Verify the default attribute is present on at least one track so captions are on by default (or document the UX reason they are off by default). For YouTube/Vimeo embeds: check that the platform's caption toggle is accessible. Also check that the .vtt file exists and is valid (not empty, not just music notes).

Fix

For <video> elements without captions: (1) Create a WebVTT (.vtt) file containing synchronized caption text — include all spoken words, speaker IDs for multi-speaker content, and descriptions of relevant sounds (e.g., '[applause]', '[upbeat music]'). (2) Add <track kind='captions' srclang='en' label='English' src='captions-en.vtt' default> inside the <video> element. (3) For auto-generated captions (YouTube, AI tools): review and correct errors — auto-captions average 80% accuracy and often fail on proper nouns, technical terms, and accented speech. (4) For live streams: implement real-time captioning via a third-party captioning service or CART (Communication Access Realtime Translation).

Explain

WCAG 2.1 SC 1.2.2 (Captions — Prerecorded, Level AA) requires synchronized text alternatives for all audio in prerecorded video content. Captions differ from subtitles: captions are intended for deaf/hard-of-hearing viewers and must include non-speech information (sound effects, music), while subtitles translate dialogue for viewers who can hear but do not understand the language. The HTML <track> element with kind='captions' delivers WebVTT files that browsers render as synchronized on-screen text. The kind='subtitles' value is for translation only and does not satisfy SC 1.2.2 because browsers may omit non-speech annotations.

Code Review

Review the rendered markup and interactive states that affect Provide captions for video content. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/accessibility/video-captions

常见问题

什么是 WebVTT 文件?

它是一个扩展名为 .vtt 的纯文本字幕文件,视频元素会将其作为轨道加载。

字幕应该包括什么?

所有语音对白、说话人的名字,以及音乐或音效等重要的非语音声音。

字幕和翻译字幕有什么区别?

字幕包括非语音声音,而翻译字幕只翻译对白。

详情

作者的原始描述

Use when applies to all `<video>` elements and third-party video embeds (YouTube, Vimeo) where the page owner controls the content. Prerecorded videos require `.vtt` caption files via `<track>`. For videos embedded via `<iframe>`, check that the video platform captions are enabled. Audio-only content requires transcripts instead (SC 1.2.1). Video-only content (no audio) requires a text alternative or audio description instead (SC 1.2.3).

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3073
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能