ios - AVAudioPlayer Swift simultaneously play two audio -
my question is: use 1 viewcontroller , choice of songs , there lose. how make if clicked on enable next previous audio has stopped. , turns out simultaneously play 2 audio recordings , new , previous. me code:
var audio = avaudioplayer()
func playdownload(previewurl: string) {
if let url = localfilepathforurl(previewurl) { let playeritem = avplayeritem(url: url) { audio = try avaudioplayer(contentsofurl: url) try avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryplayback) try avaudiosession.sharedinstance().setactive(true) audio.delegate = self audio.preparetoplay() audio.play() } catch { print(error) } } }
Comments
Post a Comment