Code only working on test mode NOT live

Hello.

I’m very new to coding. I was just trying to make some elements of my website appear after my video finishes but everyhting works great on test mode but when I publish the site and go to live mode nothing happens…

Can someone please help me?

This is the code:

let videoDuration;
let interval;

$w(‘#videoPlayer1’).onPlay(() => {
// Guardamos la duración del video cuando comienza a reproducirse
videoDuration = $w(‘#videoPlayer1’).duration;

// Iniciamos un temporizador para activar las secciones 20 segundos antes de que termine el video
interval = setInterval(() => {
    const currentTime = $w('#videoPlayer1').currentTime;
    const timeToActivate = videoDuration - 20;  // 20 segundos antes de que termine el video
    
    if (currentTime >= timeToActivate) {
        // Activar secciones y botón
        $w("#section42").expand();  
        $w("#section42").show();    

        $w("#section48").expand();  
        $w("#section48").show();    

        $w("#section54").expand();  
        $w("#section54").show();    

        $w("#section49").expand();  
        $w("#section49").show();    

        $w("#section43").expand();  
        $w("#section43").show();    

        $w("#section52").expand();  
        $w("#section52").show();    

        $w("#section53").expand();  
        $w("#section53").show();    

        $w("#button34").expand();   
        $w("#button34").show();     

        $w("#button46").expand();  
        $w("#button46").show();  // Activamos el botón46

        // Detenemos el temporizador una vez que se hayan mostrado las secciones
        clearInterval(interval);
    }
}, 1000);  // Verifica el tiempo cada segundo

});

And the site:

Thank you so much in advance!!