{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/53548900","id":53548900,"diff_hunk":"@@ -25,16 +25,44 @@ oppia.directive('oppiaNoninteractiveVideo', [\n       restrict: 'E',\n       scope: {},\n       templateUrl: 'richTextComponent/Video',\n-      controller: ['$scope', '$attrs', 'explorationContextService',\n-        function($scope, $attrs, explorationContextService) {\n+      controller: ['$scope', '$attrs', 'explorationContextService', '$element',\n+        'PAGE_CONTEXT',\n+        function($scope, $attrs, explorationContextService, $element) {\n           var start = oppiaHtmlEscaper.escapedJsonToObj($attrs.startWithValue);\n           var end = oppiaHtmlEscaper.escapedJsonToObj($attrs.endWithValue);\n \n-          $scope.autoplaySuffix = (oppiaHtmlEscaper.escapedJsonToObj(\n-            $attrs.autoplayWithValue) ? '&autoplay=1' : '&autoplay=0');\n           $scope.videoId = oppiaHtmlEscaper.escapedJsonToObj(\n             $attrs.videoIdWithValue);\n           $scope.timingParams = '&start=' + start + '&end=' + end;\n+\n+          // This code helps in checking whether video is for upcoming content.\n+          // This is totally dependent of parent div of video container\n+          // If in future that parent div changes then this code will be\n+          // required to change accordingly.\n+          var isVisible = true;\n+          var videoVisibilty = angular.element($element).prop('offsetParent');\n+          if (videoVisibilty) {\n+            isVisible = (videoVisibilty.getAttribute('angular-html-bind') !==\n+              'upcomingContentHtml' ? true : false);\n+          }\n+\n+          // If user in learner context then only autoplay videos.\n+          if (explorationContextService.getPageContext() ===\n+            PAGE_CONTEXT.LEARNER) {\n+            // If video has been already played or if it is not visible for now\n+            // then dont autoplay it.\n+            if (explorationContextService.getFromPlayedList($scope.videoId) ||\n+              !(isVisible)) {\n+              $scope.autoplaySuffix = '&autoplay=0';\n+            } else {\n+              $scope.autoplaySuffix = '&autoplay=1';\n+            }\n+          } else {\n+            // If not in learner context then use default value,","path":"extensions/rich_text_components/Video/Video.js","position":41,"original_position":41,"commit_id":"d97e5e62012163fcd76f88140265e75472f2c0b3","original_commit_id":"d97e5e62012163fcd76f88140265e75472f2c0b3","user":{"login":"prasanna08","id":8678373,"avatar_url":"https://avatars.githubusercontent.com/u/8678373?v=3","gravatar_id":"","url":"https://api.github.com/users/prasanna08","html_url":"https://github.com/prasanna08","followers_url":"https://api.github.com/users/prasanna08/followers","following_url":"https://api.github.com/users/prasanna08/following{/other_user}","gists_url":"https://api.github.com/users/prasanna08/gists{/gist_id}","starred_url":"https://api.github.com/users/prasanna08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasanna08/subscriptions","organizations_url":"https://api.github.com/users/prasanna08/orgs","repos_url":"https://api.github.com/users/prasanna08/repos","events_url":"https://api.github.com/users/prasanna08/events{/privacy}","received_events_url":"https://api.github.com/users/prasanna08/received_events","type":"User","site_admin":false},"body":"Well but the case is we are going to autoplay video whenever it is first seen in learner's context.\r\nNow it does not have to do anything with the creator's specified value.\r\nAnd what you are telling me is that if creator specified do not autoplay then it shall not autoplay even if it is first time appearing in learner's context. \r\nThat contradicts with what is being implemented. Here we will autoplay video when it is first seen in learner's context no matter what creator has specified.\r\nSo I am confused ??","created_at":"2016-02-20T11:12:28Z","updated_at":"2016-02-20T11:12:28Z","html_url":"https://github.com/oppia/oppia/pull/1487#discussion_r53548900","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/1487","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/53548900"},"html":{"href":"https://github.com/oppia/oppia/pull/1487#discussion_r53548900"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1487"}}},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/1487","id":59966208,"html_url":"https://github.com/oppia/oppia/pull/1487","diff_url":"https://github.com/oppia/oppia/pull/1487.diff","patch_url":"https://github.com/oppia/oppia/pull/1487.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/1487","number":1487,"state":"open","locked":false,"title":"Video should autoplay when it first appears to the learner, #1380","user":{"login":"prasanna08","id":8678373,"avatar_url":"https://avatars.githubusercontent.com/u/8678373?v=3","gravatar_id":"","url":"https://api.github.com/users/prasanna08","html_url":"https://github.com/prasanna08","followers_url":"https://api.github.com/users/prasanna08/followers","following_url":"https://api.github.com/users/prasanna08/following{/other_user}","gists_url":"https://api.github.com/users/prasanna08/gists{/gist_id}","starred_url":"https://api.github.com/users/prasanna08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasanna08/subscriptions","organizations_url":"https://api.github.com/users/prasanna08/orgs","repos_url":"https://api.github.com/users/prasanna08/repos","events_url":"https://api.github.com/users/prasanna08/events{/privacy}","received_events_url":"https://api.github.com/users/prasanna08/received_events","type":"User","site_admin":false},"body":"This fixes the autoplay issue that is stated in #1380.\r\nAs seen this code requires use of parent div of oppia-non-interactivevideo to distinguish between hidden and visible content. Therefore, I added suitable comments wherever it applies.","created_at":"2016-02-19T15:46:18Z","updated_at":"2016-02-20T11:12:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95f9d0ade9f90f1553e67d9519939ea637419d1f","assignee":{"login":"seanlip","id":10575562,"avatar_url":"https://avatars.githubusercontent.com/u/10575562?v=3","gravatar_id":"","url":"https://api.github.com/users/seanlip","html_url":"https://github.com/seanlip","followers_url":"https://api.github.com/users/seanlip/followers","following_url":"https://api.github.com/users/seanlip/following{/other_user}","gists_url":"https://api.github.com/users/seanlip/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlip/subscriptions","organizations_url":"https://api.github.com/users/seanlip/orgs","repos_url":"https://api.github.com/users/seanlip/repos","events_url":"https://api.github.com/users/seanlip/events{/privacy}","received_events_url":"https://api.github.com/users/seanlip/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/1487/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/1487/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/1487/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/d97e5e62012163fcd76f88140265e75472f2c0b3","head":{"label":"prasanna08:autoplay-issue","ref":"autoplay-issue","sha":"d97e5e62012163fcd76f88140265e75472f2c0b3","user":{"login":"prasanna08","id":8678373,"avatar_url":"https://avatars.githubusercontent.com/u/8678373?v=3","gravatar_id":"","url":"https://api.github.com/users/prasanna08","html_url":"https://github.com/prasanna08","followers_url":"https://api.github.com/users/prasanna08/followers","following_url":"https://api.github.com/users/prasanna08/following{/other_user}","gists_url":"https://api.github.com/users/prasanna08/gists{/gist_id}","starred_url":"https://api.github.com/users/prasanna08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasanna08/subscriptions","organizations_url":"https://api.github.com/users/prasanna08/orgs","repos_url":"https://api.github.com/users/prasanna08/repos","events_url":"https://api.github.com/users/prasanna08/events{/privacy}","received_events_url":"https://api.github.com/users/prasanna08/received_events","type":"User","site_admin":false},"repo":{"id":49757386,"name":"oppia","full_name":"prasanna08/oppia","owner":{"login":"prasanna08","id":8678373,"avatar_url":"https://avatars.githubusercontent.com/u/8678373?v=3","gravatar_id":"","url":"https://api.github.com/users/prasanna08","html_url":"https://github.com/prasanna08","followers_url":"https://api.github.com/users/prasanna08/followers","following_url":"https://api.github.com/users/prasanna08/following{/other_user}","gists_url":"https://api.github.com/users/prasanna08/gists{/gist_id}","starred_url":"https://api.github.com/users/prasanna08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasanna08/subscriptions","organizations_url":"https://api.github.com/users/prasanna08/orgs","repos_url":"https://api.github.com/users/prasanna08/repos","events_url":"https://api.github.com/users/prasanna08/events{/privacy}","received_events_url":"https://api.github.com/users/prasanna08/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prasanna08/oppia","description":"Tool for collaboratively building intelligent tutors.","fork":true,"url":"https://api.github.com/repos/prasanna08/oppia","forks_url":"https://api.github.com/repos/prasanna08/oppia/forks","keys_url":"https://api.github.com/repos/prasanna08/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prasanna08/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prasanna08/oppia/teams","hooks_url":"https://api.github.com/repos/prasanna08/oppia/hooks","issue_events_url":"https://api.github.com/repos/prasanna08/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/prasanna08/oppia/events","assignees_url":"https://api.github.com/repos/prasanna08/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/prasanna08/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/prasanna08/oppia/tags","blobs_url":"https://api.github.com/repos/prasanna08/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prasanna08/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prasanna08/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/prasanna08/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prasanna08/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/prasanna08/oppia/languages","stargazers_url":"https://api.github.com/repos/prasanna08/oppia/stargazers","contributors_url":"https://api.github.com/repos/prasanna08/oppia/contributors","subscribers_url":"https://api.github.com/repos/prasanna08/oppia/subscribers","subscription_url":"https://api.github.com/repos/prasanna08/oppia/subscription","commits_url":"https://api.github.com/repos/prasanna08/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/prasanna08/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/prasanna08/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/prasanna08/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/prasanna08/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/prasanna08/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prasanna08/oppia/merges","archive_url":"https://api.github.com/repos/prasanna08/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prasanna08/oppia/downloads","issues_url":"https://api.github.com/repos/prasanna08/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/prasanna08/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/prasanna08/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/prasanna08/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prasanna08/oppia/labels{/name}","releases_url":"https://api.github.com/repos/prasanna08/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/prasanna08/oppia/deployments","created_at":"2016-01-16T03:21:22Z","updated_at":"2016-01-16T03:21:24Z","pushed_at":"2016-02-19T15:28:15Z","git_url":"git://github.com/prasanna08/oppia.git","ssh_url":"git@github.com:prasanna08/oppia.git","clone_url":"https://github.com/prasanna08/oppia.git","svn_url":"https://github.com/prasanna08/oppia","homepage":"https://www.oppia.org","size":41368,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"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":"develop"}},"base":{"label":"oppia:develop","ref":"develop","sha":"d215d057b794e2747a2018d567f18d05c1b41867","user":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"repo":{"id":40687563,"name":"oppia","full_name":"oppia/oppia","owner":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oppia/oppia","description":"Tool for collaboratively building intelligent tutors.","fork":false,"url":"https://api.github.com/repos/oppia/oppia","forks_url":"https://api.github.com/repos/oppia/oppia/forks","keys_url":"https://api.github.com/repos/oppia/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oppia/oppia/teams","hooks_url":"https://api.github.com/repos/oppia/oppia/hooks","issue_events_url":"https://api.github.com/repos/oppia/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/oppia/oppia/events","assignees_url":"https://api.github.com/repos/oppia/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/oppia/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/oppia/oppia/tags","blobs_url":"https://api.github.com/repos/oppia/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oppia/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oppia/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/oppia/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/oppia/oppia/languages","stargazers_url":"https://api.github.com/repos/oppia/oppia/stargazers","contributors_url":"https://api.github.com/repos/oppia/oppia/contributors","subscribers_url":"https://api.github.com/repos/oppia/oppia/subscribers","subscription_url":"https://api.github.com/repos/oppia/oppia/subscription","commits_url":"https://api.github.com/repos/oppia/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/oppia/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/oppia/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/oppia/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/oppia/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/oppia/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oppia/oppia/merges","archive_url":"https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oppia/oppia/downloads","issues_url":"https://api.github.com/repos/oppia/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/oppia/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/oppia/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oppia/oppia/labels{/name}","releases_url":"https://api.github.com/repos/oppia/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/oppia/oppia/deployments","created_at":"2015-08-14T00:16:14Z","updated_at":"2016-02-19T06:51:37Z","pushed_at":"2016-02-20T05:09:57Z","git_url":"git://github.com/oppia/oppia.git","ssh_url":"git@github.com:oppia/oppia.git","clone_url":"https://github.com/oppia/oppia.git","svn_url":"https://github.com/oppia/oppia","homepage":"https://www.oppia.org","size":46444,"stargazers_count":80,"watchers_count":80,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":117,"mirror_url":null,"open_issues_count":268,"forks":117,"open_issues":268,"watchers":80,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1487"},"html":{"href":"https://github.com/oppia/oppia/pull/1487"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/1487"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/1487/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1487/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1487/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/d97e5e62012163fcd76f88140265e75472f2c0b3"}}}}