-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Description
Hello! Can I use SwiftAudioPlayer with ElevenLabs Text to Speech Stream API request?
I understand how to stream audio with GET request acc. to docs:
let url = URL(string: "https://randomwebsite.com/audio.mp3")!
SAPlayer.shared.startRemoteAudio(withRemoteUrl: url)
SAPlayer.shared.play()
But what if I need also to attach payload to POST request like
var request = URLRequest(url: url)
request.httpMethod = "POST"
let payload: [String: Any] = [
"text": "Hello",
"model_id": "eleven_multilingual_v2",
"voice_settings": [
"stability": 0.5,
"similarity_boost": 0.75,
]
]
let jsonData = try? JSONSerialization.data(withJSONObject: payload, options: .fragmentsAllowed)
request.httpBody = jsonData
Response returns audio as an audio stream.
Is it possible somehow?
Metadata
Metadata
Assignees
Labels
No labels