Move onto new scene if video is not playing

I have made a scene that has a video which is set to not autoplay.

What I would like is that if the video is not playing after a given time the scene moves onto the next scene

Any suggestions would be welcome

thanks

nigel

Hi,

This is very easy.

Give your video a id using the identity inspector.

For example : video1

Add a timeline action at the given time you want to check if the video is playing.

For example 5 seconds as in this example.

Set the action to run a Javascript function ( you may need to set it to new function)

In the function we will get the video element. and check if it is paused. Which seems to be the state when the page first loads and the video does not auto play.

If the video is paused then we go to the named scene.

var theVid = document.getElementById('video1');

if (theVid.paused) {

hypeDocument.showSceneNamed('scene 2', hypeDocument.kSceneTransitionCrossfade, 1.1)
}

ta da…

2 Likes

I have followed your instructions but cannot get it working, this i put down to being thick.

i have attached the hype project, can you tell me what I am doing wrong

phonetest copy.zip (1.8 MB)

You did a copy and paste.

And in doing so you pasted a lower case 'scene 2' instead of typing what you are using which is a 'Scene 2'
:wink:

Thank you very much it works great
nigel