Essay 4 min read
How I Built a Demo Video with a Coding Agent Instead of an AI Video Generator
A few months ago, I started building a website for Embeducate, a service for teachers who want to host and distribute educational activities generated by AI. To show visitors what the service does on the homepage, I needed a lightweight video. One option I initially considered was an AI video generator: prompt in, video file out. I ruled that option out pretty quickly. Working with such a generator is a long and expensive process. It is also very hard to steer, because every minor correction requires generating the video from scratch, and there is no guarantee the output will be the exact same video with only that specific change.
Instead of relying on a static video file, I built the video from live elements in the page and orchestrated in code exactly when each element appears. This choice turned video creation into a process resembling iterative software development, where every timing or content change happens directly in the code. Technically, it is a single HTML file where all on-screen elements are a live DOM, and a script transitions them through the different stages of the video. The homepage has a thumbnail with a button, and clicking it opens the video in a floating window. Inside the video itself, a teacher asks an AI assistant for an educational activity, drags the result into the product, and leaves with a ready-to-share link.
You can see the live video on the Embeducate homepage at https://embeducate.com.
What you get from a code-based video
-
Targeted editing with a code agent: A code agent can build and maintain the video because everything is written in code, meaning any edit is applied as a specific diff in the file rather than rolling the dice again.
-
Fast translation to three languages: All texts appearing in the video are saved as regular strings in the code, so adapting the video to the site’s three languages — Hebrew, English, and Arabic — comes down to translating text. The code agent also adapts the reading direction of the on-screen interface, using the same techniques any website uses for a right-to-left language.
-
True adaptability to any screen size: In a responsive website, the video is as responsive as all other components, and a single source adapts itself to any screen size, so that in the narrow layout the scene rearranges itself instead of getting compressed, and the product window slides up from the bottom instead of sitting next to the chat.
-
Minimal file weight: According to precise measurements, the video file itself weighs 104KB, the sound files weigh a combined 185KB, and a single MP4 export in one format and one language weighs 4.05MB.
-
Flexible export for social networks: When a static video file is required for external distribution, that same video is exported to MP4 in any size and aspect ratio a social network requests.
The Player and the Sounds
After the video itself was working on screen, it became clear what was still missing. A standard browser animation runs forward from start to finish, which is usually the accepted norm. I wanted my creation to function like a video running inside a real player, supporting pause, mute, fast-forward, and rewind. To support this behavior in code, a stage cannot rely on the stage that preceded it. Instead, every on-screen element must calculate its appearance and position directly from the given timestamp on the timeline, rather than from its state a moment ago.
Switching to timestamp-based calculation shifted the center of gravity of the project. Most iterations went into building the player itself rather than creating the video scenes. This is a significant initial investment, but it is a one-time cost that can be turned into a ready-made infrastructure for future videos I will build for the site.
The sounds were the easy side of that same coin. I chose free sound effects, gave each file a name describing exactly what it plays, and asked the code agent to use them at the appropriate timings. The agent placed the effects at the correct points in the video almost instantly. The filenames were the interface, and those very same names carried over with me into the video export process.
Exporting to a Video File
When it is time to record, that same HTML file receives a URL parameter and switches to video mode. In this mode, the display changes to accommodate a static file. An opening slide is added at the beginning of the video, which is also the thumbnail messaging apps display when the link is shared. The player controls are hidden, and the site address is printed on the screen instead of a clickable button because you cannot click on a video. In a 9:16 portrait version, the content is kept within the central 4:5 area, because phone player controls cover the top and bottom of the screen.
Summary
I entered this project without knowing a similar practice beforehand, and the entire workload took place in unmapped territory. Despite the lack of prior familiarity with this approach, the build itself was not expensive, and the reason for that is working with code agents.