Localhost Embedded Video?

My toy program I am working on is Windows program, local host type deal.

It also the Edge Browser to handle the web view of things, via WebView2Loader intergration.

I’d like to show my own stream in my program, so I can monitor how it looks and such that everyone else see’s.

Yes, I could just point the browser object to my twitch page, but i’d rather just have the Video stream only as I have my own chat support built in.

Following this

Video & Clips | Twitch Developers

But this does not seem to work well with LOCALHOST usage?

I have no public facing webservers and rather not.

I have this in my meta tag

<meta http-equiv="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';">

Trying to use iframe examples or “Interactive Frames for Live Streams and VODs”

I get this


I take it the “parent” parameter in either case is my issue?

The parent is jsut the domain name.

So for localhost the parent will be localhost you didn’t describe a URL you used for the iFrame. So not sure what you have done wrong.

Did you check the console?

This is a CSP Policy. And you only need to play with CSP if you are employing CSP so if this tag isn’t present then the default rules will apply. And what you have put is basically a default rule.

CSP should not be an issue here.

<meta http-equiv="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';">


 <div id = "twitchy"> </div>

<script src= "https://player.twitch.tv/js/embed/v1.js"></script>
<div id="twitchy"></div>
<script type="text/javascript">
  var options = {
    width: 640,
    height: 480,
    channel: "jdredd3800",
    parent : ["localhost"]
    // only needed if your site is also embedded on embed.example.com and othersite.example.com
  var player = new Twitch.Player("twitchy", options);

If I use the above I get the following

And the page URL is http://localhost/anything or nothing here?

I was trying to load it locally as a file in the browser object. With no web server backend.

I can get around this by embedding a simple web server it looks.

Yeah that’ll be the issue websites are not websites if they are on file:// totally different scurity context.

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