Search Unity

How to integrate an existing java script library into the project file?

Discussion in 'Web' started by Wils, Jul 13, 2018.

  1. Wils

    Wils

    Joined:
    Dec 4, 2012
    Posts:
    6
    I need to record audio in WebGL, but since Unity WebGL doesn't support that, my solution was to use an external js library (p5 sound lib) and use ExternalCall() to do what I need to do.
    But now due to the SLS Content Security Policy, I cannot use Application.ExternalCall(), I have to use .jslib.
    So I am thinking about creating a WebGL .jslib plugin to call the external p5 JS sound library. Do I have to make the p5 sound library a WebGL .jslib plugin as well?

    If so, I am a bit confused on how to do it with .jslib. Do I have to change millions of line of code into the appropriate syntax as show in
    https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

    Is there other ways to allow me to use the functions in that library without so much hassle?