Trying to play 2 videos in scene, but can't publish this


#1

var display_shown = symbol.controllers.display.elements.shown;
var display_hidden = symbol.controllers.display.elements.hidden;
var Smallest_double_trouble_mp40 = symbol.nodes.Smallest_doubletrouble_mp4;

parent.on(“show”, parent_show);
function parent_show() {

// Make sure we start from fully hidden
display_hidden.reset();

// Move to the shown state
display_shown.activate();

// Start the video
Smallest_double_trouble_mp40.start();

symbol.controllers.animController.elements.animTimeline.play(1, true);

var display_shown = symbol.controllers.display.elements.shown;
var display_hidden = symbol.controllers.display.elements.hidden;
var Subtitles_mp4 = symbol.nodes.Subtitles_mp4;

parent.on(“show”, parent_show);
function parent_show() {

// Make sure we start from fully hidden
display_hidden.reset();

// Move to the shown state
display_shown.activate();

// Start the video
Subtitles_mp4.start();

}


#2

Hello @technology, hope you’ve been well,

First I’ve to say that to make your code work properly, all you got to do is put a “}” in the last line, as the print:

image

Also, I don’t know if is the forum or is you who want that your code have this issues but you are repeating functions (parent_show is a function and appears two times in the code), also you are repeating events (“show” is an event and either appears two times in the code). Isn’t a very good pratice has two equal events, functions, vars and etc. Your code could be done in just one, as in the print:

image

It’ll works properly with just one event and one function. One final thing is:

image

(In yellow is a part of a function block, in rose is other function block and the arrows means that the sequel thing is a function)

If you just put the “}” in the final of your code, all you’re doin’ is telling to JS that you have a function into other fuction with an event into other event. This is a very bad way to make the way to everything works fine.

Well, I hope everything works now and if you’ve any other question just give a shout. Also, I hope that you understand everything I’ve told you, if don’t tell me.

P.S.: How I said, I didn’t know if was the forum or was proposital but was just some lil’ things that I noticed.

att, Higão.


#3

Thanks a lot, I don’t know a whole lot about coding so most of it makes no sense to me - however I am willing to learn and what you’ve said makes sense. I will try it out in my scene this morning and let you know how it goes.

Many thanks


#4

Oh, I didn’t know about this. I just noticed because in your other post, the same thing happend (about repeating). Here in these links you can have some good references about typescript and javascript:

JS - https://www.w3schools.com/js/default.asp

Typescript - https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html

These sites works very good for me to take references, try new things and learn a bit here or there. Well.

att, Higão.