我需要一些关于带有动态字幕的 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 中更改 sustitle url,这两个字幕相互重叠
那么如何删除旧字幕并插入新字幕?请帮忙