javascript - 为 iFrame 创建 Blob URL
问题描述
我一直在谷歌搜索,试图找出为 iFrame 创建 blob URL,虽然我对 javascript 完全陌生,但我设法将一些主要工作的代码拼接在一起,但它没有加载视频。
HTML:
<iframe class="test" width="500" height="300" />
JAVASCIPT:
var url = `https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4`;
var blob = new Blob([url], {type: 'video/mp4'});
var iframe = document.querySelector(".test");
iframe.src = URL.createObjectURL(blob);
有人能指出为什么这对我不起作用吗?就像我说我是新手,所以如果可能的话,你能不能解释一下,而不是仅仅提供答案。
谢谢,保罗。
Uncaught TypeError: Failed to construct 'Blob': The provided value cannot be converted to a sequence.
at window.onload
(index):34 Uncaught ReferenceError: html is not defined
at window.onload
解决方案
推荐阅读
- android - 致命异常:java.lang.SecurityException MANAGE_USERS 或 CREATE_USERS 权限仅适用于小米
- html - JAWS 2018:使选择/下拉“可点击”
- php - Laravel如何从orWhere部分找到搜索结果
- terraform - 在嵌套块中使用计数
- qt - QML CheckBox 设置文本大小
- c# - C# 硒 if 语句
- arrays - 如果不可能,Ruby hash dig 或返回 nil
- javascript - NW.js - nwbuild 未在 Windows 上打开
- scala - 您将 assemblyMergeStrategy 放在 build.sbt 的什么位置?
- java - FluentProducerTemplate 上的 ClosedChannelException 与 Apache Camel