Embedding Youtube code: possible?
Dear Wackowiki insiders
Is it possible to embed a Youtube video with the code given by Youtube like this:
<iframe width="560" height="315" src="https://www.youtube.com/embed/dROLGWhCcWY" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Thanks for any help.
Morgy
Comments
Log in or create an account to post a comment.
1. Embedding Youtube code via embed action
You can use the embed action for this:
{{embed url="https://www.youtube.com/embed/dROLGWhCcWY" width="560" height="315"}}2. Embedding Youtube HTML5 Video as Inline HTML
<#<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dROLGWhCcWY" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>#><#<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dROLGWhCcWY" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>#>
Ensure you allowed the formatter to process Inline HTML and the CSP (Content Security Policy) to load from the media source.
['allow_rawhtml'])config['csp']to 2 (custom)Ответ: Embedding Youtube code: possible?
How to embed links such as
https://www.youtube.com/watch?v=sgjIQWP_8nE
https://www.youtube.com/shorts/ZB1d_3xJboY
on https://wackowiki.org/doc/Sandbox they are not playing
Re: Embedding Youtube code: possible?
Use the two options as explained above, for instance the
embedaction example.Just use it and replace the URL with yours.
For more details please read the embed section under Actions.
Ответ: Embedding Youtube code: possible?
Replace the URL not works. I did it in Sandbox, those two links you deleted.
Links are different - the working example has
youtube-nocookie.com/embedIn my non-working -
youtube.com/watch?v=youtube.com/shorts/I suspect
youtu.be/won't work eitherAny idea for make Copy-Paste links works?
Re: Embedding Youtube code: possible?
You must use the embed link of YouTube. There is a Share link / icon on each Youtube video showing you the embed options. Its an API issue of YouTube.
Or simply use
https://www.youtube.com/embed/HASHhttps://www.youtube-nocookie.com/embed/HASHOtherwise YouTube wont service your request.
It is possible to write an action that parses all these link combinations, takes the hash and uses finally the
embed/link. I'm not aware of a PHP libary that will do this for a large variety of streaming providers.Ответ: Embedding Youtube code: possible?
Using embed/HASH is more complicated than Copy-Paste and therefore a bit stressful. If there is no choice ...
Thank you.
Re: Embedding Youtube code: possible?
I found out there is a oEmbed API for that.
So it is possible to implement that, add a oEmbed library and action similar to the feed action.
Another option is to match all external links against the oEmbed library API in the
link()function.Conceivable as an available extension, but would not add it to the core.