From the course: JavaScript: Web Workers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

OffscreenCanvas

OffscreenCanvas - JavaScript Tutorial

From the course: JavaScript: Web Workers

Start my 1-month free trial

OffscreenCanvas

- [Instructor] If you have been playing with the web for awhile, you probably know Canvas. Canvas is a Javascript API that appeared with HTML5 that will let us run their 2D and 3D contents within the boundaries of an HTML document, but completely generated by Javascript. It's being used, for example, by WebGL to create 3D content or 3D games, but it's not just for gaming or e-machines. It's currently being used a lot for image manipulation. For example, we can take a raw video from a video tile or from the video camera on a mobile phone, we can render frames in a Canvas and then get bitmaps, or snapshots, of that video and do something with that. For example, we can do OCR, object recognition, face detection, augmented reality. The problem is that the Canvas API is part of the DOM. So it's not available in the worker's context. So everything that we want to do, it must be done in the main thread which we know is not a good idea. Also when we are creating games, sometimes on each frame…

Contents