The track tag works when your content is served on a web server. Also remember to add a configuration that sets the mime type as a vtt file. Here is my example that works on IIS:
<video> <source src="video.mp4" type="video/mp4" /> <track src="video.en.vtt" kind="subtitles" label="English Subtitles" srclang="en" /> </video>
For the IIS Web.Config file:
<configuration> <system.webServer> <staticContent> <remove fileExtension=".vtt" /> <mimeMap fileExtension=".vtt" mimeType="text/vtt" /> </staticContent> </system.webServer> </configuration>
For Tomcat Server WEB-INF / web.xml:
<web-app> <mime-mapping> <extension>vtt</extension> <mime-type>text/vtt</mime-type> </mime-mapping> </web-app>
For the Apache server, add the .htaccess file to your web directory and write this line to add the type of subtitle captions:
AddType text/vtt .vtt
source share