Why is my video not playing?

Hi There,

If there is anyone that can please have a look at my code and tell me why my video is not playing?I would very much appreciate it.

Regards

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

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

var myvideo = Z.VideoTexture("BelguimCampus_AV_AR_ogv0");

var myplane = Z.Object("Plane0");
myplane.skin(myvideo);

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

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

myvideo.start();

}

Hey,

The issue here is that you are constructing a new Z.VideoTexture and Z.Object for your variables instead of using the ones you already have in your hierarchy.

Whenever you want to reference a node in the Hierarchy simply drag and drop the node into your script and insert it as a variable.

For this example the code should read something along the lines of:

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

parent.on("show", parent_show);
function parent_show() {
    
    // VideoTexture dragged from the Hierarchy
    var BelguimCampus_AV_AR_ogv0 = symbol.nodes.BelguimCampus_AV_AR_ogv0;
    
    // Plane dragged from the Hierarchy
    var Plane0 = symbol.nodes.Plane0;
    
    // Make sure we start from fully hidden
    display_hidden.reset();
    
    // Move to the shown state
    display_shown.activate();
	
	// Start the video
	BelguimCampus_AV_AR_ogv0.start();
}

Hope this helps :slight_smile:

Thanks for the reply Mark.

Something else is wrong because it is still not playing. Are there any other factors you can think of that might cause issues? Fps? File size? And is it suppose to have the “0” after “.ogv” when dragged into the hierarchy?

Do you mind if I export my project so you can have a look on your side please?

I can seen you’ve sent over the exported project via support, as this is likely a project setup related issue let’s continue the discussion there :slight_smile:

I have the same issue here…

Dragged the video into my media library, then dragged a plane and the video into the hierarchy…

assigned the video texture to my plane… I do see my video on the plane…

then created a variable in the show script… myTexture.start()… all I get is a black frame…

any clues?

thx

1 Like

OK, so I found an alternative… which is better i think… I’m using the MP4 version instead of OGV… I get the audio at the same time as well :slight_smile:

With MP4 video now supported we recommend using it over OGV, especially if the video you’re trying to play has audio as OGV files do not support audio.

More information can be found here - https://docs.zap.works/studio/video-in-the-3D-view/

Thanks,
Mark

Thx! is there a way to control the audio on it??

is there any example on how to control the volume?

thx

Marc.

Hi Marc,

Embedded MP4 video uses Z.Video so you can use the volume setter function to change the volume.

Thanks,
Mark