title: How to vanish player controls from lockscreen after the playback has finished in iOS10+?
body: <p>While playing audio in background mode player controls appears on the lockscreen. How to remove it when the audio has stopped? If try to set:</p>
  
  <pre><code>MPNowPlayingInfoCenter.default().nowPlayingInfo = nil
  </code></pre>
  
  <p>player is still on the lockscreen, but the fields artist/song are empty </p>
  
  <p><a href="https://i.stack.imgur.com/PRixc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PRixc.png" alt="enter image description here"></a></p>
  
  <p>UPD (my code for audiosession):</p>
  
  <p>in AppDelegate:</p>
  
  <pre><code>func setupAudioSession() {
  
      let audioSession = AVAudioSession.sharedInstance()
  
      do {
          try audioSession.setCategory(AVAudioSessionCategoryPlayback)
          try audioSession.setActive(true)
  
      } catch {
          print("Setting category to AVAudioSessionCategoryPlayback failed.")
      }
  }
  </code></pre>
  
  <p>in Player class:</p>
  
  <pre><code>private func clearRemotePlayerInfo() { // call after stop button pressed
      try? AVAudioSession.sharedInstance().setActive(false)
      MPNowPlayingInfoCenter.default().nowPlayingInfo = [:]
  }
  </code></pre>