WinJS视频元素中的HTTP字幕 [英] HTTP subtitles in WinJS video element

查看:353
本文介绍了WinJS视频元素中的HTTP字幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML媒体播放示例中,有一个代码,演示如何为视频添加字幕:

In the HTML media playback sample there's a code that demonstrates how to add subtitles to the 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>

它工作正常,但当我将字幕轨道src更改为 src = http://gilevskaya.com/subs.vtt,字幕停止工作。

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

正在提供的文件是相同的,为什么没有?它工作以及如何解决它?

The file being served is the same, why doesn't it work and how to fix it?

推荐答案

我在自己的域上重新创建了这个问题。起初字幕没有显示。我注意到Visual Studio中的JavaScript控制台出错。

I've recreated the issue on my own domain. At first the subtitles didn't show. I noticed an error in the JavaScript Console in Visual Studio.


MEDIA12604:文本跟踪:未知的MIME类型。 hr = 8007000b

MEDIA12604: Text Track: Unknown MIME type. hr=8007000b

所以我添加了mime类型。我的网站在Apache上运行。我将此行添加到 .htaccess 文件中:

So I added the mime type. My site runs on Apache. I added this line to the .htaccess file:


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

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

这会将 .vtt 类型设置为是 text / vtt 并将编码设置为 utf-8

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

我确定找到为其他服务器添加mime类型的方法并不难。

I'm sure it's not hard to find the ways of adding mime types for other servers.

我是我的情况我必须添加www 也是网址...但我认为这与服务器的设置方式有关。你可能不需要这个。

I'm my case I had to add the "www" to the url too... But I think this has something to do with the way the server is set up. You might not need this.

这篇关于WinJS视频元素中的HTTP字幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆