SharedArrayBuffer

View as Markdown

SharedArrayBuffer (SAB) is a web API that is available in all major browsers that enables shared memory in JavaScript. Shared memory increases performance, speed, and efficiency in your program which allows developers to build more advanced feature sets.

Zoom uses SharedArrayBuffer to power advanced features and increase performance when implementing existing features using WebAssemby. It's not required for the SDK to function and it's not required when using WebRTC.

How to enable SharedArrayBuffer

You can enable SharedArrayBuffer on your webpage using Cross-Origin Isolation, Credentialless Headers, Serviceworkers, Chrome's Origin Trials, or Document-Isolation-Policy (Chrome or Edge only). Here's a quick comparison.

PolicyCross-Origin Isolation Credentialless Headers Serviceworkers Chrome's Origin Trials* Document-Isolation-Policy** 
Solution typePermanentPermanentPermanentTemporaryPermanent
Requires custom server headersYesYesNoNoYes

*Chrome's Origin Trials work for Chromium based browsers like Chrome and Edge. However, you must renew the Chrome Origin Trial  every three (3) months. They'll eventually be deprecated. See the link for details.

**Choose the Document-Isolation-Policy option for Chromium based desktop browsers (Chrome/Edge v137+) if your site needs to embed third-party content like iFrames, videos, or payment gateways.

Implementation guidelines

Click a tab for implementation details.

To implement, add these headers to your server:

  • Cross-Origin-Embedder-Policy: require-corp
  • Cross-Origin-Opener-Policy: same-origin

See A guide to enable cross-origin isolation  for details.

Can't be enabled on hosting platforms that do not allow custom headers.

Enable SharedArrayBuffer on managed cloud platforms

SharedArrayBuffer is implemented on the server level so the server sends the headers to the browser. Because of this, implementation may vary based on cloud providers or server environments. As such, please refer to the official documentation on how to modify server headers for some of the most popular cloud platforms in the following tabs.

Amazon Web Services allows for response header customization through their console, CloudFormation, CLI, and API. See Amazon's official documentation  to learn more.

Enable SharedArrayBuffer on the server

Aside from enabling SharedArrayBuffer using any of the above methods for cloud hosting platforms, if you're self-hosting or using a non-cloud web host that deploys Apache HTTP Server or nginx, then you may need to enable SharedArrayBuffer by modifying your web server's configuration file to respond to client requests with two headers:

For Apache HTTP Server the recommended method for managing headers is to modify the .htaccess file. To learn more about Apache HTTP Server's directives and how to set them, check out Mozilla's documentation page  on the topic.

For nginx the recommended method for managing headers is to modify the nginx.conf file for global server configuration, or your virtual host's configuration file, if configured. We recommend using CORS on Nginx  as a starting point.

Verify that SharedArrayBuffer is enabled

To verify that the changes were applied to your site, run the following JavaScript on your webpage:

typeof SharedArrayBuffer === 'function'; // returns true or false

or

crossOriginIsolated; // returns true or false

Additional resources

For more details on cross-origin isolation and SharedArrayBuffer, see the following links.

From the developer blog

See the following blog post and YouTube video  for more details.