Context
Hello,
I am a newbie on wix velo and I am not developper.
I want to generate Audios from Members Texts Input in my website, and save them in Wix Media Storage. I am using wix-fetch and the API of ElevenLabs to convert a Text to Audio.
Once the fetch done, the audio response is used to generated an audio URL with : const audioUrl = URL.createObjectURL(audioBlob).
The URL get has the format below :
blob:https://1855222d-0439-435f-b2d4-1312f608e836.dev.wix-code.com/d7cbb813-3265-4d80-95db-23e0d5f3f977
Problem
The URL get is send to the source of an audio player $w(“#audioPlayer1”).src = audioUrl but during the preview, the Audio Player doesn’t work and doesn’t play the audio in the Url.
I can open the Url in another Tab of Chrome, play the audio and download it.
However, I can’t play it directly in Wix, Save or Import the audio directly in Wix Media storage using this URL.
Futhermore, I am not able to open this URL in another browser than Chrome (I am working with Chrome), and no one with who the URL is shared is able to open it.
Question
Is it possible to get an useful URL which can allow the audio to be directly play with Wix Audio Player, and save/import in the Wix Media storage ?
I am open to any solution to allow me to import the audio response in my Wix Media Storage (With or without an URL).
Product:
Wix Studio Editor
Related Code
try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'xi-api-key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: "This is an API test 1 2 3 4",
model_id: "eleven_multilingual_v2"
})
});
if (response.ok) {
const responseClone = response.clone();
const responseText = await response.text();
console.log("Response body:", responseText);
const audioBlob = await responseClone.blob();
const audioUrl = URL.createObjectURL(audioBlob);
$w("#audioPlayer1").src = audioUrl;
$w("#audioPlayer1").play();
console.log("Audio Url:", audioUrl);
} else {
const errorText = await response.text();
console.error("Error generating audio. Status:", response.status);
console.error("Error details:", errorText);
}