iframe embedded YouTube video unavailable on NodeJS

Viewed 1046

I was trying to implement a simple player with a web server on a VM when I stumbled across this issue.

server.js

const express = require('express'); 
var app = express();
var path = __dirname + '/views/' ;
app.get("/",function(req,res,next){
  res.sendFile(path + "index.html");
});
app.listen(1823);
console.log('listening');

index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Alpha</title>
  </head>
  <body>
    <iframe id="player" width="640" height="360" src="http://www.youtube.com/embed/N0dbGGvsjf8?enablejsapi=1&origin=http://192.168.150.129">
    </iframe>
  </body>
</html>

Accessing the site locally with http://localhost:1823 works just fine. However, accessing the site from the local network such as http://192.168.150.129:1823 the iframe(?) stops working.

Screenshot

Same video works on JSFiddle.

NB: This only happens on certain videos.

e.g. with this iframe

<iframe id="player" type="text/html" width="640" height="360" src="http://www.youtube.com/embed/PfYnvDL0Qcw?enablejsapi=1&origin=http://192.168.150.129">
</iframe>

Both localhost and IP work the same.

All seems to point towards Node doing something? Why some videos work and others do not?

0 Answers
Related