Getting thumbnail of images and video files in service worker

221 views
Skip to first unread message

Moe Bazzi

unread,
Sep 8, 2022, 11:09:13 AM9/8/22
to Chromium Extensions
Hey everyone,

In my chrome extension, I fetch images/videos in the service worker and then would like to generate a thumbnail from these media files. In MV2, I was able to do this via the HTML Image and Video elements, but these are not available in the MV3 service worker. What are some other options I have to achieve this? Thanks.

Jackie Han

unread,
Sep 9, 2022, 1:18:27 AM9/9/22
to Moe Bazzi, Chromium Extensions
In service worker, for image, you can:
1. create a OffscreenCanvas
2. fetch(img) => to blob => createImageBitmap(blob)
3. now, drawImage(imageBitmap) on (offscreen) canvas.

I don't know how to deal with video in service worker.

Besides service worker, you can open a small non-focus window to do your task, then close it.

On Thu, Sep 8, 2022 at 11:09 PM Moe Bazzi <bazz...@gmail.com> wrote:
Hey everyone,

In my chrome extension, I fetch images/videos in the service worker and then would like to generate a thumbnail from these media files. In MV2, I was able to do this via the HTML Image and Video elements, but these are not available in the MV3 service worker. What are some other options I have to achieve this? Thanks.

--
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/CAPiq7pdLHJQjof1cfGgCk1jLVv18TCxf43CUQmM_aps_%2BW1ghg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages