unresolved method captureStream on HTMLCanvasElement(HTMLCanvasElement 上未解决的方法 captureStream)
问题描述
canvas 元素和方法 captureStream 的情况很奇怪.根据文档 HTMLCanvasElement 有一个方法 captureStream.但是我的 Angular6 应用声称没有这种方法.
I have weird situation with canvas element and method captureStream. According to documentation HTMLCanvasElement has a method captureStream. However my Angular6 app claims that there isn't such method.
所以这段代码不起作用:
So this code won't work:
let canvas: HTMLCanvasElement;
canvas = document.createElement('canvas');
let stream = canvas.captureStream(20);
第三行失败.
这段代码运行没有任何错误:
This code runs without any error:
let canvas: any;
canvas = document.createElement('canvas');
let stream = canvas.captureStream(20);
这怎么可能?我 100% 确定 HTMLCanvasElement 具有此方法,并且 document.createElement('canvas') 返回 HTMLCanvasElement.
How this is possible? I'm 100% sure that HTMLCanvasElement has this method and the document.createElement('canvas') returns HTMLCanvasElement.
推荐答案
根据MDN,看起来 captureStream 方法仍然是一个工作草案(截至 2021 年 6 月),尽管并非所有主流浏览器都实现了它.这可能就是为什么它还不是 HTMLCanvasElement 的类型定义的一部分.
According to MDN, it looks like the captureStream method is still a working draft (as of June 2021), eventhough it is not implemented by all major browsers. That is probably why it is not yet part of the type definition for HTMLCanvasElement.
这篇关于HTMLCanvasElement 上未解决的方法 captureStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:HTMLCanvasElement 上未解决的方法 captureStream
基础教程推荐
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
