Play and Pause videos

So I know how to start my videos and pause them. However, after i paused them I can’t play them again. I always have to leave and reenter the room. Does anyone know how I can fix this? Like how can I play and pause videos several times?

Hi I just signed up can someone tell me how I can talk with a worker pleases?

Can someone plz respond I am not very patient

Hi @florebla,

It’s a little tricky - there is no built-in user interface for playing & pausing videos, so we have to build it ourselves.

Try remixing this Video Play/Pause demo, and look at the code & objects to see how I created it:

Hope that helps! Let me know if you have any further queries about this. If it solves your issues, please mark this post as the Solution.

Many thank,
Geoff @ TechLeap

Thank you, that helps :slight_smile:

Actually, now that I tried using it, I kinda have a problem. I tried doing it exactly like the demo but my pause and play icons kinda just disappear after I’ve clicked them once. So I can’t use them several times. I am not sure what I did wrong.

Check out the hover event in the demo. :wink:

Geoff

That part? I have that in my code too but it doesn’t work.

If you can make your CoSpace remixable, and share here, I can take a look.

Geoff @ TechLeap

i have quite a few videos in there, the one i tried using the code on is that one right there:

This is the link to the room:

Great CoSpace! The main issue is that the play/pause icons are attached (children of the wall) - for some reason (which I’m still figuring out), it causes issues (possibly because of position being local for attached objects, rather than global). There was also a minor code issue with the pause icon being moved in Line 29. Here’s my fixes:

Hope that helps!

Geoff @ TechLeap

1 Like

Ok, here’s why having the Play/Pause icons as children of the wall cause issues: as mentioned above, it’s because when you attach or add a child to an object, the position of the child object becomes local, ie, it’s position in relation to its parent. The set position CoBlock sets the global position of an object, ie, the position of the object within the Scene.

This is why the play/pause icons were disappearing - the global position was being set, using the local position of the icons.

An alternative would be to use the move object x metres forward/back/up/down in x seconds CoBlock, which works even if the icons are attached.

Hope that helps! Let me know if you have any further questions about this.

Geoff @ TechLeap

1 Like

UPDATE: this is wrong - it’s the opposite! The position of object CoBlock returns only the global position of the object - even if the object is a child; the set position CoBlock will set the position based on whether the object is a child (in which case it sets the position as local), or not (sets the position as global).

Phew! That took a wee bit of detective work!

Geoff

1 Like

Thank you very much for your help, it works now :slight_smile:

2 Likes