WebCodec APIs are shipped in chrome - but not available in extensions?

89 views
Skip to first unread message

Sam Smith

unread,
May 18, 2023, 3:44:14 AM5/18/23
to Chromium Extensions
Hi,

According to this tracker (https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder/VideoEncoder) the webcodec APIs are fully supported since September 2021.

However when I try to use the API in a Chrome Extension I get "VideoEncoder is not defined".

Is there some permission I can request - or are they simply unavailable for Chrome Extensions? If it's a runtime difference this should be documented.

Thanks
Sam

Jackie Han

unread,
May 18, 2023, 3:51:40 AM5/18/23
to Sam Smith, Chromium Extensions
Ref: https://w3c.github.io/webcodecs/#videoencoder-interface

It is nothing special in extensions. VideoEncoder is available in extension pages and web workers, but not in service worker. You can use it in an offscreen document.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bfa8365e-4e70-48f1-b689-0a97c874746fn%40chromium.org.

Deco

unread,
May 18, 2023, 3:51:54 AM5/18/23
to Sam Smith, Chromium Extensions
The WebCodec API is not available for Chrome extensions and is intended for server side calls.

Cheers,
Deco

--

Sam Smith

unread,
May 18, 2023, 4:27:41 AM5/18/23
to Chromium Extensions, Deco, Chromium Extensions, Sam Smith
Thank you both for your quick and helpful responses. Appreciate it

wOxxOm

unread,
May 18, 2023, 10:29:17 AM5/18/23
to Chromium Extensions, Sam Smith, Deco, Chromium Extensions
>  The WebCodec API is not available for Chrome extensions

But it is available in a normal page/frame of an extension as can be seen in the w3c link above (codified as "Window"), just not inside a service worker.

> and is intended for server side calls

There's no such limitation and the API is useful for client-side processing of locally captured streams just as well.

Deco

unread,
May 18, 2023, 10:45:23 AM5/18/23
to wOxxOm, Chromium Extensions, Sam Smith
OP's question was (attempting) to invoke the Chrome API call for the inference, which is where it's not available. 

wOxxOm

unread,
May 18, 2023, 11:37:05 AM5/18/23
to Chromium Extensions, Deco, Chromium Extensions, Sam Smith, wOxxOm
> OP's question was (attempting) to invoke the Chrome API call for the inference, which is where it's not available

I don't see where the OP tries to "invoke the Chrome API" and I don't understand what "invoke the Chrome API call for the inference" means technically. Maybe your comment was for another question? Here the OP tries to invoke a WebCodec API, specifically VideoEncoder, which is available in extension pages/frames.
Reply all
Reply to author
Forward
0 new messages