aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

Audio is not being captured while publishing Sumerian scene with Amplify #6183

Closed tolivestone closed 4 years ago

tolivestone commented 4 years ago

I have implemented hands free solutions(followed steps given in the below link) in Sumerian and privately published via Amplify but it's not capturing audio. I see below error in console

AudioContext.js:36 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

https://docs.sumerian.amazonaws.com/articles/hands-free-voice-transcription/

I raised this before but did not get solution. (https://github.com/aws-amplify/amplify-js/issues/5946)

Config:

const awsmobile = {
    "aws_project_region": "eu-west-1",
    "aws_cognito_identity_pool_id": "eu-west-1:XXXXXXXX",
    "aws_cognito_region": "eu-west-1",
    "oauth": {},
    "XR": {
        "scenes": {
            "hiyacovid": {
                "sceneConfig": {
                    "sceneId": "XXXXXXXX.scene",
                    "region": "eu-west-1",
                    "projectName": XXXXX",
                    "url": "https://sumerian.eu-west-1.amazonaws.com/XXXXX/projects/XXXXX/release/authTokens?sceneId=XXXXXX.scene"
                }
            }
        }
    }
};

React Code

`


new AWS.Polly();

Amplify.configure(Aws_exports);

class App extends Component {

  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      sceneController: null
    };
  }

  sceneLoaded(sceneController) {
    this.setState({
      loading: false,
      sceneController
    });
    XR.enableAudio('XXXXXX');
    XR.setMuted('XXXXX', false);
  }

  render() {
    return (
      <div className="App">
        <div style={{ display: this.state.loading && 'none' }}>
          <SumerianScene scene='XXXXX' onLoaded={(controller) => this.sceneLoaded(controller)} />
        </div>
      </div>
    );
  }
}

export default App;

class SumerianScene extends Component {

  async componentDidMount() {
    await this.loadAndStartScene();
  }

  render() {
    return <div
      id="sumerian-scene-dom-id"
      style={{ width: "100vh", height: "100vh" }}
    />;
  }

  async loadAndStartScene() {
    await XR.loadScene(this.props.scene, "sumerian-scene-dom-id");
    const controller = XR.getSceneController(this.props.scene);
    this.props.onLoaded(controller);
    XR.start(this.props.scene);
  }

}

`

jordanranz commented 4 years ago

Hey @tolivestone,

Sorry my previous response wasn't sufficient. Could you try adding something similar to this line to your constructor, your componentDidMount or inside of your sceneLoaded function. You'd should be able modify it to automatically enable audio like:

sceneLoaded(sceneController) {
    this.setState({
      loading: false,
      sceneController
    });
    XR.onSceneEvent('XXXXXX', 'AudioDisabled', () => XR.enableAudio('XXXXXX'));
    XR.setMuted('XXXXX', false);
  }
stale[bot] commented 4 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.