我需要一些有动态字幕的html5视频播放的帮助
这是html
视频html
<video
width="998"
height="545"
id="videoplayer"
controls
src="zzz_f817951280x720.m4v" type="video/mp4">
<track id="subtitleid" srclang="en" default="" label="ინგლისური"></track>
</video>
字幕转换器HTML
<ul>
<li><a href="0" class="subtitle_clicker selected">off</a></li>
<li><a class="subtitle_clicker" id="s15"
href="Uploads/Subtitles/test_a1ee4c.srt">rus</a></li>
<li>∙<a class="subtitle_clicker" id="s16"
href="Uploads/Subtitles/test_797ed1.srt">eng</a></li>
</ul>
和js
$(document).ready(function () {
$('.subtitle_clicker').live('click', function (e) {
e.preventDefault();
SubtitleChager($(this));
});
});
function SubtitleChager(_this) {
if ($('.x-player .player-view video').attr("width")) {
$('.subtitle_clicker.selected').removeClass('selected');
$('#subtitleid').removeAttr('src');
if (_this.attr("href") == '0') {
$('#subtitleid').removeAttr('src');
}
else {
$('#subtitleid').attr('src', _this.attr("href"));
}
$(_this).addClass('selected');
}
}
当我正在尝试更改字幕时,我只是在attr src中更改exteitle url 而这两个副标题相互叠加
那么如何删除旧字幕并插入新字幕? 请帮忙
答案 0 :(得分:0)
添加了一个名为Track的新标签(仅在Chrome和IE10中可用)
请查看WebVTT - http://www.html5rocks.com/en/tutorials/track/basics/
微软也开始使用名为TTML的XML格式字幕,因为这两者之间有一些很好的比较 - http://www.balisage.net/Proceedings/vol10/html/Tai01/BalisageVol10-Tai01.html