Created
May 11, 2017 18:25
-
-
Save tsraveling/ac0c9a2be6daceb05d0a05c2404fc39b to your computer and use it in GitHub Desktop.
Play sound through speakers
This file contains hidden or 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
| // Play sound through speakers | |
| do { | |
| try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord) | |
| } catch _ { | |
| } | |
| do { | |
| try AVAudioSession.sharedInstance().setActive(true) | |
| } catch _ { | |
| } | |
| do { | |
| try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSessionPortOverride.speaker) | |
| } catch _ { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment