Youtube embed (WP Classes and Nocookie)
-
I just discovered that it is better to use the youtube-nocookie for enhanced privacy url when embedding a vídeo, because of GDPR. But with Gutenberg it is not working with that urls. I can’t embed them directly.
I have read here in the forum that the Youtube embed is a youtube functionality that is used by Gutenberg, but at Youtube you have an option when you ask for the code to insert elsewhere, to select the “enhanced privacy”.
I could get the code to do this, it is like this:
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/E-CmFQl0Ar8" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
It would be great if that could be done directly within wordpress too.
I also changed a normal youtube embed to html to check what was added and got this:
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-has-aspect-ratio"><div class="wp-block-embed__wrapper"> https://youtu.be/E-CmFQ10Ar8 </div></figure>
And when I get the code to embed from Youtube a video normally is like this:
<iframe width="560" height="315" src="https://www.youtube.com/embed/E-CmFQl0Ar8" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
So is not being used the same way. Maybe it changed later. But then, I guess there could be a way to add the “enhanced privacy” option too?
Also, when I embeded a youtube video normally, it added some classes automatically. One of them was wp-embed-aspect-16-9 and that made a huge white space appear before the video. I am not quite sure that should be added.
- The topic ‘Youtube embed (WP Classes and Nocookie)’ is closed to new replies.