'use of webcodecs API in Angular project?

I am trying to use features from the new webcodecs API in Chrome within an angular project. Typescript doesn't seem to be aware of the types, so I installed dom-webcodecs.

https://www.npmjs.com/package/@types/dom-webcodecs

It still seems to be missing VideoDecoder when I build. Here is a stackblitz with a simple example. Am I missing a step to use this in my project? Is there another way to use this API in my project?

https://stackblitz.com/edit/angular-ivy-zzysyg?file=src%2Fapp%2Fapp.component.ts



Solution 1:[1]

While I'm using Nx+Angular, I imagine our solution would be similar. I didn't need "typeRoots": ["node_modules/@types"] in my tsconfig, rather had to add "types": ["dom-webcodecs"] to tsconfig.worker.json.

Solution 2:[2]

if you are using webcodecs Api first u import your browsers types.. like if chrome, try this https://www.npmjs.com/package/@types/chrome or https://www.npmjs.com/package/@types/dom-mediacapture-transform for some that webcodecs api using..

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 batbrain9392
Solution 2 Fatih Kilic