Embedding player on localhost

Hello,
I created an application for my Samsung TV for watching streams from Twitch and it stopped working because of embed API changes. Now, the lib is throwing an error:

[Report Only] Refused to frame ‘https://player.twitch.tv/’ because an ancestor violates the following Content Security Policy directive: “frame-ancestors localhost”.

I tried to specify the parent parameter

parent: [‘localhost’]

Still not working. I’m using create-react-app if it matters. Is it possible to run embed on localhost now?

2 Likes

Hi all !
I have the same problem
my electorn & android app broken
parent : localhost , does not working

var options = {
width: w,
height: h,
channel: x,
parent: [“localhost”]
};
var player = new Twitch.Player(rt, options);

if i use html5 is working
https://player.twitch.tv/?channel=sdimitriss&html5&parent=localhost
that mean , embed player only works to server ?
any help ?

Yes but needs to be on port 80 or 443

For electron thy this fix

you can intercept the request using session.defaultSession.webRequest.onHeadersReceived in your app.whenReady() and remove the frame-ancestors from the headers (in the context of how to embed now in Electron)
you still need to set a parent to avoid getting the warning message, but it doesn’t really matter what you set it to at that point.

Android apps the discussion is still on going in the main threads

As you can see on

Where you have already posted.

Closing this thread to maintain less active threads on the same issue