Initially, I wrote this as a help post. But in writing out the question, I found my answer in the TikTok developer docs.
Original post
I reviewed this forum and stumbled upon an iframe solution that works to embed TikTok videos in Obsidian’s editing/live preview and reading mode.
<iframe src="https://www.tiktok.com/embed/7382225350710824222" allow="fullscreen" style="width:19vw;height: 72vh;" frameborder="0" scrolling="no" autoplay="0" muted />
where 7382225350710824222
is the video id you get from TikTok from this example link: https://www.tiktok.com/@_jen_hamilton_/video/7382225350710824222
.
However, the result is the video autoplays. I’ve looked in other forums using an iFrame, but maybe the control isn’t there. In the example above, I tried autoplay="0"
and previously tried data-autoplay="false"
but to no avail.
Has anyone else tried to embed TikTok videos and disabled autoplay? Thanks!
Reference forum posts
- How do I embed TikTok Videos? - Help - Obsidian Forum
- Emedding TikTok Videos - Help - Obsidian Forum
- html - How to stop auto play in an embedded video? - Stack Overflow
Solution
Turns out, the TikTok for Developers documentation solved it. I was using an embed link where I should’ve been using the v1 player.
<iframe src="https://www.tiktok.com/player/v1/7382225350710824222?autoplay=0" allow="fullscreen" style="width:100%;height:50vh;" />
There’s still some wonky height issues, and I suspect this is the default height Obsidian has on the container around the editor. I gave it a good enough viewable height of 50vh
, which should be enough. Hopefully this helps those looking for a TikTok embed.
Ciao