Problems embedding Twitch video into iframe in electron

Hello! I’m having some issues with adding a Twitch embed for my electron app. In development, using parent=localhost works fine, but this is an issue when the app is packaged and runs with file:// as the directive. I tried using the electron example with deleting the responseHeader, but this is not working for me. The content security policy header remains.

As a last resort, I tried following instructions from this thread: How will Twitch Embed updates affect mobile app embeds? - API - Twitch Developer Forums. I created a static webpage to serve a twitch video. I then used an iframe to view the webpage, and set the parent to the static webpage. This still results in an issue with the CSP. Is there any way to get a Twitch embed working on a packaged electron app? Thank you in advance.

GitHub link to my app

working fine for me here, I checked my example on mac and windows and the embeds are operating correctly.

Your issues suggests you are using an outdated version of electron, (the method changed in a recent version slightly iirc) or you are not binding your removal function corretly.

For completeness I also adjusted my github example to build/become packaged, and this is the result: working fine.

Hi Barry! Thanks for your response. I figured out the issue and it was related to electron store for whatever reason. I had a call to right before the logic for removing the header. It must’ve caused a race condition? This only happened when the app was packaged, and also seemed to work fine in electron fiddle with forge. This is overall a very puzzling bug.

perhaps for sure.

But why you got an electron store running during a header intercept is whole different quandry.

But yeah Race condition will behave differently unpackaged/packaged (take out all the debugging and stuff)

But why you got an electron store running during a header intercept is whole different quandry.

It wasn’t running during the header intercept. It was right before the header intercept like so: tournament-vod-clipper/main.ts at 9e70dac018491b381ccfdb407bf6160db8a2ede7 · willie-yao/tournament-vod-clipper · GitHub

Oh I see.

So it was causing the onHeadersReceived to bind late/potentially after the iframe has been displayed

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.