Start embedded Video from beginning

I have build a Tumult-Html-5 project with a number of fullsreen videos and a menuesite with links to this videos. The menue ist one scene and every video is another single scene with the video embedded fullscreen (1920x1080) in the scene. Works fine and video jumps back to menue-scene by using the timeline-action "jump to scene menue" after fully played.

If i interrupt playing the video with the "back-to-menue-button" that jumps to the menuesite and go back to the same videoscene, the video continues to play at the point of leaving the video. I would prefer to start the video from beginning. I have tried some tumult-commands and some javascript to achieve this. Without success.

Would anybody know a solution. Thanks.

You're welcome to post a zip of your .hype document to see what you're doing. I think generally the videos do reset their time based on scene changes.

To force it though, you can:

  1. Give the hype video element a Unique Element ID in the Identity Inspector (let's say it is myVideo)
  2. Add an On Scene Load handler in the Scene Inspector to Run JavaScript… with this code:
    try {
        hypeDocument.getElementById("myVideo").currentTime = 0;
    } catch(error) { }
    
    (of course you'd need to replace myVideo with a different ID if you did named it differently)

Thank you jonathan,

works nearly perfect, there is only one more second of showung the old videostoppoint before the script starts the video from zero. Is there any solution. I try to upload a project-zip to this repyl.

Download projectscript: http://benediktfeser.de/Touchapp.hype.zip

18 MB

You can change the function to run On Scene Unload instead, and this will do what you want.

(P.S. to future self -- it looks like this isn't a problem in Safari, only chrome/firefox)

A post was split to a new topic: Changing a timeline when a video is completed

Thank you Jonathan, works perfect,
I dont know, if i should start a new topic, but there is one detail more i couldn´t find the perfect solution. Some videofiles embedded in the scene run about 3 minutes. At the end of the video i set the timeline-command "back to scene menue". This works nearly perfect, but in some case the video jumps to menue before the video it is completly finished. Is there another command or script, that forces the video to play once in full length an then jump back to menu-scene.Screenshot.jpg.zip (162.3 KB)

The video kinda runs on its own, and isn't synchronized to a timeline, which may run at a different rate (for a variety of reasons, timing in videos is just a hard problem).

HTML5 videos have an 'ended' event. You can use a little bit of JavaScript to handle this. The basic solution is here: