我正在尝试创建带有 .vtt 字幕的(.mp4 格式)视频。唯一出现在屏幕上的是视频中心的一两条黑线,字幕应该是,并且仅在 Chrome 上。它在例如 Edge 中运行良好。他们为什么不出现?文件被上传到服务器。
<html>
<head>
<style>
.container {
margin: 0px 0px;
max-width: 500px;
}
</style>
</head>
<body>
<div class="container" id="player">
<video controls crossorigin playsinline poster="poster.png">
<source src="TSR.mp4" type="video/mp4" size="576">
<source src="TSR.mp4" type="video/mp4" size="720">
<source src="TSR.mp4" type="video/mp4" size="1080">
<!-- Caption files -->
<track kind="captions" label="English" srclang="en" src="subtitles/vtt/english.vtt" default>
<track kind="captions" label="Czech" srclang="cz" src="subtitles/vtt/czech.vtt">
<!-- Fallback for browsers that don't support the <video> element -->
<a href="Test Screen Recording.mp4" download>Download</a>
</video>
</div>
<script src="https://cdn.plyr.io/3.4.4/plyr.polyfilled.js"></script>
<script>const player = new Plyr('#player');</script>
</body>
.vtt 文件(示例):
WEBVTT
1
00:00:00.000 --> 00:00:03.000
This is a test screen recording.
截屏: