Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Loading assets

In order to load any static asset files such as image or audio files in the code, we can utilize the asset method in React 360. This asset() functionality in React 360 allows us to retrieve external resource files, including audio and image files.

For example, we will place the sound audio files for the game in the static_assets folder, to be retrieved using asset() for each audio added to the game, as shown in the following code:

AudioModule.playOneShot({    source: asset('collect.mp3'),})

This will load the audio file to be played in the call to playOneShot.

With these different APIs and modules available in React 360, we will integrate different features for the VR game such as setting the background scene, playing audio, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content