Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateSpeechAsync doesn't work on WebGL builds #134

Closed
foundway opened this issue Nov 30, 2023 · 5 comments
Closed

CreateSpeechAsync doesn't work on WebGL builds #134

foundway opened this issue Nov 30, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@foundway
Copy link

foundway commented Nov 30, 2023

Bug Report

Overview

openAI.AudioEndpoint.CreateSpeechAsync throw the following error:

63fc5e1f-3537-4cd6-b727-3c7cc79dd4f7:10 System.IO.DirectoryNotFoundException: Could not find a part of the path "/tmp/download_cache/Nova-20231130T120608.mp3".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00000] in <00000000000000000000000000000000>:0 
--- End of stack trace from previous location where exception was thrown ---

Likely due to some limitation of WebGL

To Reproduce

Steps to reproduce the behavior:
Call CreateSpeechAsync using something similar to the sample code in README

        try
        {
            var request = new SpeechRequest(text, Model.TTS_1, voice: SpeechVoice.Nova);
            Debug.Log("Asking TTS_1...");
            openAI.AudioEndpoint.EnableDebug = true;
            var (clipPath, clip) = await openAI.AudioEndpoint.CreateSpeechAsync(request, lifetimeCancellationTokenSource.Token);
            audioSource.clip = clip;
            audioSource.Play();
        }
        catch (Exception e)
        {
            Debug.LogError(e);
        }

Expected behavior

I should get an audioClip and its path in return as worked in editor and other platforms

Screenshots

Screenshot 2023-11-29 at 4 14 08 PM

Additional context

@foundway foundway added the bug Something isn't working label Nov 30, 2023
@StephenHodgson
Copy link
Member

Are you running this in local host?

@StephenHodgson
Copy link
Member

StephenHodgson commented Nov 30, 2023

Due to CORS policy of local storage in local WebGL builds you will get the generated clip however it will not be downloaded using UnityWebRequest until you run it out of localhost, on a server.

@foundway
Copy link
Author

I am hosting on GitHub Page:
https://foundway.github.io/WhisperWebGL/TTS/

@StephenHodgson
Copy link
Member

Okay, likely related to RageAgainstThePixel/com.utilities.rest#51

@RageAgainstThePixel RageAgainstThePixel locked and limited conversation to collaborators Nov 30, 2023
@StephenHodgson StephenHodgson self-assigned this Nov 30, 2023
@StephenHodgson
Copy link
Member

Duplicate of #130

@StephenHodgson StephenHodgson marked this as a duplicate of #130 Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants