Hiding and loading a video

Hi,
I spoke with the wix people and apparently they don’t support their website coding so I need help. I’m trying to hide a video upon load, which I did in the properties menu but that’s not working.

Also, I’m trying to have a button show the video player and load a specific video. Is that possible? The wix “tech support” person said it’s not possible with the editor but might be possible with coding but they didn’t know.

Here is my code:

export function button6_onClick(event) {
let videoUrl = $w(“#videoPlayer1”).videoUrl;
// “Julius Krappe | This is San Francisco on Vimeo”;
$w(“#videoPlayer1”).videoUrl = “Julius Krappe | This is San Francisco on Vimeo”;
$w(‘#videoPlayer1’).show();
}

Is this ok? Will it show the video player and load the URL that I want? Please help. Thank you!

Why bother with code when you can just use Wix Video or the Wix Videoplayer on your page.
https://support.wix.com/en/article/displaying-videos-on-your-site-with-wix-video

Then you can simply have the Wix Videoplayer element setup with collapsed on load in the properties panel for it and then all you will need to do is have the videoplayer element expand when the button is clicked on.

Collapse is better than hide as it doesn’t take up any space on your page, whereas with hidden the element is still taking up space on the page, however it won’t be shown to the user.

Just remember that when the videoplayer expands it might push everything underneath it downwards when the videoplayer expands into view.
https://www.wix.com/corvid/reference/$w.CollapsedMixin.html

Yes, I don’t want to collapse the video player because I want to keep the text below at the same level as when the video isn’t playing.

Can anyone help me with loading different videos with a button on my Wix page?