HTTP Subtitles in WinJS Video Element

In the example of playing HTML files, there is a code demonstrating how to add subtitles to a video:

<video id="subtitleVideo" style="position: relative; z-index: auto; width: 50%;" src="http://ie.microsoft.com/testdrive/Videos/BehindIE9AllAroundFast/Video.mp4" poster="images/Win8MediaLogo.png" loop controls> <track id="scenario3entrack" src="media/sample-subtitle-en.vtt" kind="subtitles" srclang="en" default> </video> 

It works fine, but when I change the subtitles of the src track to src="http://gilevskaya.com/subs.vtt" , the subtitles stop working.

The supported file is the same, why it does not work, and how to fix it?

+4
source share
1 answer

I recreated the problem in my own domain. No subtitles were shown at first. I noticed an error in the JavaScript console in Visual Studio.

MEDIA12604: Text track: Unknown MIME type. h = 8007000b

So, I added the mime type. My site is powered by Apache. I added this line to the .htaccess file:

Text AddType / vtt; charset = utf-8.vtt

This sets the .vtt type to text/vtt and sets the encoding to utf-8 .

I am sure it is not difficult to find ways to add mime types to other servers.

In my case, I had to add "www" to the url too ... But I think this is due to how the server is configured. You may not need this.

+2
source

All Articles