Search Unity

Question Audio is not behaving as 3d in WebGL

Discussion in 'Audio & Video' started by yupi666, Jul 12, 2020.

  1. yupi666

    yupi666

    Joined:
    Jun 6, 2020
    Posts:
    1
    Working in 2019.4.3f1

    The sound of a video works perfectly on play mode using a url method, but when exported to webgl it looses all 3d aspects and is played all over the scene, I reviewed the documentation and I don't think there are any unsupported settings. I's this usual? is there a checklist I should be following? I looked around but it doesn't seem there are others with the problem
     
    Last edited: Jul 12, 2020
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    This isn't well documented, but in the WebGL implementation, the VideoPlayer's audio output goes directly to the output device without going through the normal audio processing that Unity offers. This is a limitation of the html5 video object used for implementing video playback on this platform. You can see a note about this in here: https://docs.unity3d.com/ScriptReference/Video.VideoPlayer-audioOutputMode.html

    So in this instance, it seems you'd have to approximate distance-based attenuation yourself, and apply the volume change directly on the VideoPlayer using VideoPlayer.SetDirectAudioVolume().

    Hope this helps,

    Dominique Leroux
    A/V developer at Unity
     
    lportuguez likes this.