RageAgainstThePixel / com.rest.elevenlabs

A non-official Eleven Labs voice synthesis client for Unity (UPM)
https://elevenlabs.io/?from=partnerbrown9849
MIT License
74 stars 9 forks source link

ElevenLabs download audio in WebGL Build #48

Open SebastianBlandon opened 9 months ago

SebastianBlandon commented 9 months ago

Bug Report

Overview

I have a problem with downloading from ElevenLabs of the audios in a WebGl build of my application, follow the browser logs is by CORS, that I can not load the audios and failure to download with Utilities.WebRequestRest. Has anyone encountered this error?

Screenshots

Screenshot 2023-11-22 at 11 00 56 AM
StephenHodgson commented 9 months ago

Please replace screenshot with error text. I can't read it.

SebastianBlandon commented 9 months ago

List errors:

Cross origin requests are only supported for HTTP.
Fetch API cannot load file:///tmp/download_cache/ElevenLabs/TextToSpeech/onwK4e9ZLuTAKqWW03F9/cF3SDAlKxqH9JJIxDtRe.ogg due to access control checks.
Utilities.WebRequestRest.RestException: Failed to download audio clip from "file:///tmp/download_cache/ElevenLabs/TextToSpeech/onwK4e9ZLuTAKqWW03F9/cF3SDAlKxqH9JJIxDtRe.ogg"!
  at Utilities.WebRequestRest.Rest.DownloadAudioClipAsync (System.String url, UnityEngine.AudioType audioType, System.String fileName, Utilities.WebRequestRest.RestParameters parameters, System.Threading.CancellationToken cancellationToken) [0x00000] in <00000000000000000000000000000000>:0
StephenHodgson commented 9 months ago

I think there is an additional step you must to to enable CORS for your webgl build.

But also, I think the download cache works differently on WebGL since there isn't access to local disk.

SebastianBlandon commented 9 months ago

I'm looking for documentation on this but I can't find anything that works for me, do you have any idea if this is set in the player configuration?

StephenHodgson commented 9 months ago

I think it might actually be a bug with my com.utilities.rest library.

I'll do some validations and get back to you.

StephenHodgson commented 8 months ago

Yeah for now this package does not support WebGL.

There's too many places where I'm attempting to cache them and save them to disk.