Generate a MediaStream from a list of images (bitmap/png/jpeg)

Viewed 589

I have an array of bitmaps that I want to convert to a MediaStream object so that I can render it in an HTMLVideoElement, is this possible?

Example:

// Assume I get a list of bitmaps from some source
let bitmaps = getBitmaps();

let stream = new MediaStream();
for (let bitmap of bitmaps) {
  // Somehow add the bitmap to the MediaStream
  pipe(stream, bitmap);
}

I assume this could be done with the MediaSource API, but not exactly sure on where to start.

0 Answers
Related