githubEdit

GMetri Player

The GMetri Player is a full-fledged Metaverse application that can run experiences created using the GMetri editor.

The latest javascript file is hosted herearrow-up-right. We recommend you to not self-host this file to receive latest updates from us.

There are 2 simple steps to get GMetri Player running on your website.

  • Drop the below script in the <head> section of your web-page

<script type="application/javascript" 
src="https://s.vrgmetri.com/gm-gb-test/gmetri-player/local/web/player.bundle.js">
</script>
  • Initialize the Player API by passing the JSON and options

// usage 
const player = gmetri.player.load({
  json: {}, 
  options: { 
    htmlAnchor: document.body, 
    onSceneChange: () => {}, 
    onRuleTriggered: () => {}, 
    onViewerStateChange: () => {}, 
  } 
}).play();

Player Options

  1. htmlAnchor - Reference to the HTML element you want the player to attach to

  2. onSceneChange - Optional callback, fired whenever a scene is changed inside the experience

  3. onRuleTriggered - Optional callback, fired whenever a rule is triggered

  4. onViewerStateChange - Optional callback, fired whenever the variables' state changes.

Project JSON

The Player API accepts a recursive tree structurearrow-up-right - codenamed rJson.

This JSON structure can be easily created using our open source libraryarrow-up-right on GitHub. Feel free to fork it!

To get started on understanding JSON structure, look at the sample jsons added in the github repo herearrow-up-right. rJson library also exports all the helper functions that you can use to create rJson structures. Have a look at the usage herearrow-up-right

There's also a codesandbox that showcases the absolute power of creating Metaverse Apps using the GMetri Plugin API

Codesandbox for GMetri SDK

Last updated

Was this helpful?