I need to show youtube url in laravel 8 app. I found branch Overcoming "Display forbidden by X-Frame-Options" and using it I made in my blade file :
I got this https://www.youtube.com/watch?v=xjqzftaWkmg video and added on my form :
<div class="tab-pane container mt-3" id="youtubeTabPane">
<div class="col-12 form-group">
<label class="w-100 mb-0"><span class="d-block mb-1"> Youtube</span>
::{{ old('youtube_url', $news->youtube_url) }}
</label>
<input
class="form-control"
name="youtube_url"
value="{{ old('youtube_url', $news->youtube_url) }}"
/>
<iframe width="560" height="315" src="{{ old('youtube_url', $news->youtube_url) }}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>
</div>
as a parameter I got error message : https://prnt.sc/ky8JRP6CI97T But clicking the “Watch on youtube” valid video on is opened.
I copypasted code from small video lesson at link https://www.youtube.com/watch?v=ly36kn0ug4k and this copypasted code visible ok : https://prnt.sc/BpLP4efWSYlI
The code of these 2 iframes :
<iframe width="560" height="315" src="https://www.youtube.com/embed/xjqzftaWkmg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture;" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ly36kn0ug4k" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
So some youtube videos are rendered ok, some not.
I suppose these are some youtube video props, which I could not find...
This has nothing to do with Laravel. If you open the links https://www.youtube.com/embed/xjqzftaWkmg
, you will see the link does not work. But for other links like https://www.youtube.com/embed/ly36kn0ug4k
it does work. This is a property of the YouTube video itself. As a content creator on YouTube, you can restrict others from embedding the video - see https://support.google.com/youtube/answer/6301625?hl=en
So for the videos where it is not being embedded, it is possibly restricted by the content creator.