HTMLCanvasElement 上未解决的方法 captureStream

unresolved method captureStream on HTMLCanvasElement(HTMLCanvasElement 上未解决的方法 captureStream)
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)