AudioModule

When the user interacts with the 3D objects, we will play sounds based on whether the object can be collected or not, and also whether the game has been completed. The AudioModule in Native Modules allows adding sound to the VR world as background environmental audio, one-off sound effects, and spatialized audio. In our game, we will use environmental audio and one-off sound effects. 

  • Environmental audio: To play an audio on loop and set the mood when the game is successfully completed, we will use the playEnvironmental method that takes an audio file path as the source and loop option as a playback parameter:
AudioModule.playEnvironmental({    source: asset('happy-bot.mp3'),    loop: true})
  • Sound effects: To play a single sound ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.