Skip to content

gstwebrtc-api: Import webrtc-adapter to index.html separately

Attempts to fix #439 (closed)

The problem mentioned in the issue should never happen because we've got webrtc-adapter bundled. However, for whatever reason, it does not work correctly in our scenario. It seems like due to some webpack-related weirdness, it's unable to correctly shim the APIs we're using and fix Safari's behaviour.

I've tried a lot of things, both playing with Webpack's config, as well as even trying Vite. I've seen projects use Webpack's expose-loader to explicitly load webrtc-adapter, but in my testing that has done precisely nothing.

The only way I've been able to make it work in Safari was to both have webrtc-adapter bundled with our library (and imported in index.js) AND imported as a separate script in index.html, which is what I've done in this commit.

I've also tried only importing it separately (without its presence in the lib itself), as well as marking it as an external dependency (so it's not bundled, but still imported in index.js), nothing worked. Only doubling the amount of adapterness seems to bring an effect.

Feel free to supersede this with a more correct fix, as my JS build-systems-related knowledge is limited.

cc @neodesys

Merge request reports