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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -