Video Player Alpha is not restarting

Hi there,

I followed the doc of video player but i can’t restart my video when finish.

My code;

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

var videoPlayer = symbol.nodes.Blanco__Dulce_1segundatanda_1_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();


videoPlayer.start();

}

videoPlayer.on(“finish”, hasFinishedVideo);
function hasFinishedVideo(){
videoPlayer.restart();
}

Pablo.

Hi @mfvgme,

You can drag the video from the Hierarchy into a script and add a finish event handler. Within this finish event handler, you can call the restart function. As seen below.

video

Hope this helps.

George

1 Like

Hi @George,

I think the only difference it’s that you did a event from the instance dragging. I did the same but still doesn’t works.
My actual code:

const Blanco__Dulce_1segundatanda_1_mp4 = symbol.nodes.Blanco__Dulce_1segundatanda_1_mp4;

parent.on(“ready”, () => {

// Runs when ready occurs on the parent node

Blanco__Dulce_1segundatanda_1_mp4.start();

});

symbol.nodes.Blanco__Dulce_1segundatanda_1_mp4.on(“finish”, () => {

// Runs when finish occurs on the Blanco_ Dulce_1segundatanda_1.mp4 node

Blanco__Dulce_1segundatanda_1_mp4.restart();

});

PS: The “finish” event never happens

EDIT: Now works. The problem it’s doesn’t works in my laptot, but works in my device. That’s a normal behaviour?