{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments/48464533","id":48464533,"diff_hunk":"@@ -0,0 +1,352 @@\n+\n+\n+#import \"ASVideoNode.h\"\n+\n+@interface ASVideoNode ()\n+{\n+  ASDN::RecursiveMutex _lock;\n+  \n+  __weak id<ASVideoNodeDelegate> _delegate;\n+\n+  BOOL _shouldBePlaying;\n+  AVAsset *_asset;\n+  \n+  AVPlayerItem *_currentItem;\n+  AVPlayer *_player;\n+  \n+  ASButtonNode *_playButton;\n+  ASDisplayNode *_playerNode;\n+  ASDisplayNode *_spinner;\n+  ASVideoGravity _gravity;\n+}\n+\n+@end\n+\n+@interface ASDisplayNode ()\n+- (void)setInterfaceState:(ASInterfaceState)newState;\n+@end\n+\n+@implementation ASVideoNode\n+\n+- (instancetype)init\n+{\n+  if (!(self = [super init])) { return nil; }\n+  \n+  self.gravity = ASVideoGravityResizeAspect;\n+  \n+  [self addTarget:self action:@selector(tapped) forControlEvents:ASControlNodeEventTouchUpInside];\n+  \n+  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didPlayToEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];\n+  \n+  return self;\n+}\n+\n+// FIXME: Adopt interfaceStateDidChange API\n+- (void)setInterfaceState:(ASInterfaceState)newState\n+{\n+  [super setInterfaceState:newState];\n+  \n+  if (!(newState & ASInterfaceStateVisible)) {\n+    [self pause];\n+    [(UIActivityIndicatorView *)_spinner.view stopAnimating];\n+    [_spinner removeFromSupernode];\n+  } else {\n+    if (_shouldBePlaying) {\n+      [self play];\n+    }\n+  }\n+\n+  if (newState & ASInterfaceStateVisible) {\n+    [self displayDidFinish];\n+  }\n+}\n+\n+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context\n+{\n+  if ([[change objectForKey:@\"new\"] integerValue] == AVPlayerItemStatusReadyToPlay) {\n+    if ([self.subnodes containsObject:_spinner]) {\n+      [_spinner removeFromSupernode];\n+      _spinner = nil;\n+    }\n+  }\n+  \n+  if ([[change objectForKey:@\"new\"] integerValue] == AVPlayerItemStatusFailed) {\n+    \n+  }\n+}\n+\n+- (void)didPlayToEnd:(NSNotification *)notification\n+{\n+  if (ASObjectIsEqual([[notification object] asset], _asset)) {\n+    [_delegate videoDidReachEnd:self];\n+    [_player seekToTime:CMTimeMakeWithSeconds(0, 1)];\n+    \n+    if (_autorepeat) {\n+      [self play];\n+    } else {\n+      [self pause];\n+    }\n+  }\n+}\n+\n+- (void)layout\n+{\n+  [super layout];\n+  _playerNode.frame = self.bounds;\n+  \n+  CGFloat horizontalDiff = (self.bounds.size.width - _playButton.bounds.size.width)/2;\n+  CGFloat verticalDiff = (self.bounds.size.height - _playButton.bounds.size.height)/2;\n+  _playButton.hitTestSlop = UIEdgeInsetsMake(-verticalDiff, -horizontalDiff, -verticalDiff, -horizontalDiff);\n+  \n+  _spinner.frame = _playButton.frame;","path":"AsyncDisplayKit/ASVideoNode.mm","position":101,"original_position":101,"commit_id":"5fbf39644bb63bf8da6b54082689a4c66988342d","original_commit_id":"5fbf39644bb63bf8da6b54082689a4c66988342d","user":{"login":"appleguy","id":565251,"avatar_url":"https://avatars.githubusercontent.com/u/565251?v=3","gravatar_id":"","url":"https://api.github.com/users/appleguy","html_url":"https://github.com/appleguy","followers_url":"https://api.github.com/users/appleguy/followers","following_url":"https://api.github.com/users/appleguy/following{/other_user}","gists_url":"https://api.github.com/users/appleguy/gists{/gist_id}","starred_url":"https://api.github.com/users/appleguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleguy/subscriptions","organizations_url":"https://api.github.com/users/appleguy/orgs","repos_url":"https://api.github.com/users/appleguy/repos","events_url":"https://api.github.com/users/appleguy/events{/privacy}","received_events_url":"https://api.github.com/users/appleguy/received_events","type":"User","site_admin":false},"body":"Where is _playButton.frame set?","created_at":"2015-12-28T06:28:21Z","updated_at":"2015-12-28T06:28:21Z","html_url":"https://github.com/facebook/AsyncDisplayKit/pull/952#discussion_r48464533","pull_request_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952","_links":{"self":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments/48464533"},"html":{"href":"https://github.com/facebook/AsyncDisplayKit/pull/952#discussion_r48464533"},"pull_request":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952","id":54089436,"html_url":"https://github.com/facebook/AsyncDisplayKit/pull/952","diff_url":"https://github.com/facebook/AsyncDisplayKit/pull/952.diff","patch_url":"https://github.com/facebook/AsyncDisplayKit/pull/952.patch","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/952","number":952,"state":"open","locked":false,"title":"[ASVideoNode] Basic Video node using AVPlayerLayer.","user":{"login":"lappp9","id":432875,"avatar_url":"https://avatars.githubusercontent.com/u/432875?v=3","gravatar_id":"","url":"https://api.github.com/users/lappp9","html_url":"https://github.com/lappp9","followers_url":"https://api.github.com/users/lappp9/followers","following_url":"https://api.github.com/users/lappp9/following{/other_user}","gists_url":"https://api.github.com/users/lappp9/gists{/gist_id}","starred_url":"https://api.github.com/users/lappp9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lappp9/subscriptions","organizations_url":"https://api.github.com/users/lappp9/orgs","repos_url":"https://api.github.com/users/lappp9/repos","events_url":"https://api.github.com/users/lappp9/events{/privacy}","received_events_url":"https://api.github.com/users/lappp9/received_events","type":"User","site_admin":false},"body":"Here's a start at the video nodes with autoPlay and autoRepeat functionality.  The main property is the .asset property which can be set with any AVAsset object.  You can also add your own playButtonNode.  I also added two example apps, one called \"Nic Cage TableView\" and the other called \"Videos\".\r\n\r\nI'm sure there's still performance stuff to do before it's really ready but I'd be interested to get some feedback on what's there.\r\n\r\n","created_at":"2015-12-18T10:57:53Z","updated_at":"2015-12-28T06:28:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"880b3e779b8607b423df5a809c5edc06debf7d0b","assignee":null,"milestone":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/7","html_url":"https://github.com/facebook/AsyncDisplayKit/milestones/2.0","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/7/labels","id":1164099,"number":7,"title":"2.0","description":null,"creator":{"login":"appleguy","id":565251,"avatar_url":"https://avatars.githubusercontent.com/u/565251?v=3","gravatar_id":"","url":"https://api.github.com/users/appleguy","html_url":"https://github.com/appleguy","followers_url":"https://api.github.com/users/appleguy/followers","following_url":"https://api.github.com/users/appleguy/following{/other_user}","gists_url":"https://api.github.com/users/appleguy/gists{/gist_id}","starred_url":"https://api.github.com/users/appleguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleguy/subscriptions","organizations_url":"https://api.github.com/users/appleguy/orgs","repos_url":"https://api.github.com/users/appleguy/repos","events_url":"https://api.github.com/users/appleguy/events{/privacy}","received_events_url":"https://api.github.com/users/appleguy/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":3,"state":"open","created_at":"2015-06-15T00:41:47Z","updated_at":"2015-12-27T00:57:58Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952/commits","review_comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952/comments","review_comment_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/952/comments","statuses_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/5fbf39644bb63bf8da6b54082689a4c66988342d","head":{"label":"lappp9:ASVideoNode","ref":"ASVideoNode","sha":"5fbf39644bb63bf8da6b54082689a4c66988342d","user":{"login":"lappp9","id":432875,"avatar_url":"https://avatars.githubusercontent.com/u/432875?v=3","gravatar_id":"","url":"https://api.github.com/users/lappp9","html_url":"https://github.com/lappp9","followers_url":"https://api.github.com/users/lappp9/followers","following_url":"https://api.github.com/users/lappp9/following{/other_user}","gists_url":"https://api.github.com/users/lappp9/gists{/gist_id}","starred_url":"https://api.github.com/users/lappp9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lappp9/subscriptions","organizations_url":"https://api.github.com/users/lappp9/orgs","repos_url":"https://api.github.com/users/lappp9/repos","events_url":"https://api.github.com/users/lappp9/events{/privacy}","received_events_url":"https://api.github.com/users/lappp9/received_events","type":"User","site_admin":false},"repo":{"id":37788642,"name":"AsyncDisplayKit","full_name":"lappp9/AsyncDisplayKit","owner":{"login":"lappp9","id":432875,"avatar_url":"https://avatars.githubusercontent.com/u/432875?v=3","gravatar_id":"","url":"https://api.github.com/users/lappp9","html_url":"https://github.com/lappp9","followers_url":"https://api.github.com/users/lappp9/followers","following_url":"https://api.github.com/users/lappp9/following{/other_user}","gists_url":"https://api.github.com/users/lappp9/gists{/gist_id}","starred_url":"https://api.github.com/users/lappp9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lappp9/subscriptions","organizations_url":"https://api.github.com/users/lappp9/orgs","repos_url":"https://api.github.com/users/lappp9/repos","events_url":"https://api.github.com/users/lappp9/events{/privacy}","received_events_url":"https://api.github.com/users/lappp9/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lappp9/AsyncDisplayKit","description":"Smooth asynchronous user interfaces for iOS apps.","fork":true,"url":"https://api.github.com/repos/lappp9/AsyncDisplayKit","forks_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/forks","keys_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/teams","hooks_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/hooks","issue_events_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/issues/events{/number}","events_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/events","assignees_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/assignees{/user}","branches_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/branches{/branch}","tags_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/tags","blobs_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/statuses/{sha}","languages_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/languages","stargazers_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/stargazers","contributors_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/contributors","subscribers_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/subscribers","subscription_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/subscription","commits_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/contents/{+path}","compare_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/merges","archive_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/downloads","issues_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/issues{/number}","pulls_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/pulls{/number}","milestones_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/milestones{/number}","notifications_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/labels{/name}","releases_url":"https://api.github.com/repos/lappp9/AsyncDisplayKit/releases{/id}","created_at":"2015-06-20T22:44:26Z","updated_at":"2015-12-24T00:56:34Z","pushed_at":"2015-12-26T07:35:28Z","git_url":"git://github.com/lappp9/AsyncDisplayKit.git","ssh_url":"git@github.com:lappp9/AsyncDisplayKit.git","clone_url":"https://github.com/lappp9/AsyncDisplayKit.git","svn_url":"https://github.com/lappp9/AsyncDisplayKit","homepage":"http://asyncdisplaykit.org","size":15054,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"b50d7427f88bace14aa7eab929b26966be6e32ac","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":21265042,"name":"AsyncDisplayKit","full_name":"facebook/AsyncDisplayKit","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/AsyncDisplayKit","description":"Smooth asynchronous user interfaces for iOS apps.","fork":false,"url":"https://api.github.com/repos/facebook/AsyncDisplayKit","forks_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/forks","keys_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/teams","hooks_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/hooks","issue_events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/events","assignees_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/tags","blobs_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/languages","stargazers_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/stargazers","contributors_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/contributors","subscribers_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/subscribers","subscription_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/subscription","commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/merges","archive_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/downloads","issues_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/labels{/name}","releases_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/releases{/id}","created_at":"2014-06-27T05:29:02Z","updated_at":"2015-12-28T06:05:51Z","pushed_at":"2015-12-28T05:35:20Z","git_url":"git://github.com/facebook/AsyncDisplayKit.git","ssh_url":"git@github.com:facebook/AsyncDisplayKit.git","clone_url":"https://github.com/facebook/AsyncDisplayKit.git","svn_url":"https://github.com/facebook/AsyncDisplayKit","homepage":"http://asyncdisplaykit.org","size":16399,"stargazers_count":6861,"watchers_count":6861,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1027,"mirror_url":null,"open_issues_count":144,"forks":1027,"open_issues":144,"watchers":6861,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952"},"html":{"href":"https://github.com/facebook/AsyncDisplayKit/pull/952"},"issue":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/952"},"comments":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/952/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/952/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/5fbf39644bb63bf8da6b54082689a4c66988342d"}}}}