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 here. 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();
type PlayerOptions = {
htmlAnchor?: HTMLElement,
onSceneChange?: () => Promise<void>,
onRuleTriggered?: () => Promise<void>,
onViewerStateChange?: () => Promise<void>,
};
- 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.
This JSON structure can be easily created using our open source library on GitHub. Feel free to fork it!
There's also a codesandbox that showcases the absolute power of creating Metaverse Apps using the GMetri Plugin API
React App
Codesandbox for GMetri SDK
Last modified 1yr ago