Setup API functions

Accessing Polyte-Player Functions:

In order to call functions inside the player, the 'polyte-player' HTML element must be obtained in order to then trigger the API functions in it.

Get the element with the querySelector () and then call the functions in it e.g. .setCamera ();

Add the following function scripts to your HTML page:

<script>
  function setCamera(val) {
    var player = document.querySelector("polyte-player");
    player.setCamera(val);
  }  
  function setVariant(valArray) {
    var player = document.querySelector("polyte-player");
    player.setVariant(valArray);
  }
  function playAnimation(val) {
    var player = document.querySelector("polyte-player");
    player.playAnimation(val);
  }
</script>

The value you pass to the .setCamera(val) function is the name of the camera as it was created in the editor.

The .setVariant(valArray)function you pass an array with the names of the variant options as they are named in the editor.