问题
I have a list of embedded youtube videos. My problem is that out of the four videos I display one returns the error: Video not available
.
I have tried changing the browser, but it doesn't work either. I have also checked if the video allows being embedded on external sides. If I look at the console of my browser no exception is thrown.
<li class="col-sm-3 col-xs-6 single_item vid">
<iframe width="100%" height="315" src="https://www.youtube.com/embed/KdbDDVcw7qc?rel=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<figcaption class="overlay">
</figcaption>
</li>
Has anyone an idea, why this video doesn't work, but all others do?
回答1:
YouTube forbids embedding some videos in a localhost environment
without a public domain, but your video can be embedded with no issue through a public domain/ sub-domain
try the same using webhosting apps or online html tools.
回答2:
It works perfectly. I tried embedding four different videos and all of them works well. Here is the link https://jsfiddle.net/Arpit09/kt1dwqjp/7/
<iframe width="100%" height="315" src="https://www.youtube.com/embed/KdbDDVcw7qc?rel=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
回答3:
If you're unable to see the video on the JSFiddle link that MrBean provided, then there is something wrong with your device, rather than the embed itself.
If that's the case, isolating the problem is the next step.
Have you tried:
A different browser. (Perhaps there's a problem with one of your extensions, or your cache.)
A different computer on the network. (Perhaps there's a problem with your security settings or firewall filter.)
A different computer on a different network. (This will emulate most users, which have reported to be able to see the video correctly.)
回答4:
This video should work, but you may not have access to view or display it.
回答5:
We had a very similar issue yet none of the standard approaches listed here and in other SO questions answered / solved our issue.
In our case, the issue was limited to videos that had License content typically Music Style videos from the well known artists.
The issue did not happen when the video was not licensed. I know some artists can flag that their videos are not shareable, and, domains can be allowed / blocked etc. However, we know that none of these related to us.
Instead the issue was the Referer Policy. I suspect Google / Youtube for licensed content builds a trust model, and part of that trust model expects a strong Referer policy.
We solved our issue by setting the Referer Policy MDN Refer Policy to a stronger referer policy.
If we used the the default:
'no-referrer-when-downgrade'
the video when played would say Video not available.
We changed to:
origin-when-cross-origin
the video played successfully
来源:https://stackoverflow.com/questions/59532941/embeded-youtube-video-not-available-in-iframe-html