{
const interval = 1;
const numFrames = Math.min(
Math.floor(extracter._video.duration / interval) + 1,
20
);
const iw = extracter._video.videoWidth;
const ih = extracter._video.videoHeight;
const ow = iw / 4;
const oh = (ow * ih) / iw;
const cols = Math.floor(width / ow);
const rows = Math.ceil(numFrames / cols);
const canvas = DOM.canvas(ow * cols, oh * rows);
const context = canvas.getContext('2d');
const fetchAndDraw = async i => {
const t = i * interval;
const frame = await extracter.fetchFrame(t);
const x = (i % cols) * ow;
const y = Math.floor(i / cols) * oh;
context.drawImage(frame, 0, 0, iw, ih, x, y, ow, oh);
context.fillText(`t=${t}`, x + 10, y + 20);
};
const times = new Array(numFrames).fill(0).map((_, i) => i);
await Promise.all(times.map(fetchAndDraw));
return canvas;
}