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
// this log is from the run after recompiling by simply clicking the "play" button on xcode | |
--- playAction | |
AVAudioSession Category Playback OK | |
AVAudioSession is inactive | |
AVAudioSession is Active | |
--- audioPlayerBeginInterruption | |
audioPlayer.playing false | |
AVAudioSession is inactive | |
AVAudioSession is inactive |
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
// does NOT resume play at all | |
// what's different = no .MixWithOthers at all | |
/* console output: | |
AVAudioSession Category Playback OK | |
AVAudioSession is Active | |
handleInterruption | |
began | |
audioPlayer.playing false | |
AVAudioSession is inactive |
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
// does NOT resume play at all | |
// what's different = .MixWithOthers set with AVAudioSessionCategoryPlayback | |
/* console output: | |
AVAudioSession Category Playback OK | |
AVAudioSession is Active | |
handleInterruption | |
began | |
audioPlayer.playing false | |
AVAudioSession is inactive |
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
// does NOT resume play at all | |
// what's different = .MixWithOthers not set with theSession | |
/* console output: | |
AVAudioSession Category Playback OK | |
AVAudioSession is Active | |
handleInterruption | |
began | |
audioPlayer.playing false | |
AVAudioSession is inactive |
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
// this version resumes play the first time alarm interrupts but the second time will not resume play - sometimes it does not resume play even once | |
// what's different = using theSession for all the AVAudioSession.sharedInstance() calls | |
/* console output: | |
AVAudioSession Category Playback OK | |
AVAudioSession is Active | |
handleInterruption | |
began | |
audioPlayer.playing false | |
AVAudioSession is inactive |
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
// this version DOES resume play properly multiple times | |
// what's different = theSession is used only for setting up .MixWithOthers independently of the AVAudioSession.sharedInstance() used to set up background play (I'm afraid I am unable to explain why this works) | |
/* console output: | |
AVAudioSession Category Playback OK | |
AVAudioSession is Active | |
handleInterruption | |
began | |
audioPlayer.playing false | |
handleInterruption |
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
import UIKit | |
import AVFoundation | |
class ViewController: UIViewController { | |
var player = AVAudioPlayer() | |
let audioPath = NSBundle.mainBundle().pathForResource("rachmaninov-romance-sixhands-alianello", ofType: "mp3")! | |
/* |