[REQUEST] Unity WebGL Support for Photon Voice

edited July 2022 in Photon Voice

Hello! I'd like to voice my request for Unity WebGL support for Photon Voice.

Support for WebGL is very technically possible (by creating a WebRTC mode), it is well worth adding, and the Photon stack is incomplete without this. There is an increase in users building for WebGL, using PUN and Fusion to make highly accessible multiplayer "metaverse" experiences (among other things), but Photon still has no voice support.

In order to get voice for my application, I must rely on using other companies' voice solutions and hooking them into PUN or Fusion, which is not ideal (most of these other solutions don't even have spatial audio support as they are most often used for Zoom-style video call apps). A WebRTC mode that supports WebGL would be extremely worthwhile to add.


  • vadim


    Poor audio support for WebGL is a Unity problem first of all.

    We are working on an alternative but there is no ETA yet.

    Even if we implement WebGL audio capture and output, they won't be better than 3rd party solutions focused on audio. For instance, we do not provide spatial audio for other platforms but rely on Unity's AudioSource (which is not well suited for streaming in WebGL due to API limitations). Please do not expect us to implement 3d audio engine in WebGL. The best we can do is Zoom-style 2d output.

    Photon Voice is focused on data streaming and easy integration with 3rd party audio solutions. We provide platform-specific audio modules for convenience only.

    While the use of WebRTC is theoretically possible, we are not looking at it yet because its integration does not fit with the current Voice architecture.

  • REM5_Studios

    Hi @vadim, thank you for your response!

    I'm aware there are technical challenges involved with audio when working with the WebGL platform, however the point of my post is to voice that it is certainly possible to do it and that it would be worth it for Photon to work through these challenges in order to have a complete product for WebGL users who are disappointed to find out that Photon Voice isn't supported.

    Although audio support inside Unity is challenging for WebGL, it should be possible to support full-spatial audio in WebGL by handling the audio on the javascript layer (outside of Unity), which can communicate with the Unity layer (https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html) to receive positions of voice audio sources & the audio listener and calculate spatial audio, which is essentially just a volume/gain and pan calculation. If interested, here is some example code for calculating spatial audio via pan and gain (scroll down to the "Update Spatial Audio" section): https://www.agora.io/en/blog/implementing-spatial-audio-chat-in-unity-using-agora/ Perhaps there's a better way to do it than I've mentioned, but all of this is just to say that it is possible to do it even though the architecture is different.

    Completely backing up from the technical stuff - If Photon's mission is to be a turnkey multiplayer solution for Unity ("we make multiplayer simple"), then from an end user perspective it totally makes sense for Photon Voice to support WebGL out of the box (as this is what Photon's users expect). Would you agree? If Photon does not have the in-house capabilities or resources to do this, then maybe Photon could partner with a 3rd party to either implement WebGL support within Photon Voice, or point to a fully-working voice integration by a 3rd party. Right now if a WebGL user lands on Photon's site, it's pretty unclear how they should go about implementing voice.

    I just wanted to voice my request for this, as it it's a feature that people want and have been asking about for a long time. :)

  • Hi @REM5_Studios

    I'm reading your post about audio chat in unity using the agora, but I'm not sure this agora solution supports the WebGL audio chat.

    Also, do you have another solution for solving audio chat in webGL? Thanks!

  • Brothers

    There is update in photon voice 2 here today


    Have anyone try this yet?

  • REM5_Studios
    edited February 2023

    Agora supports WebGL via their beta Unity WebGL plugin: https://github.com/AgoraIO-Community/Agora_Unity_WebGL

    Very glad to see that Photon has been working on WebGL support!! :)

    Also, apologies for my double-post above. On my end it appeared that my post did not go through, so I re-wrote it a 2nd time. Then, the 1st post appeared. Strange.

  • Tobias

    No worries about the double posts. It happens sometimes (no idea why).

    Hope you don't mind, I deleted the duplicate.

  • Thanks @Tobias!