How Swift POSTs Voice Binary Data

Asked 2 years ago, Updated 2 years ago, 83 views

I am trying to use Google Speech API for iOS applications using Swift.
Below is a sample input from a local audio file:

 curl-X POST\
--data-binary@audio/good-morning-google.flac\
--header'Content-Type:audio/x-flac;rate=44100;'\
'https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=yourkey'

I don't know how to implement a similar POST with Swift, so could you please let me know?
Specifically,

--data-binary@audio/good-morning-google.flac\

I am not sure where to send the locally saved audio file as binary data specification like .

Please refer to: [Google Speech API]
https://gist.github.com/alotaiba/1730160

swift ios api http

2022-09-30 19:28

1 Answers

Why don't we just put binary data into the HTTPBody of the NSMutableURLRequest?


2022-09-30 19:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.