Downloaded video texture example not working due to console error?

Dear Community,

These dope playground examples with youtube video textures don’t work when I download it and run locally.


The error is:
Uncaught TypeError: Cannot read property ‘offsetWidth’ of null

On this line:
let zone = document.getElementById(‘canvasZone’);

I google around and it might have to do with load order, but I don’t see anything that helps with the babylon context. Any ideas?

I run it locally with http-server

This is expected cause the code itself contains a few tricks directly using some of the playground dom elements which do not exist when downloaded locally.

Thank you @sebavan, is there documentation of said tricks or some way to understand how to do them?

In the downloaded code (index.html), simply replace:

    <canvas id="renderCanvas"></canvas>


<div id="canvasZone">
    <canvas id="renderCanvas"></canvas>