[REQUEST] Unity WebGL Support for Photon Voice

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Voice.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

[REQUEST] Unity WebGL Support for Photon Voice

REM5_Studios
2022-07-26 21:52:14

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.

Comments

vadim
2022-07-27 09:15:53

Hi,

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
2022-07-27 15:42:47

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. :)

michael111
2022-09-30 16:24:08

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
2023-02-07 07:41:53

There is update in photon voice 2 here today

https://assetstore.unity.com/packages/tools/audio/photon-voice-2-130518#releases

Have anyone try this yet?

REM5_Studios
2023-02-09 15:58:50

michael111 2022-09-30T16:24:08+00:00

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!

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

Brothers 2023-02-07T07:41:53+00:00

There is update in photon voice 2 here today

https://assetstore.unity.com/packages/tools/audio/photon-voice-2-130518#releases

Have anyone try this yet?

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
2023-02-13 11:05:04

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

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

REM5_Studios
2023-02-13 15:58:17

Thanks @Tobias!

Back to top