[英]How can I forcefully add .mp4 or .webm extension when uploading video?
How could I possibly add an extension of.mp4 or.webm?我怎么可能添加.mp4 或.webm 的扩展名? It only produces like this它只产生这样的
HTML HTML
<input type="file" name="file[]" id="inpVid" accept="video/*">
<video style="width: 100%; max-width: 100%; margin-bottom: 10px;" controls id="vidURL">
<source id="videoUrl" src="#" type="video/mp4">
</video>
SCRIPT脚本
<script>
function changeVideoURL (element) {
const videoURLElement = document.getElementById('videoUrl')
const videoPlayer = document.getElementById('vidURL')
if (element.files && element.files[0]) {
videoURLElement.src = URL.createObjectURL(element.files[0]);
videoPlayer.load()
}
}
document.getElementById("inpVid").onchange = function() {
changeVideoURL(this)
}
</script>
I think this is what you seek我想这就是你想要的
<input type="file[]" id="inpVid" accept="video/mp4,video/webm" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.