Created
March 31, 2021 20:45
-
-
Save shams-ahmed/6dada4f04928d00d2d43f42145ba8ec4 to your computer and use it in GitHub Desktop.
Symbl.ai: Recording audio on iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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