Last active
November 27, 2019 18:08
-
-
Save digitallysavvy/53d784c3bbedeff50caed92c3c819f4a to your computer and use it in GitHub Desktop.
Snippet to toggle the user's microphone within ARSupportBroadcasterViewController and ARSupportAudienceViewController
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
@IBAction func toggleMic() { | |
guard let activeMicImg = UIImage(named: "mic") else { return } | |
guard let disabledMicImg = UIImage(named: "mute") else { return } | |
if self.micBtn.imageView?.image == activeMicImg { | |
self.agoraKit.muteLocalAudioStream(true) // Disable Mic using Agora Engine | |
self.micBtn.setImage(disabledMicImg, for: .normal) | |
if debug { | |
print("disable active mic") | |
} | |
} else { | |
self.agoraKit.muteLocalAudioStream(false) // Enable Mic using Agora Engine | |
self.micBtn.setImage(activeMicImg, for: .normal) | |
if debug { | |
print("enable mic") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment