{"action":"created","issue":{"url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/38","labels_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/38/comments","events_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/38/events","html_url":"https://github.com/youtube/youtube-ios-player-helper/issues/38","id":45220104,"number":38,"title":"Play video (audio of video) in Background  iOS","user":{"login":"adeljodalah","id":5168656,"avatar_url":"https://avatars.githubusercontent.com/u/5168656?v=3","gravatar_id":"","url":"https://api.github.com/users/adeljodalah","html_url":"https://github.com/adeljodalah","followers_url":"https://api.github.com/users/adeljodalah/followers","following_url":"https://api.github.com/users/adeljodalah/following{/other_user}","gists_url":"https://api.github.com/users/adeljodalah/gists{/gist_id}","starred_url":"https://api.github.com/users/adeljodalah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adeljodalah/subscriptions","organizations_url":"https://api.github.com/users/adeljodalah/orgs","repos_url":"https://api.github.com/users/adeljodalah/repos","events_url":"https://api.github.com/users/adeljodalah/events{/privacy}","received_events_url":"https://api.github.com/users/adeljodalah/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-10-08T09:02:30Z","updated_at":"2015-01-04T05:26:48Z","closed_at":"2014-10-17T20:33:13Z","body":"Hi \r\nIm using YouTube Helper Library to play YouTube videos on my iOS application\r\nI just need a way to continue audio (or video) playing in background ,\r\nSo when user click on home button i need him to be able to hear the voice\r\nof the video ,\r\neven when he look his device i need to him to be able to control the sound and click next and back button for audio playing .. How i can achieve that on YouTube Helper Library ?\r\n@ikai , @ymotongpoo, @libor "},"comment":{"url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/comments/68621768","html_url":"https://github.com/youtube/youtube-ios-player-helper/issues/38#issuecomment-68621768","issue_url":"https://api.github.com/repos/youtube/youtube-ios-player-helper/issues/38","id":68621768,"user":{"login":"dvlpJ","id":10268193,"avatar_url":"https://avatars.githubusercontent.com/u/10268193?v=3","gravatar_id":"","url":"https://api.github.com/users/dvlpJ","html_url":"https://github.com/dvlpJ","followers_url":"https://api.github.com/users/dvlpJ/followers","following_url":"https://api.github.com/users/dvlpJ/following{/other_user}","gists_url":"https://api.github.com/users/dvlpJ/gists{/gist_id}","starred_url":"https://api.github.com/users/dvlpJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvlpJ/subscriptions","organizations_url":"https://api.github.com/users/dvlpJ/orgs","repos_url":"https://api.github.com/users/dvlpJ/repos","events_url":"https://api.github.com/users/dvlpJ/events{/privacy}","received_events_url":"https://api.github.com/users/dvlpJ/received_events","type":"User","site_admin":false},"created_at":"2015-01-04T05:26:48Z","updated_at":"2015-01-04T05:26:48Z","body":"Hi @adeljodalah \r\nThank you for your advise very much!!\r\nI did as you taught me, but I was not able to completely solve a problem.\r\nI'm sorry, but could you show me one more time?\r\n\r\nWhen I push the home button or rock button during YTPlayerView instance playing, YTPlayerView music stop.\r\nThen, if I pushed the play button in control center view, the music was played in a background.\r\nI do not want to do stop YTPlayerView music when I push the home button or rock button.\r\n\r\nIf it's alright with you, please teach me for solutions.\r\n\r\n↓My code \r\n[Xcode 6.1.1]\r\n[info.plist]\r\n\"Required background modes  Item0\"  :  \"App plays audio or streams audio/video using AirPlay\"\r\n\r\n[AppDelegate.m]\r\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\r\n   NSError *setCategoryError = nil;\r\n    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];\r\n  return YES;\r\n}\r\n\r\n-(void)remoteControlReceivedWithEvent:(UIEvent *)event { switch (event.subtype) {\r\n    case UIEventSubtypeRemoteControlPlay:\r\n        NSLog(@\"AppDelegate PLAY remoteControlReceivedWithEvent\");\r\n        break;\r\n    case UIEventSubtypeRemoteControlPause:\r\n        NSLog(@\"AppDelegate PAUSE UIEventSubtypeRemoteControlPause\");\r\n        break;\r\n    case UIEventSubtypeRemoteControlNextTrack:\r\n        NSLog(@\"AppDelegate NEXT UIEventSubtypeRemoteControlNextTrack\");\r\n        break;\r\n    case UIEventSubtypeRemoteControlPreviousTrack:\r\n        NSLog(@\"AppDelegate PREV UIEventSubtypeRemoteControlPreviousTrack\");\r\n        break;\r\n    default:\r\n    break;\r\n} }\r\n\r\n[ViewController.h]\r\n#import <UIKit/UIKit.h>\r\n#import \"YTPlayerView.h\"\r\n@interface ViewController : UIViewController<UIWebViewDelegate,YTPlayerViewDelegate>\r\n@property(nonatomic, strong) IBOutlet YTPlayerView *playerView;\r\n@end\r\n\r\n[ViewController.m]\r\n#import \"ViewController.h\"\r\n- (void)viewDidLoad {\r\n    [super viewDidLoad];\r\n   playerVars = @{\r\n                   @\"playsinline\" : @1,\r\n                   };\r\n    self.playerView.delegate = self;\r\n    [self.playerView loadWithVideoId:@\"SxsrupfqVNE\" playerVars:playerVars];\r\n}\r\n"}}