I want to use either native JavaScript or jQuery to change the poster attribute on the HTML video tag. Any help would be greatly appreciated.
<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>
Thank you!
要在本地执行此操作,只需更改属性:
document.getElementById('htmlFive').setAttribute('poster','newvalue');
Use jQuery's attr method, eg:
$('#htmlFive').attr('poster', 'newvalue')
Or native setAttribute :
document.querySelector('#htmlFive').setAttribute('poster', 'newvalue')
$('#video source').attr('src', srcPath);
$("#example_video_1 .vjs-poster").css('background-image', 'url(http://video- js.zencoder.com/oceans-clip.jpg)').show();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.