317 words
2 minutes
Adding Videos to a Web Page
Maybe you’ve also wondered how to embed platform videos into a webpage.
Here are some methods that might help you (≧▽≦)
Methods for Embedding Video in a Web Page
---title: Adding Videos to a Web Pagepublished: 2025-08-17---Bilibili embed methodsrc="//player.bilibili.com/player.html?bvid={BV-ID}&p=page-number"
Twitter embed method<blockquote class="twitter-tweet"> <a href="https://twitter.com/xxx"></a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Other embed method<iframe width="100%" height="468" src="https://www.youtube.com/embed/5gIf0_xpFPI?si=N1WTorLKL0uwLsU_" title="YouTube video player" frameborder="0" allowfullscreen></iframe>YouTube
Bilibili
Using Lottie to Play Animations
Another method is to export After Effects videos as JSON files and use Lottie to implement web animations.
Project Structure
Assume your project directory looks like this:
/project /static /js lottie.js /animation_web /ae_animation ae_animation.json index.htmlExplanation: lottie.js: Lottie official JS library ae_animation.json: Animation file exported from AE index.html: The page file
Here’s an example code:
<!DOCTYPE html><html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="static/js/lottie.js"></script> <title>lottie</title> <style> * { font-size: 2vmin; margin: 0; padding: 0; } body { display: flex; justify-content: center; align-items: center; width: 100%; height: 100vh; background-color: #f7f7f7; overflow: hidden; } #container { position: absolute; display: flex; justify-content: center; align-items: center; width: 100%; height: 100vh; background-color: #171717; } .container_hidden { transform: translateY(100%); visibility: hidden; transition: 0.8s ease; } #animation_box { position: relative; width: 50rem; }
</style></head>
<body> <div id="container"> <div id="animation_box"></div> </div></body><script> let ani = lottie.loadAnimation({ container: document.getElementById("animation_box"), renderer: 'svg', loop: false, autoplay: true, path: 'your_ae_animation.json' }); let readystate = 0; setTimeout(() => { readystate = 1; }, 5000);
// Frame listener ani.addEventListener("enterFrame", () => { if (ani.currentFrame >= 65) { if (readystate != 1) { ani.goToAndPlay(0); } } }); // Animation complete event ani.addEventListener("complete", () => { document.getElementById("container").classList.add("container_hidden"); });</script></html>Conclusion
That’s the tutorial on using Lottie to create web animations,
as well as embedding videos with iframe.
Here are more resources on Lottie compatibility and extensions:
Adding Videos to a Web Page
https://blog.mazumi.asia/posts/video/