<input type="file" accept="video/*" onChange={this.previewVideo} />
<video id="myVideo" autoPlay width="300" />使用FileReader读取转为Data URL:
previewVideo = (file) => {// 建议判断下视频大小及格式,太大的可能会有问题
const reader = new FileReader()
reader.onload = (evt) => {
const myVideo = document.querySelector("#myVideo")
myVideo.src = evt.target.result
}
reader.readAsDataURL(file)
}