In this guide, we will build a Web application using the Spatial Audio API that has the following properties:
To accomplish these goals, we will make use of Express, a popular, fast, minimal Web framework for NodeJS. Developers use it to create dynamic Web applications, where the content of each page depends on variables such as a user's login status.
Here, you will learn how to:
To authenticate our Express App with your Space, you'll first need to create an App and a Space. To do that:
Do not share the data you see on this page. It allows users to make authorized connections to your High Fidelity Spatial Audio Server.
To complete this guide, you will need to install the following software on your computer:
Next, let's create a skeleton version of a NodeJS project we'll use for development:
Create a new folder on your local disk that you'll use for development, such as
npm initto initialize a new NodeJS project, inputting data as prompted. The data you input isn't important for the purposes of this guide.
Now, let's install all of the NodeJS dependencies used for this Express Web App project. We'll make use of these dependencies in the next steps.
npm i expressand pressing enter.
npm i ejsand pressing enter.
npm install jose
joseis a package used to create JWTs using NodeJS.
Now that you have your development environment set up, you can download a
.zip file containing this project's code by clicking here.
Extract the files within to your development directory. Your development directory should now contain the following files:
index.js and fill in your
APP_SECRET. You gained access to this information in the "Create an App and Space" step above. For reference, you can find these pieces of information in the High Fidelity Audio API Developer Console.
Finally, in the PowerShell or Terminal window you've been using, type
node index.js and press enter to execute the code. Visit http://localhost:8080 in multiple browser tabs to use the resulting Web application and explore!
In this guide, you learned how to create a dynamic Web App using the Spatial Audio API, Express, and EJS. You can use this guide's project as a starting point for your own dynamic applications!
For detailed technical information about the High Fidelity Spatial Audio Client API, visit the API documentation.
If you have any questions or comments, please reach out to email@example.com.