Skip to content

Instantly share code, notes, and snippets.

@shams-ahmed
Created March 31, 2021 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shams-ahmed/6dada4f04928d00d2d43f42145ba8ec4 to your computer and use it in GitHub Desktop.
Save shams-ahmed/6dada4f04928d00d2d43f42145ba8ec4 to your computer and use it in GitHub Desktop.
Symbl.ai: Recording audio on iOS
let audio = Audio()
let symblAI = SymblAI(with: "enter_token_here")
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Stop audio recording if it has been started
if audio.isRunning {
do {
let sound = try audio.stop()
// recording is not active
} catch {
print(error)
}
}
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// Start audio recording
do {
try audio.start()
// recording is now active
} catch {
print(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment