How to stop the audio when we stop a video.?

I have probably done this before, but I cannot stop the audio when I close a video. I pause the video but the audio continues.
How can I stop the audio? Thanks in advance

2 Likes

Are you just playing 1 video with audio?
The pause should stop it. make sure to pause before closing. it may not be getting the pause if its still playing.

Steve

2 Likes

Thanks Steve… Is this right?

const IntroVideo = symbol.nodes.Video_Player3;

parent.on(“pointerdown”, (e) => {
// Runs when pointerdown occurs on the parent node
// The argument e contains useful info about this event:
// https://docs.zap.works/studio/scripting/reference/object/events/pointerdown/

//Stop Video
IntroVideo.nodes.control.pause;


//Turn Intro Off
symbol.controllers.Intro_CNT.elements.Intro_Off.activate();

//Turn Enter my World Icon Off
symbol.controllers.EnterWorld_CNT.elements.EnterWorldOff.activate();


//Turn 360 World On
symbol.controllers.n360_CNT.elements.n360_On.activate();

//Turn On UI
symbol.controllers.UI_CNT.elements.UI_On.activate();

});

Still not working :frowning:

2 Likes

yes, 1 video with audio

2 Likes

try
IntroVideo.nodes.control.pause();

Steve

3 Likes

Thanks Steve. it works now ;-). But we separated the video from the audio at the end. One more question, how can I tell the audio to delay a few seconds before playing?

1 Like

Hello @digitalpopups,

Try something like:

Z.after(time, ()=> symbol.nodes.audio.start());

You may also open a block:

Z.after(time ()=>{
    symbol.nodes.audio.start();
});

In “time” you put how much time you want to delay, like 250, 1000 and etc. Remember that each 1000 is a sec, so 2000 is 2 sec, 3000 is 3 sec and so.

Also, here is the article about this:

Hope this helps you!

Att, HigĂŁo.

2 Likes

I was just going to say the same thing.

Steve

2 Likes

Thank you both !! ;-). Such an easy thing ! :wink: I believe I only use 10 % of zapworks really.

Thank you again :smiley:
Milenne

2 Likes

Well. I had no idea that 1000 was one second.

2 Likes

It’s in millisecond if I remember correctly.

Steve

1 Like

Thanks a lot, it worked for me! :smiley:

1 Like