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"
If you are Playing video using WebView you can handle using javascript to play video on background.

```
strVideoHTML = @"<html><head><style>body.........</style></head> <body><div id=\"overlay\"><div id=\"youtubelogo1\"></div></div><div id=\"player\"></div> <script> var tag = document.createElement('script'); tag.src = \"http://www.youtube.com/player_api\"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; events: { 'onReady': onPlayerReady, } }); } function onPlayerReady(event) { event.target.playVideo(); } function changeBG(url){ document.getElementById('overlay').style.backgroundImage=url;} function manualPlay() {  player.playVideo(); }  function manualPause() {  player.pauseVideo(); }  </script></body> </html>";

NSString *html = [NSString stringWithFormat:strVideoHTML,url, width, height,videoid;
webvideoView.delegate = self;
[webvideoView loadHTMLString:html baseURL:[NSURL URLWithString:@"http://www.your-url.com"]];

```

On view diappear call

```
strscript = @"manualPlay();
[webvideoView stringByEvaluatingJavaScriptFromString:strscript];

```