Embedded YouTube video doesn't work on local server

Sergiy Shcherbina's answer helped me solve this issue. I was running my web server from a vm and accessing it through my local IP address.

It seems that you need to access your page that contains the embedded youtube player through a host name and NOT an IP address.

How I solved This for my dev environment

Before the change, I was accessing my web-page like this: http://192.168.x.x:3000/video and i would get 'video unavailable' errors for many videos that were verifiably 'embeddable'.

A Hacky word-around: I set a hostname for my VM in my hosts file and aliased my IP address to dev-vm. How to edit your host file

Now i access the page which has my embedded player like this: http://dev-vm:3000/video and now videos that previously gave me a 'video unavailable' error are now playing.

What a bizarre issue. I hope this helps some people who are having a similar issue.


It works on sites with domain and does not work on sites reached by IP adress. Works when using on "localhost" and causes "The video is unavailable" when using "127.0.0.1". This is really strange...


For some god-forsaken reason, known only to YouTube's engineers, some videos require an HTTP server to play.

If you're familiar with npm and Node.js, you can follow the instructions here so you can set up an HTTP server and try it out for yourself.

But please, if you do have the time and willingness, send a bug report about this issue by following the instructions here. This sort of issue should definitely not be happening.

Best of luck!