Question: I am using Avplayer to show video clips and when i go back (app in background) video stop. How can i keep playing the video? 

I have search about background task & background thread ,IOS only support music in background (Not video)
 <http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html>

here is some discussion about play video in background 

1) <https://discussions.apple.com/thread/2799090?start=0&tstart=0>

2) <http://www.cocoawithlove.com/2011/04/background-audio-through-ios-movie.html> 

But there are many apps in AppStore, that play video in Background like 

Swift Player : <https://itunes.apple.com/us/app/swift-player-speed-up-video/id545216639?mt=8&ign-mpt=uo%3D2>

SpeedUpTV : <https://itunes.apple.com/ua/app/speeduptv/id386986953?mt=8>

Answer: 
Swift version for the accepted answer.

In the delegate:

```
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)

```

In the view controller that controls AVPlayer

```
override func viewDidAppear(animated: Bool) {
    UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
    self.becomeFirstResponder()
}

override func viewWillDisappear(animated: Bool) {
    mPlayer.pause()
    UIApplication.sharedApplication().endReceivingRemoteControlEvents()
    self.resignFirstResponder()
}

```

Don't forget to "import AVFoundation"
I'd like to add something that for some reason ended up being the culprit for me. I had used AVPlayer and background play for a long time without problems, but this one time I just couldn't get it to work.

I found out that when you go background, the `rate` property of the `AVPlayer` sometimes seems to dip to 0.0 (i.e. paused), and for that reason we simply need to KVO check the rate property at all times, or at least when we go to background. If the rate dips below 0.0 and we can assume that the user wants to play (i.e. the user did not deliberately tap pause in remote controls, the movie ended, etc) we need to call `.play()` on the AVPlayer again.

AFAIK there is no other toggle on the AVPlayer to keep it from pausing itself when app goes to background.