{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments/60172955","id":60172955,"diff_hunk":"@@ -153,43 +174,39 @@ - (void)setPlaceholderImagefromAsset:(AVAsset*)asset\n     imageGenerator.appliesPreferredTrackTransform = YES;\n     NSArray *times = @[[NSValue valueWithCMTime:CMTimeMake(0, 1)]];\n     \n-    [imageGenerator generateCGImagesAsynchronouslyForTimes:times completionHandler:^(CMTime requestedTime, CGImageRef  _Nullable image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError * _Nullable error) {\n+    [imageGenerator generateCGImagesAsynchronouslyForTimes:times completionHandler:^(CMTime requestedTime, CGImageRef _Nullable image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError * _Nullable error) {\n       \n       ASDN::MutexLocker l(_videoLock);\n       \n       // Unfortunately it's not possible to generate a preview image for an HTTP live stream asset, so we'll give up here\n       // http://stackoverflow.com/questions/32112205/m3u8-file-avassetimagegenerator-error\n       if (image && _placeholderImageNode.image == nil) {\n-        UIImage *theImage = [UIImage imageWithCGImage:image];\n-        \n-        if (!_placeholderImageNode) {\n-          _placeholderImageNode = [[ASImageNode alloc] init];\n-          _placeholderImageNode.layerBacked = YES;\n-        }\n-        \n-        _placeholderImageNode.image = theImage;\n-        \n-        if ([_gravity isEqualToString:AVLayerVideoGravityResize]) {\n-          _placeholderImageNode.contentMode = UIViewContentModeRedraw;\n-        }\n-        else if ([_gravity isEqualToString:AVLayerVideoGravityResizeAspect]) {\n-          _placeholderImageNode.contentMode = UIViewContentModeScaleAspectFit;\n-        }\n-        else if ([_gravity isEqualToString:AVLayerVideoGravityResizeAspectFill]) {\n-          _placeholderImageNode.contentMode = UIViewContentModeScaleAspectFill;\n-        }\n-        \n-        dispatch_async(dispatch_get_main_queue(), ^{\n-          ASDN::MutexLocker l(_videoLock);\n-          \n-          [self insertSubnode:_placeholderImageNode atIndex:0];\n-          [self setNeedsLayout];\n-        });\n+        [self setPlaceholderImage:[UIImage imageWithCGImage:image]];\n       }\n     }];\n   });\n }\n \n+- (void)setPlaceholderImage:(UIImage *)image\n+{\n+  ASDN::MutexLocker l(_videoLock);\n+\n+  if (_placeholderImageNode == nil) {\n+    _placeholderImageNode = [[ASImageNode alloc] init];\n+    _placeholderImageNode.layerBacked = YES;\n+    _placeholderImageNode.contentMode = ASContentModeFromVideoGravity(_gravity);","path":"AsyncDisplayKit/ASVideoNode.mm","position":92,"original_position":92,"commit_id":"c1c1358baf8ac8bb4942d08e6ed6ae0f50ca9ccf","original_commit_id":"c1c1358baf8ac8bb4942d08e6ed6ae0f50ca9ccf","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":"Maybe we need to set _gravity on each time this method is called?","created_at":"2016-04-19T04:50:48Z","updated_at":"2016-04-19T04:50:48Z","html_url":"https://github.com/facebook/AsyncDisplayKit/pull/1549#discussion_r60172955","pull_request_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549","_links":{"self":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments/60172955"},"html":{"href":"https://github.com/facebook/AsyncDisplayKit/pull/1549#discussion_r60172955"},"pull_request":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549","id":66922707,"html_url":"https://github.com/facebook/AsyncDisplayKit/pull/1549","diff_url":"https://github.com/facebook/AsyncDisplayKit/pull/1549.diff","patch_url":"https://github.com/facebook/AsyncDisplayKit/pull/1549.patch","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1549","number":1549,"state":"open","locked":false,"title":"[ASVideoNode] Various fixes ","user":{"login":"ejensen","id":915431,"avatar_url":"https://avatars.githubusercontent.com/u/915431?v=3","gravatar_id":"","url":"https://api.github.com/users/ejensen","html_url":"https://github.com/ejensen","followers_url":"https://api.github.com/users/ejensen/followers","following_url":"https://api.github.com/users/ejensen/following{/other_user}","gists_url":"https://api.github.com/users/ejensen/gists{/gist_id}","starred_url":"https://api.github.com/users/ejensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejensen/subscriptions","organizations_url":"https://api.github.com/users/ejensen/orgs","repos_url":"https://api.github.com/users/ejensen/repos","events_url":"https://api.github.com/users/ejensen/events{/privacy}","received_events_url":"https://api.github.com/users/ejensen/received_events","type":"User","site_admin":false},"body":"Isolated fixes extracted from https://github.com/facebook/AsyncDisplayKit/pull/1496 These changes do not touch the player construction / fetchData cleanup from the original PR. I will rebase those changes in a separate PR.\r\n\r\n1. Corrects map between `AVLayerVideoGravityResize` and its corresponding `UIViewContentMode` (`ScaleToFill` instead of `Redraw`).\r\n2. Changing gravity now updates the placeholder node's `contentMode`.\r\n3. Replacing the `playButton` now cleans-up the previous button's state.\r\n4. Fix video stalling caused by backgrounding & foregrounding the app.","created_at":"2016-04-18T21:10:54Z","updated_at":"2016-04-19T04:50:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"286dcbbdc26e39165a1163675e9bb95adada25fc","assignee":null,"milestone":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/17","html_url":"https://github.com/facebook/AsyncDisplayKit/milestones/1.9.8","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/17/labels","id":1613535,"number":17,"title":"1.9.8","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":17,"closed_issues":81,"state":"open","created_at":"2016-02-29T22:36:28Z","updated_at":"2016-04-19T04:26:40Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549/commits","review_comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549/comments","review_comment_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1549/comments","statuses_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/c1c1358baf8ac8bb4942d08e6ed6ae0f50ca9ccf","head":{"label":"ejensen:video-fixes-rebase","ref":"video-fixes-rebase","sha":"c1c1358baf8ac8bb4942d08e6ed6ae0f50ca9ccf","user":{"login":"ejensen","id":915431,"avatar_url":"https://avatars.githubusercontent.com/u/915431?v=3","gravatar_id":"","url":"https://api.github.com/users/ejensen","html_url":"https://github.com/ejensen","followers_url":"https://api.github.com/users/ejensen/followers","following_url":"https://api.github.com/users/ejensen/following{/other_user}","gists_url":"https://api.github.com/users/ejensen/gists{/gist_id}","starred_url":"https://api.github.com/users/ejensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejensen/subscriptions","organizations_url":"https://api.github.com/users/ejensen/orgs","repos_url":"https://api.github.com/users/ejensen/repos","events_url":"https://api.github.com/users/ejensen/events{/privacy}","received_events_url":"https://api.github.com/users/ejensen/received_events","type":"User","site_admin":false},"repo":{"id":53369389,"name":"AsyncDisplayKit","full_name":"ejensen/AsyncDisplayKit","owner":{"login":"ejensen","id":915431,"avatar_url":"https://avatars.githubusercontent.com/u/915431?v=3","gravatar_id":"","url":"https://api.github.com/users/ejensen","html_url":"https://github.com/ejensen","followers_url":"https://api.github.com/users/ejensen/followers","following_url":"https://api.github.com/users/ejensen/following{/other_user}","gists_url":"https://api.github.com/users/ejensen/gists{/gist_id}","starred_url":"https://api.github.com/users/ejensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejensen/subscriptions","organizations_url":"https://api.github.com/users/ejensen/orgs","repos_url":"https://api.github.com/users/ejensen/repos","events_url":"https://api.github.com/users/ejensen/events{/privacy}","received_events_url":"https://api.github.com/users/ejensen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ejensen/AsyncDisplayKit","description":"Smooth asynchronous user interfaces for iOS apps.","fork":true,"url":"https://api.github.com/repos/ejensen/AsyncDisplayKit","forks_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/forks","keys_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/teams","hooks_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/hooks","issue_events_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/issues/events{/number}","events_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/events","assignees_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/assignees{/user}","branches_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/branches{/branch}","tags_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/tags","blobs_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/statuses/{sha}","languages_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/languages","stargazers_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/stargazers","contributors_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/contributors","subscribers_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/subscribers","subscription_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/subscription","commits_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/contents/{+path}","compare_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/merges","archive_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/downloads","issues_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/issues{/number}","pulls_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/pulls{/number}","milestones_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/milestones{/number}","notifications_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/labels{/name}","releases_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/releases{/id}","deployments_url":"https://api.github.com/repos/ejensen/AsyncDisplayKit/deployments","created_at":"2016-03-08T00:28:16Z","updated_at":"2016-03-08T00:28:18Z","pushed_at":"2016-04-18T23:23:42Z","git_url":"git://github.com/ejensen/AsyncDisplayKit.git","ssh_url":"git@github.com:ejensen/AsyncDisplayKit.git","clone_url":"https://github.com/ejensen/AsyncDisplayKit.git","svn_url":"https://github.com/ejensen/AsyncDisplayKit","homepage":"http://asyncdisplaykit.org","size":44908,"stargazers_count":0,"watchers_count":0,"language":"Objective-C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"103506beece0f13b89879cad83a9e8ed49598570","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}","deployments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/deployments","created_at":"2014-06-27T05:29:02Z","updated_at":"2016-04-19T03:15:47Z","pushed_at":"2016-04-19T02:44:01Z","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":50527,"stargazers_count":7828,"watchers_count":7828,"language":"Objective-C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1260,"mirror_url":null,"open_issues_count":165,"forks":1260,"open_issues":165,"watchers":7828,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549"},"html":{"href":"https://github.com/facebook/AsyncDisplayKit/pull/1549"},"issue":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1549"},"comments":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/1549/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/1549/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/c1c1358baf8ac8bb4942d08e6ed6ae0f50ca9ccf"}}}}