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


#1

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

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


#3

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:


#4

yes, 1 video with audio


#5

try
IntroVideo.nodes.control.pause();

Steve


#6

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?


#7

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.


#8

I was just going to say the same thing.

Steve


#9

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

Thank you again :smiley:
Milenne


#10

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


#11

It’s in millisecond if I remember correctly.

Steve