0

I use this package node-ytdl to get a direct link of any youtube video.

When I start playing the source using a regular HTML5 tag it works with cors() on the express server.

but once I start using video.js to run the video it gives me cors error, this CORS error get working with Google Chrome CORS extension.

Idk is this needme to have a copy of video.js package and tweak it or there's a known work around ?

BaHaa Jr.
  • 534
  • 1
  • 7
  • 19

2 Answers2

-1

The CORS issue isn't really specific to your video JS file. This has been explained properly here .

sajak upadhyaya
  • 121
  • 2
  • 9
-2

Try adding the following to your Express app to allow cors:

app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    next();
});
Richard Dunn
  • 6,165
  • 1
  • 25
  • 36