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

  1. 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>#>



    Ensure you allowed the formatter to process Inline HTML and the CSP (Content Security Policy) to load from the media source.
    1. enable Inline HTML support
      1. for a page (page properties > extended) as Admin or
      2. for everyone (secondary config ['allow_rawhtml'])
    2. If CSP is enabled, what is recommended, you must set the CSP directives in your csp_custom.conf:
      1. Content-Security-Policy:
        	default-src 'self';
        	script-src 'self' 'unsafe-inline';
        	style-src 'self' 'unsafe-inline';
        	img-src * data:;
        	media-src 'self' archive.org *.youtube.com *.youtube-nocookie.com dailymotion.com;
        	object-src 'self' archive.org *.googlevideo.com *.ytimg.com *.youtube.com *.youtube-nocookie.com dailymotion.com;
        	frame-src 'self' archive.org *.youtube.com *.youtube-nocookie.com *.dailymotion.com;	
      2. set your Content-Security-Policy (CSP) in your secondary config config['csp'] to 2 (custom)

    • WikiAdmin
    • 02.04.2022 18:55 edited
  2. Re: Embedding Youtube code: possible?

    Use the two options as explained above, for instance the embed action example.
    Just use it and replace the URL with yours.
    For more details please read the embed section under Actions.
    • WikiAdmin
    • 23.10.2024 08:31 edited
  3. Ответ: 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/embed
    In my non-working –
    youtube.com/watch?v=
    youtube.com/shorts/
    I suspect youtu.be/ won't work either
    Any idea for make Copy-Paste links works?
    • VictorAlx
    • 23.10.2024 13:44 edited
  4. 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/HASH
    https://www.youtube-nocookie.com/embed/HASH

    Otherwise 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.
    • WikiAdmin
    • 24.10.2024 08:05 edited
Log in or create an account to post a comment.