我想使用本机JavaScript或jQuery来更改HTML视频标记上的poster属性。任何帮助将不胜感激。
<div id="videoplayer" class="video-player" style="overflow: hidden; width: 582px; height: 326px; ">
<div id="myPlayer">
<video id="htmlFive" width="100%" height="100%" controls="" poster="undefined">
<source src="blank.m3u8">
</video>
</div>
</div>
谢谢!
答案 0 :(得分:12)
要原生,只需更改属性:
document.getElementById('htmlFive').setAttribute('poster','newvalue');
答案 1 :(得分:-1)
$('#video source').attr('src', srcPath);
答案 2 :(得分:-1)
$("#example_video_1 .vjs-poster").css('background-image', 'url(http://video- js.zencoder.com/oceans-clip.jpg)').show();