Using iframe with YouTube doesn't work

Steps to reproduce

  1. insert iframe for example <iframe src="https://www.youtube.com/watch?v=9ePl-ORfBrc"></iframe>
  2. switch to preview mode

Expected result

Thumbnail of Video and ability to watch it.

Actual result

empty box and when you click it, it takes focus of cursor

Environment

  • Operating system: Windows
  • Obsidian version: v0.12.4

Additional information

I tried it on different vaults and the behaviour is the same.
Old Links embedded previously still work as expected, for example the one in the help vault explaining iframe.
It works with other websites. I tested it with:
https://www.artstation.com/?sort_by=trending
https://twitter.com

Hi jedth, fellow user here.

YouTube iframes are working fine for me. Could you try pasting this embed in your page and see if it works?

<iframe 
  width="560" 
  height="315" 
  src="https://www.youtube.com/embed/c53sRVI4N9I" 
  title="YouTube video player" 
  frameborder="0" 
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
  allowfullscreen>
  </iframe>

(This is the code I get from going to the YouTube video, clicking “Share”, then clicking “Embed”.)

1 Like

Hey Craig :slight_smile:
hm weird like this it seems to work for me too, but before I could also just use the URL.
Any idea what might be causing this? Or is it just me not using HTML properly? :sweat_smile:

No idea. I’ve never been able to get YouTube embeds to work any other way. Glad it worked for you!