0
我试图用一个基本的javascript脚本缩小视频(),但由于某种原因它没有改变。我甚至尝试过使用chrome开发工具来缩小它,但它只是缩小了。缩小比例<video>加载元数据后的大小
这里是基本的脚本 -
window.onload = function() {
var videos = document.getElementsByTagName('video');
for(var i=0;i<videos.length;i++) {
videos.item(i).addEventListener("loadedmetadata", function(e) {
//Tried using target and videoWidth
//Both didn't work
e.srcElement.clientWidth = "480";
console.log(e);
});
}
}
尝试'e.srcElement.width = 480'。 –
'clientWidth'是只读的。你可以像@IgorGilyazov所说的做,或者你可以使用CSS。 – brianchirls