This is a demo of spatial audio using LiveKit. Users join a little 2D world, and hear other users' audio in stereo, based on their position and distance relative to you.
This is a Next.js project bootstrapped with create-next-app
.
Clone the repo and install dependencies:
git clone git@github.com:livekit-examples/spatial-audio.git
cd spatial-audio
npm install
Create a new LiveKit project at http://cloud.livekit.io. Then create a new key in your project settings.
Create a new file at spatial-audio/.env.development
and add your new API key and secret as well as your project's WebSocket URL (found at the top of http://cloud.livekit.io):
LIVEKIT_API_KEY=<your api key>
LIVEKIT_API_SECRET=<your api secret>
LIVEKIT_WS_URL=wss://<your-project>.livekit.cloud
(Note: this file is in .gitignore
. Never commit your API secret to git.)
Then run the development server:
npm run dev
You can test it by opening http://localhost:3000 in a browser.
This project is a Next.js app. Refer to the Next.js deployment documentation for production deployment.