关于视频/WebM和MP4
希望没有任何问题。
我尝试编写一些共享屏幕和屏幕记录。为此,我找到了其他代码要学习。 在代码中,它使用了视频文件名扩展名为.WEBM。我试图将其更改为.mp4,但失败了。
我认为video/webm
和video/mp4
均有效。但是不知道为什么,当我更改文件名扩展时,情况会变得更糟。
我没有发现任何错误吗?我尝试了一些关键字搜索(例如,视频/webM MP4),但没有结果。我想知道我的关键字方向是否错误?
谢谢。
以下是代码的一部分:
btnPlay.onclick = () => {
var blob = new Blob(buffer, { type: 'video/webm' })
recvideo.src = window.URL.createObjectURL(blob)
recvideo.srcObject = null
recvideo.controls = true
recvideo.play()
}
// download record
btnDownload.onclick = () => {
var blob = new Blob(buffer, { type: 'video/webm' })
var url = window.URL.createObjectURL(blob)
var a = document.createElement('a')
a.href = url
a.style.display = 'none'
a.download = 'video.webm'
a.click()
}
在代码中,我仅将WebM
更改为mp4
。
代码源: https://ithelp.ithome.com.ithome.com.tw/articles/ 10273368?sc = ithomer
Hope there hadn't any question same as mine.
I tried to write some share screen and screen record. For that I found others code to study.
In the code, it used the video filename extension is .webm. I tried to change it to .mp4 but failed.
I thought that video/webm
and video/mp4
were both valid. But not know why, when I changed filename extension, it got worse.
Is there anything wrong I didn't find? I had tried some keywords to search (for example, video/webm mp4) but had no result. I would like to know if my keyword direction is wrong?
Thankyou.
The following is part of the code:
btnPlay.onclick = () => {
var blob = new Blob(buffer, { type: 'video/webm' })
recvideo.src = window.URL.createObjectURL(blob)
recvideo.srcObject = null
recvideo.controls = true
recvideo.play()
}
// download record
btnDownload.onclick = () => {
var blob = new Blob(buffer, { type: 'video/webm' })
var url = window.URL.createObjectURL(blob)
var a = document.createElement('a')
a.href = url
a.style.display = 'none'
a.download = 'video.webm'
a.click()
}
In the code, I only changed webm
to mp4
.
The code source: https://ithelp.ithome.com.tw/articles/10273368?sc=iThomeR
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论