title: AVPlayer Lock Screen Controls
body: <p>I have an app that plays audio on the background using AVPlayer. I use MPNowPlayingInfoCenter to display the song's metadata on the Lock Screen and Control Center. Everything works fine except for one thing.</p>
  
  <p>The remote controls on the Lock Screen and Control Center are those of a podcast app. They don't have forward and previous buttons.</p>
  
  <p>I have a screenshot of how the controls are: </p>
  
  <p><a href="https://i.stack.imgur.com/65thq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/65thq.png" alt="enter image description here"></a></p>
  
  <p>As you can see, I don't have forward and previous buttons.</p>
  
  <pre><code> override func viewDidLoad() {
      super.viewDidLoad()
  
      do {
          try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
          UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
      } catch {
          print(error)
      }
  }
  
  @IBAction func play(sender: AnyObject) {
  
      if isURLAvailable == false {
          return
      }
  
      if (player!.rate != 0 &amp;&amp; player!.error == nil) {
          player!.pause()
      } else {
          player!.play()
      }
          updateImage()
  }
  
  func playSong(song: Song) {
  
      let documentsDirectoryURL =  NSFileManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first as NSURL?
      let url: NSURL? = documentsDirectoryURL?.URLByAppendingPathComponent(song.fileName)
  
      let avItem = AVPlayerItem(URL: url!)
      player = AVPlayer(playerItem: avItem)
  
      player?.play()
  
      let artworkProperty = MPMediaItemArtwork(image: song.artwork)
          MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = [MPMediaItemPropertyTitle : lblSongName.text!, MPMediaItemPropertyArtist : song.artist, MPMediaItemPropertyArtwork : artworkProperty, MPNowPlayingInfoPropertyDefaultPlaybackRate : NSNumber(int: 1), MPMediaItemPropertyPlaybackDuration : CMTimeGetSeconds((player!.currentItem?.asset.duration)!)]
  
  }
  
  override func remoteControlReceivedWithEvent(event: UIEvent?) {
      print(event!.type)
      if event!.type == UIEventType.RemoteControl {
          if event?.subtype == UIEventSubtype.RemoteControlPlay || event?.subtype == UIEventSubtype.RemoteControlPause {
              play(self)
          }
          if event?.subtype == UIEventSubtype.RemoteControlNextTrack {
              next(self)
          }
          if event?.subtype == UIEventSubtype.RemoteControlPreviousTrack {
              previous(self)
          }
      }
  }
  </code></pre>