Back to the Shapespark home page

Video texture - not looping

Is it possible to set a video texture not to loop? I’m using the new video control extension to trigger play, but I would like video to stop and reset to the top when it is done.

1 Like

The extension doesn’t have such option. You can disable looping with a body-end.html code like this (replace ‘YOUR-MATERIAL-NAME’ with the name of the material in your scene that has a video):

<script>

(function() {
  var viewer = WALK.getViewer();
  function sceneReadyToDisplay() {
    viewer.findMaterial('YOUR-MATERIAL-NAME').baseColorTexture.video.loop = false;
  }
  viewer.onSceneReadyToDisplay(sceneReadyToDisplay);
}());

</script>

After the video stops playing, the trigger will need to be clicked twice to start it again (the extension doesn’t recognize that the video is not playing, so the first click will pause it, the second will play again).

Is the same procedure usable with a soundfile? It is pretty stressful (And does not make any sense) to hear a soundfile over and over, when it is once activated. Nobody ever realized that he has to click it again, to stop the sound from playing again and again. It would be much better if this feature has no loop at all. To loop a sound maybe only makes sense, when it is a background music.

This procedure won’t work with sound file, because unlike video sound is not attached to any material in the scene. The Audio extension would need to be extended to allow to disable looping.

We’ve extended the Video Texture Control and Audio extensions, so that audio/video looping is configurable. This feature will be included in the next release.

1 Like