Chrome浏览器中的视频未显示.vtt字幕

时间:2018-10-11 11:59:37

标签: html5 video html5-video webvtt vtt

我正在尝试创建带有.vtt字幕的(.mp4格式)视频。屏幕上唯一出现的是字幕中间的视频中心的一两个黑线,并且仅在Chrome上。它在例如边缘。他们为什么不出现?文件已上传到服务器上。

<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. 

屏幕截图:

Screenshot of black lines

1 个答案:

答案 0 :(得分:0)

删除vtt文件中的数字1