Summary

The microphone feature in Unreal Engine's Pixel Streaming passes the microphone input audio from the stream into Unreal Engine. The audio stream is not directly exposed inside the engine, so any custom routing of the incoming audio stream will require additional modifications by the user beyond what is covered in this guide.

How are we going to do this?

  • Enable the microphone in the web client
  • Modify the Unreal Engine game to recieve incoming audio

Access Microphone via Web Client

It is possible to connect to the user's microphone in browser with our web client template. By doing so, the microphone audio will be sent to game as part of the webRTC stream.

To access the microphone in your streaming session simply add the useMic parameter to the end of your URL and set it to true.

https://customWebClientLink?useMic=true

Alternatively, you could enable the microphone in the client.json file.

"useMic":true

When loading your deployed web client for the first time, the browser will ask for permission to use the microphone on this page. You need to allow access to complete the rest of instructions below.

Receive incoming audio in Unreal Engine

Once the microphone has been enabled, audio from the user's browser will now be sent to the game through the streamer's PixelStreamingInputComponent; which is not enabled in the game by default.

After installing the PureWeb plugin, you’ll need to add the Pixel Streaming Audio component to your scene.

  • Select the PureWebActor you added to your scene during preparation
  • Click the Add button, in the Details panel
  • Type Pixel Streaming Audio in the search, then click it to add the component to the PureWebActor

The component's default settings will listen to the first peer it can hear.

Testing Microphone Input

After configuring your game to receive incoming microphone audio, package it and upload it to your PureWeb console account.

When you launch a stream from your custom web client, you should now be able to hear the microphone audio from the browser in the streaming game.

Next Steps

Feel free to adjust the settings to specify a source to listen to, or mix the incoming audio as you see fit for your streaming experience.

Additional audio routing is beyond the scope of this example. For more information about UE's pixel streaming audio component click here.