com.rest.elevenlabs icon indicating copy to clipboard operation
com.rest.elevenlabs copied to clipboard

ElevenLabs download audio in WebGL Build

Open SebastianBlandon opened this issue 1 year ago • 6 comments

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

SebastianBlandon avatar Nov 22 '23 16:11 SebastianBlandon

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

StephenHodgson avatar Nov 22 '23 16:11 StephenHodgson

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

SebastianBlandon avatar Nov 22 '23 17:11 SebastianBlandon

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.

StephenHodgson avatar Nov 22 '23 17:11 StephenHodgson

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?

SebastianBlandon avatar Nov 22 '23 19:11 SebastianBlandon

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 avatar Nov 23 '23 14:11 StephenHodgson

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.

StephenHodgson avatar Dec 14 '23 03:12 StephenHodgson