使用fetchapi加载视频
我正在尝试下载完整的视频,在实际播放它们或将它们添加到DOM之前为它们制作Blob链接,在这里
const init = {method: 'GET',mode: 'no-cors',cache: 'default'};
const request = new Request(mp4Url);
fetch(request, init)
.then((response) => response.blob())
.then(data=>
{
let vid = URL.createObjectURL(data)
let htmlString =`
<video id="video-${id}" class="video_player" src="${vid}" autoplay muted loop>
</video>`
let videoElem = parser.parseFromString(htmlString, "text/html");
videoRoot.appendChild(videoElem.firstChild.children[1].firstChild)
}
);
我
blob:http://127.0.0.1:5501/b62d9895-a432-487e-b1bc-4c670fe4b30c
net::ERR_REQUEST_RANGE_NOT_SATISFIABLE
从Chrome中获得的代码中的一点点,而从Firefox那里
HTTP “Content-Type” of “application/x-unknown-content-type” is not supported. Load of media resource blob:http://127.0.0.1:5501/b62d9895-a432-487e-b1bc-4c670fe4b30c failed.
获得的代码确实是可能的吗?
i'm trying to download complete videos, making blob links for them before actually playing them or adding them to DOM, here the bit of my code that does that
const init = {method: 'GET',mode: 'no-cors',cache: 'default'};
const request = new Request(mp4Url);
fetch(request, init)
.then((response) => response.blob())
.then(data=>
{
let vid = URL.createObjectURL(data)
let htmlString =`
<video id="video-${id}" class="video_player" src="${vid}" autoplay muted loop>
</video>`
let videoElem = parser.parseFromString(htmlString, "text/html");
videoRoot.appendChild(videoElem.firstChild.children[1].firstChild)
}
);
i'm getting
blob:http://127.0.0.1:5501/b62d9895-a432-487e-b1bc-4c670fe4b30c
net::ERR_REQUEST_RANGE_NOT_SATISFIABLE
from chrome and this from firefox
HTTP “Content-Type” of “application/x-unknown-content-type” is not supported. Load of media resource blob:http://127.0.0.1:5501/b62d9895-a432-487e-b1bc-4c670fe4b30c failed.
is something like this really possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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