INNER CODE UNIT · Swift

play

rxlabz/audioplayer · audioplayer/ios/Classes/SwiftAudioplayerPlugin.swift:68

    func play(url: String!, isLocal: Bool) {
        //Bigining of Edit
        do {
            try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, options: AVAudioSession.CategoryOptions.defaultToSpeaker)
                   NSLog("Playback OK")
                   try AVAudioSession.sharedInstance().setActive(true)
                   NSLog("Session is Active")
               } catch {
                   NSLog("ERROR: CANNOT PLAY MUSIC IN BACKGROUND. Message from code: \"\(error)\"")
               }
        //End of Edit
        if url != lastUrl {
            playerItem?.removeObserver(self, forKeyPath: #keyPath(player.currentItem.status))

            for ob in observers {
                NotificationCenter.default.removeObserver(ob)
            }
            observers.removeAll()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…