How to use @aws-amplify/xr - 10 common examples

To help you get started, we’ve selected a few @aws-amplify/xr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-js / packages / amplify-ui-components / src / components / amplify-scene / amplify-scene.tsx View on Github external
render() {
    let muteButton;
    let enterOrExitVRButton;
    let screenSizeButton;

    if (XR.isSceneLoaded(this.sceneName)) {
      if (this.showEnableAudio) {
        muteButton = (
           this.setMuted(false)}
            autoShowTooltip
          />
        );
      } else if (XR.isMuted(this.sceneName)) {
        muteButton =  this.setMuted(false)} />;
      } else {
        muteButton =  this.setMuted(true)} />;
      }

      if (XR.isVRCapable(this.sceneName)) {
        if (this.isVRPresentationActive) {
          // logger.info('VR Presentation Active');
          enterOrExitVRButton = (
             this.toggleVRPresentation()} />
          );
        } else {
          // logger.info('VR Presentation Inactive');
          enterOrExitVRButton = (
             this.toggleVRPresentation()} />
          );
github aws-amplify / amplify-js / packages / amplify-ui-components / src / components / amplify-scene / amplify-scene.tsx View on Github external
toggleVRPresentation() {
    try {
      if (this.isVRPresentationActive) {
        XR.exitVR(this.sceneName);
      } else {
        XR.enterVR(this.sceneName);
      }
    } catch (e) {
      // logger.error('Unable to start/stop WebVR System: ' + e.message);
      return;
    }
    this.isVRPresentationActive = !this.isVRPresentationActive;
  }
github aws-amplify / amplify-js / packages / amplify-ui-components / src / components / amplify-scene / amplify-scene.tsx View on Github external
toggleVRPresentation() {
    try {
      if (this.isVRPresentationActive) {
        XR.exitVR(this.sceneName);
      } else {
        XR.enterVR(this.sceneName);
      }
    } catch (e) {
      // logger.error('Unable to start/stop WebVR System: ' + e.message);
      return;
    }
    this.isVRPresentationActive = !this.isVRPresentationActive;
  }
github aws-amplify / amplify-js / packages / amplify-ui-components / src / components / amplify-scene / amplify-scene.tsx View on Github external
if (this.showEnableAudio) {
        muteButton = (
           this.setMuted(false)}
            autoShowTooltip
          />
        );
      } else if (XR.isMuted(this.sceneName)) {
        muteButton =  this.setMuted(false)} />;
      } else {
        muteButton =  this.setMuted(true)} />;
      }

      if (XR.isVRCapable(this.sceneName)) {
        if (this.isVRPresentationActive) {
          // logger.info('VR Presentation Active');
          enterOrExitVRButton = (
             this.toggleVRPresentation()} />
          );
        } else {
          // logger.info('VR Presentation Inactive');
          enterOrExitVRButton = (
             this.toggleVRPresentation()} />
          );
        }
      }

      if (this.isFullscreen) {
        screenSizeButton = (
           this.minimize()} />
github aws-amplify / amplify-js / packages / aws-amplify-react / src / XR / SumerianScene.jsx View on Github external
error: e
      }
      logger.error(sceneError.displayText, sceneError.error);
      this.setStateAsync({sceneError});
      return;
    }
    
    XR.start(sceneName);

    this.setStateAsync({ 
      muted: XR.isMuted(sceneName),
      isVRPresentationActive: XR.isVRPresentationActive(sceneName),
      loading: false
    });

    XR.onSceneEvent(sceneName, 'AudioEnabled', () => this.setStateAsync({showEnableAudio: false}));
    XR.onSceneEvent(sceneName, 'AudioDisabled', () => this.setStateAsync({showEnableAudio: true}));
  }
github aws-amplify / amplify-js / packages / amplify-ui-components / src / components / amplify-scene / amplify-scene.tsx View on Github external
await XR.loadScene(sceneName, sceneDomId, sceneOptions);
    } catch (e) {
      this.sceneError = {
        displayText: 'Failed to load scene',
        error: e,
      };
      return;
    }

    XR.start(sceneName);

    this.muted = XR.isMuted(sceneName);
    this.isVRPresentationActive = XR.isVRPresentationActive(sceneName);
    this.loading = false;

    XR.onSceneEvent(sceneName, 'AudioEnabled', () => (this.showEnableAudio = false));
    XR.onSceneEvent(sceneName, 'AudioDisabled', () => (this.showEnableAudio = true));
  }
github aws-amplify / amplify-js / packages / aws-amplify-react / src / XR / SumerianScene.tsx View on Github external
}
      logger.error(sceneError.displayText, sceneError.error);
      this.setStateAsync({sceneError});
      return;
    }
    
    XR.start(sceneName);

    this.setStateAsync({ 
      muted: XR.isMuted(sceneName),
      isVRPresentationActive: XR.isVRPresentationActive(sceneName),
      loading: false
    });

    XR.onSceneEvent(sceneName, 'AudioEnabled', () => this.setStateAsync({showEnableAudio: false}));
    XR.onSceneEvent(sceneName, 'AudioDisabled', () => this.setStateAsync({showEnableAudio: true}));
  }
github aws-amplify / amplify-js / packages / aws-amplify-react / src / XR / SumerianScene.tsx View on Github external
error: e
      }
      logger.error(sceneError.displayText, sceneError.error);
      this.setStateAsync({sceneError});
      return;
    }
    
    XR.start(sceneName);

    this.setStateAsync({ 
      muted: XR.isMuted(sceneName),
      isVRPresentationActive: XR.isVRPresentationActive(sceneName),
      loading: false
    });

    XR.onSceneEvent(sceneName, 'AudioEnabled', () => this.setStateAsync({showEnableAudio: false}));
    XR.onSceneEvent(sceneName, 'AudioDisabled', () => this.setStateAsync({showEnableAudio: true}));
  }
github aws-amplify / amplify-js / packages / aws-amplify-react / src / XR / SumerianScene.jsx View on Github external
}
      logger.error(sceneError.displayText, sceneError.error);
      this.setStateAsync({sceneError});
      return;
    }
    
    XR.start(sceneName);

    this.setStateAsync({ 
      muted: XR.isMuted(sceneName),
      isVRPresentationActive: XR.isVRPresentationActive(sceneName),
      loading: false
    });

    XR.onSceneEvent(sceneName, 'AudioEnabled', () => this.setStateAsync({showEnableAudio: false}));
    XR.onSceneEvent(sceneName, 'AudioDisabled', () => this.setStateAsync({showEnableAudio: true}));
  }
github aws-amplify / amplify-js / packages / amplify-ui-components / src / components / amplify-scene / amplify-scene.tsx View on Github external
} catch (e) {
      this.sceneError = {
        displayText: 'Failed to load scene',
        error: e,
      };
      return;
    }

    XR.start(sceneName);

    this.muted = XR.isMuted(sceneName);
    this.isVRPresentationActive = XR.isVRPresentationActive(sceneName);
    this.loading = false;

    XR.onSceneEvent(sceneName, 'AudioEnabled', () => (this.showEnableAudio = false));
    XR.onSceneEvent(sceneName, 'AudioDisabled', () => (this.showEnableAudio = true));
  }