twilio / twilio-video-processors.js

Twilio Video Processors is a collection of video processing tools which can be used with Twilio Video JavaScript SDK to apply transformations and filters to a video track.
Other
33 stars 21 forks source link

Avoid crashing when used in SSR #29

Closed matanui159 closed 2 years ago

matanui159 commented 2 years ago

Contributing to Twilio

All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.

Pull Request Details

Description

When using this library in frameworks like Next.js that uses the same code for both client-side and server-side rendering, it will make the server crash even if not using any of the exports. This is because it does not check for the existence of window before checking its properties.

This adds a small !!window to the isSupported test.

Burndown

Before review

matanui159 commented 2 years ago

This is actually causing more trouble than it is solving. It would be nice for this to work, also for worker support, but I don't have the energy to fix all the issues. I so far have found these two: