Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Getting marbles to fall convincingly in a browser is the easier half of this project. The harder half is turning a run into a file that plays back with the same frames, timing and sound every time. In the creator’s account, the export does not record the screen. It renders each frame at a chosen resolution on a deterministic physics clock, then encodes the result as a vertical MP4 with sound. Each of those steps is a place where a browser’s live pacing can quietly break the result.

What the project is

The creator describes a three-dimensional marble-run playground that runs in the browser, with a physics simulation and a vertical MP4 export that includes sound. The first version of the export idea was to record the canvas directly. The version the creator says shipped takes a different route: it renders at a selected resolution and frame rate, and the physics advances on a deterministic clock rather than on wall-clock time.

These details come from the creator’s own post. They have not been checked against the project’s source code or a running build, and the material available does not name the physics engine, the muxing library or the audio-generation method. Treat them as a description of the intended design, not as independently validated behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why exporting is harder than playing back

Ordinary playback is paced by the browser and the display. If a frame arrives late, the viewer simply sees a slightly uneven motion, and the simulation keeps going. A finished file has no such slack. It needs a defined timeline, a fixed frame size and a set of timestamps that a player will interpret later, with the sound placed on the same timeline.

#1 Best Overall
Sale
JOYIN 236Pcs Glowing Marble Run with Motorized Elevator- Construction Building Blocks Toys with 30 Glow in The Dark Plastic Marbles, STEM Toy for Boys and Girls, Christmas Birthday Gifts
  • All-Inclusive Marble Extravaganza: Our 236 Pcs Elevator Marble Run Toy Set is here to take Play period to new heights! Including 176 vibrant track pieces, 15 sleek plastic marbles, 30 glow-in-the-dark marbles, and 15 classic glass marbles, this marble tower is a complete "marbel run" masterpiece.
  • Innovative Elevator Magic: The unique elevator feature elevates this marble race track from cool to WOW! It's a rush watching marbles climb up and slide down in an endless loop, ensuring the marble run never stops.
  • Sturdy and Higher Quality: Made with durable materials, our marble runs for kids withstand the test of Play period. This marble set is crafted to last, ensuring countless hours of racing fun.
  • Shine with Glow Marbles: Turn off the lights and watch the race light up! Our glow marbles add an extra dazzle to your child's marble games, making the race track a radiant spectacle in the dark.
  • Perfect for Family Bonding: Engage in a marble race that's great for parent-child interaction. Spend quality time building and racing, creating memories with every marble set showdown.

That shift changes the engineering problem in three ways. The simulation must advance by known amounts per output frame, not by however much time happened to pass. The renderer must draw at the output dimensions, not at whatever size the editor canvas happens to be. And the encoder must receive frames at a pace it can keep up with, because the encoding step runs asynchronously and does not block the loop that produces frames.

The export pipeline, step by step

  1. Set the timeline. Choose the output frame rate, the duration, the width and height, and the orientation. Then assign each output frame a timestamp. In WebCodecs, a VideoFrame carries a timestamp and a duration; MDN’s example assigns timestamps in microseconds for a 30-fps sequence.
  2. Advance the simulation on a fixed step. Step the physics by a constant interval for each output frame so that simulation progress depends on the frame count, not on how fast the screen refreshes. PlayCanvas’s getting-started physics documentation gives a concrete example of this: physics steps at 1/60 of a second, and bodies behave the same at 30 and 144 display frames per second. That is an example from a different engine. It shows the technique, not the creator’s implementation. In PlayCanvas’s words, “The simulation steps at a fixed rate.”
  3. Render each frame at output size. Draw the scene at the export resolution and aspect ratio. The creator reports rendering at an export resolution rather than capturing the screen, so the editor’s window size and device pixel ratio should not affect the file.
  4. Encode frames without flooding the encoder. WebCodecs exposes frame-by-frame video and audio encoding. Because the encoder works asynchronously, the export loop has to watch its queue, close each VideoFrame once it is finished with, and flush pending output at the end. MDN’s WebCodecs guidance warns that an encoder queue can grow without bound if frames are submitted faster than they are encoded, which in practice means memory pressure and a failed export.
  5. Mux the encoded tracks into a container. WebCodecs produces encoded chunks, not a playable MP4 or WebM. A separate muxer has to write the video and audio samples into the container with the correct metadata. Choosing that muxer is an implementation decision of its own, and the creator’s material does not say which one was used.
  6. Put sound on the same timeline. If collision sounds or a music track are part of the export, each sound’s timestamp has to follow the export timeline, not the moment it played in the live editor. The creator says the MP4 includes sound. The method used to generate or place that audio is not stated.

Two export routes compared

The two common approaches trade simplicity against control. Neither is wrong for every project, but they fail in different ways.

Rank #2
Sale
MaxTronic Marble Run Toy, 110pcs Marble Maze Kit STEM Educational Learning Toy for Kids, Mable Race Construction Railway Building Blocks with 60 Marbles Birthday Gift for Boys Girls 3-12 Years Old
  • Interactive Mable Run Game - MaxTronic mable run set includes 50 building pieces with 60 marbles.Comes with easy assembly manual, kids need to think about the track directdions and assemble it. Encouraging children's imagination and improving problem solving skills. Perfect for both single kid and family playing together.
  • STEM Fun for Different Levels - For little kids aged 3-5, this marble run is great for them to learn colors, numbers and build blocks to assemble it while having fun. And for kids aged above 5, children need to consider the design of the track and the gravitrax, which gives child's spatial imagination and logical thinking.
  • Teaching Assistant & Free up Parent's Time - There is no fixed shape, kids can buid different shapes as they like. Our Marble Runs can be found in many classrooms to teach important STEM concepts. Building these pieces will keep children entertained for hours which helps free up parent's time.
  • Safe for Kids -Marble maze toys was made of solid ABS,non toxic,not easy to break or snapped. Marble tracks are ASTM-certified and CPSIA compliant which is safe for kids. Smooth edges avoid scratching hands. Warm tip: Please be careful not to let your child swallow the balls.
  • Perfect Gift Surprise - The marble run set use a beautifully packed color box, and the components are in different colors to match the classic and beautiful styles, definitely a popular birthday/holiday gift for kids! It is very suitable for children to use it as an entertainment project during parties, after school, weekends, and even all other holidays.
Approach What it does Strengths and limits What to compare
Canvas stream with MediaRecorder canvas.captureStream() produces a real-time stream from the canvas contents. MediaRecorder records that stream and can be set to a MIME type and bitrate. The most direct route for recording what the canvas shows. Capture runs in real time, so frame timing follows the live page. It does not by itself give a fixed simulation clock or offline rendering. Supported MIME types and codecs vary by browser and must be checked at runtime. Per MDN’s reference, the capture is real-time, not deterministic. Setup effort, MIME type support in target browsers, audio integration, and whether live pacing is acceptable for the output.
Explicit frame rendering with WebCodecs Renders frames for a chosen timeline, builds VideoFrame objects with explicit timestamps, submits them to a VideoEncoder, encodes audio separately, and muxes the chunks into a container. Gives per-frame timestamp control and encoder configuration, which suits deterministic or offline rendering. Requires queue and memory management, codec support checks, audio handling and a muxer. WebCodecs alone does not produce a finished file. Timeline control, repeatability, codec support per browser and device, encode speed, memory use, audio sync, output profile, and the muxer’s requirements.

Neither route guarantees a repeatable result by itself. A deterministic export depends on the simulation, the renderer, the clock, the resource handling, the codecs and the muxer all cooperating. The creator’s choice to render on a deterministic clock is what makes the second route suit the project; the API alone does not supply that property.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What to verify before relying on an export

  • Confirm that the target browsers support the video codec, audio codec and container you intend to use. Support is browser-specific and changes over time, so check it at runtime rather than assuming it.
  • Confirm the encoder queue stays bounded during a long run, and that every frame is closed after encoding.
  • Check the final file’s duration and frame count against the intended timeline. A mismatch usually means timestamps or the flush step were handled incorrectly.
  • Play the exported file in more than one player and listen for audio drift over the full length, since the creator’s material does not establish sync across browsers.
  • Test a run with many simultaneous collisions, because sound events are the most likely place for timestamps to bunch up or drift.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What remains unverified

The available material establishes the design the creator describes and the browser APIs that a pipeline like this would use. It does not establish the exact physics engine, the muxing library, the audio-generation method, or how the export behaves across different browsers and devices. Those points should be read as the creator’s account, pending any independent check of the code or a running build.

Rank #3
Meland Marble Run - 132Pcs Marble Maze Game Building Toy for Kid, Marble Track Race Set & STEM Learning Toys for Boy Girl Age 3 4 5 6 7 8 9+ (102 Translucent Marbulous Pcs & 30 Glass Marbles)
  • 【Glowing In Dark Marbles Inside Add More Fun for An Amazing Marble Games】Meland 2024 NEW Launched Marble Run Set comes with 102 translucent building pieces, 20pcs normal glass marbles and 10pcs special pattern marbles that glow in the dark! All the marble building pieces are interchangeable so kids can create endless models. The booklet can guide toddlers through the building process step by step, so little ones can build whatever their skill level.
  • 【Stimulates Creativity, Promotes Patience & Develops Self-Confidence】Lots of marble toy kits and ways of building opportunities perfect for improving hand-eye coordination, problem- solving skills and delevep concentration. Away from TV and electronics, toddlers will feel proud and accomplished with what they have done which promotes a healthy sense of self-confidence.
  • 【Ensure Kids' Safety and Free up Parents' Time.】Made of child-friendly ABS material, smooth edges avoid scratching hands. Keeps children entertained for hours and gives parents time.
  • 【Taller and Bigger Marble Run Cultivates Parent-Child Relationship】 With a unisex neutral colour tones, our marble race toy is designed to meet each stage of a boy's and girl's development(age 3+) and promotes STEM learning through play. Parents can build it with little builders can make your relationship more intimate.
  • 【See-Through Translucent Marble Pieces】Meland marble run toys are translucent so children can see the marble as it goes from the top of the set to the bottom. Comes with 8 marble tower bases, allowing kids to build bigger and sturdier marble runs. Nice educational building toys for boys & girls aged 3 4 5 6 7 8 9 10 11 12 years.

For the underlying APIs, the most reliable references are MDN’s pages for WebCodecs, MediaRecorder and canvas capture, and PlayCanvas’s getting-started physics documentation for the fixed-step pattern.

Best Value
National Geographic Motorized Marble Run 150-Piece Building Set for Kids
  • MOTORIZED LIFT FOR ENDLESS RUNS - Features a motorized lift that carries your marbles up almost 20 inches and drop them onto the track! Create a perpetual motion machine that continuously takes your marbles back to the top to launch again!
  • 150-PIECE KIT FOR MASSIVE MAZES - With 106 construction pieces, 30 marbles, and the 14-piece spiral lift, you get everything you need to create endless configurations of marble runs! A storage bag is also included to safely store your kit.
  • COMPATIBLE WITH NATIONAL GEOGRAPHIC MARBLE RUNS - Expand any National Geographic Glow-in-the-Dark Marble Run with this kit! All pieces, including the spiral lift, work seamlessly with existing sets (non-magnetic), so you can create even bigger runs!
  • LEARN WITH NATIONAL GEOGRAPHIC - With National Geographic STEM toys, learning is always part of the fun! The included Learning Guide contains fascinating facts about physics, motion, and more! It also contains tips for building amazing marble runs!
  • AMAZON EXCLUSIVE - Blue Marble has developed this product exclusively for Amazon.
Rank #4
NATIONAL GEOGRAPHIC Glowing Marble Run – Construction Set with 15 Glow in the Dark Glass Marbles & Storage Bag, STEM Gifts for Boys and Girls, Building Project Toy (Amazon Exclusive)
  • STURDY TIGHT-FIT PIECES – This construction kit is designed to fit together snuggly so your marble maze won’t fall apart while you play. With 5 sturdy bases, 15 exciting action pieces, and 45 clear smooth-run track pieces, our kit has countless imaginative configurations.
  • GLOW-IN-THE-DARK MARBLES - This marble run kit includes 15 glow in the dark glass marbles in 6 colors! Kids will love watching them glow as they zig-zag down their custom tracks!
  • CONVENIENT STORAGE – A large storage bag makes it easy to store all your marble run construction pieces and glow-in-the-dark marbles in one place.
  • GREAT STEM TOY – The learning guide inside teaches about the physics of motion and aerodynamics. It also includes marble run construction experiments.
  • AMAZON EXCLUSIVE - Blue Marble has developed this product exclusively for Amazon.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.