{"action":"created","comment":{"url":"https://api.github.com/repos/mitodl/odl-video-service/pulls/comments/176191420","pull_request_review_id":105845553,"id":176191420,"diff_hunk":"@@ -304,4 +303,30 @@ describe(\"VideoPlayer\", () => {\n       }\n     })\n   })\n+  ;[false, true].forEach(function(useYoutube) {\n+    it(`checkYouTube ${expect(\n+      useYoutube\n+    )} be called if useYoutube is ${String(useYoutube)}`, async () => {\n+      const wrapper = renderPlayer({ useYouTube: useYoutube })\n+      const checkStub = sandbox.stub(wrapper.instance(), \"checkYouTube\")\n+      wrapper.instance().componentDidMount()\n+      sinon.assert.callCount(checkStub, useYoutube ? 1 : 0)","path":"static/js/components/VideoPlayer_test.js","position":74,"original_position":74,"commit_id":"96f104774af66ab9a1e52db2d855d9928760b7d1","original_commit_id":"96f104774af66ab9a1e52db2d855d9928760b7d1","user":{"login":"aliceriot","id":6207644,"avatar_url":"https://avatars0.githubusercontent.com/u/6207644?v=4","gravatar_id":"","url":"https://api.github.com/users/aliceriot","html_url":"https://github.com/aliceriot","followers_url":"https://api.github.com/users/aliceriot/followers","following_url":"https://api.github.com/users/aliceriot/following{/other_user}","gists_url":"https://api.github.com/users/aliceriot/gists{/gist_id}","starred_url":"https://api.github.com/users/aliceriot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliceriot/subscriptions","organizations_url":"https://api.github.com/users/aliceriot/orgs","repos_url":"https://api.github.com/users/aliceriot/repos","events_url":"https://api.github.com/users/aliceriot/events{/privacy}","received_events_url":"https://api.github.com/users/aliceriot/received_events","type":"User","site_admin":false},"body":"this is probably stupid but you could use `Number(useYoutube)` here instead of the ternary :laughing: ","created_at":"2018-03-21T18:25:11Z","updated_at":"2018-03-21T18:37:27Z","html_url":"https://github.com/mitodl/odl-video-service/pull/460#discussion_r176191420","pull_request_url":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mitodl/odl-video-service/pulls/comments/176191420"},"html":{"href":"https://github.com/mitodl/odl-video-service/pull/460#discussion_r176191420"},"pull_request":{"href":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460"}}},"pull_request":{"url":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460","id":173864631,"html_url":"https://github.com/mitodl/odl-video-service/pull/460","diff_url":"https://github.com/mitodl/odl-video-service/pull/460.diff","patch_url":"https://github.com/mitodl/odl-video-service/pull/460.patch","issue_url":"https://api.github.com/repos/mitodl/odl-video-service/issues/460","number":460,"state":"open","locked":false,"title":"VideoJS YouTube Player","user":{"login":"mbertrand","id":187676,"avatar_url":"https://avatars2.githubusercontent.com/u/187676?v=4","gravatar_id":"","url":"https://api.github.com/users/mbertrand","html_url":"https://github.com/mbertrand","followers_url":"https://api.github.com/users/mbertrand/followers","following_url":"https://api.github.com/users/mbertrand/following{/other_user}","gists_url":"https://api.github.com/users/mbertrand/gists{/gist_id}","starred_url":"https://api.github.com/users/mbertrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbertrand/subscriptions","organizations_url":"https://api.github.com/users/mbertrand/orgs","repos_url":"https://api.github.com/users/mbertrand/repos","events_url":"https://api.github.com/users/mbertrand/events{/privacy}","received_events_url":"https://api.github.com/users/mbertrand/received_events","type":"User","site_admin":false},"body":"#### What are the relevant tickets?\r\n- Closes #452 \r\n\r\n#### What's this PR do?\r\n- Videos with a collection `stream_source` of `None` will play from YouTube if available, Cloudfront otherwise.\r\n- Videos with a collection `stream_source` of `Youtube` will only play from YouTube, available or not.\r\n- Videos with a collection `stream_source` of `Cloudfront` will never play from YouTube, only Cloudfront.\r\n\r\n#### How should this be manually tested?\r\n- Assign working values for `.env` variables `YT_CLIENT_ID`, `YT_PROJECT_ID`, `YT_CLIENT_SECRET`, `YT_ACCESS_TOKEN`, `YT_REFRESH_TOKEN` (I can send them to you)\r\n- You can run the import command 3x as explained in PR #454.  Or just change the `stream_source` value of an existing collection.\r\n- After each run/stream_source change, wait a few minutes if necessary for videos to upload to Youtube, then try to play a video.  The video should play from the expected source based on the rules above.\r\n- Block off youtube by modifying your `/etc/hosts` file (or ad blocker list).  Then try playing a video.  The video should still play from Cloudfront if its collection `stream_source` is `None` or `Cloudfront`.  It should not be playable if the `stream_source` is `Youtube`.\r\n    - This is done in the front-end on page load by trying to create an `Image` with a src url equal to the first thumbnail for a Youtube video, the assumption being that if that cannot be loaded then the video can't be either.  \r\n\r\n\r\nNote: I had to manually edit yarn.lock because it was creating duplicate dependencies for video.js that broke the youtube plugin, I think it may be related [to this bug](https://github.com/yarnpkg/yarn/issues/3967).","created_at":"2018-03-08T22:07:57Z","updated_at":"2018-03-21T18:37:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36f8f0564979dd0575b005e0fe5be0f0d69ed45b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":628196829,"url":"https://api.github.com/repos/mitodl/odl-video-service/labels/Needs%20Review","name":"Needs Review","color":"f9d0c4","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460/commits","review_comments_url":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460/comments","review_comment_url":"https://api.github.com/repos/mitodl/odl-video-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mitodl/odl-video-service/issues/460/comments","statuses_url":"https://api.github.com/repos/mitodl/odl-video-service/statuses/96f104774af66ab9a1e52db2d855d9928760b7d1","head":{"label":"mitodl:mb/youtube-ui-new","ref":"mb/youtube-ui-new","sha":"96f104774af66ab9a1e52db2d855d9928760b7d1","user":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":88642420,"name":"odl-video-service","full_name":"mitodl/odl-video-service","owner":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/odl-video-service","description":"building blocks for a basic video service for ODL","fork":false,"url":"https://api.github.com/repos/mitodl/odl-video-service","forks_url":"https://api.github.com/repos/mitodl/odl-video-service/forks","keys_url":"https://api.github.com/repos/mitodl/odl-video-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/odl-video-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/odl-video-service/teams","hooks_url":"https://api.github.com/repos/mitodl/odl-video-service/hooks","issue_events_url":"https://api.github.com/repos/mitodl/odl-video-service/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/odl-video-service/events","assignees_url":"https://api.github.com/repos/mitodl/odl-video-service/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/odl-video-service/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/odl-video-service/tags","blobs_url":"https://api.github.com/repos/mitodl/odl-video-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/odl-video-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/odl-video-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/odl-video-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/odl-video-service/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/odl-video-service/languages","stargazers_url":"https://api.github.com/repos/mitodl/odl-video-service/stargazers","contributors_url":"https://api.github.com/repos/mitodl/odl-video-service/contributors","subscribers_url":"https://api.github.com/repos/mitodl/odl-video-service/subscribers","subscription_url":"https://api.github.com/repos/mitodl/odl-video-service/subscription","commits_url":"https://api.github.com/repos/mitodl/odl-video-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/odl-video-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/odl-video-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/odl-video-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/odl-video-service/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/odl-video-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/odl-video-service/merges","archive_url":"https://api.github.com/repos/mitodl/odl-video-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/odl-video-service/downloads","issues_url":"https://api.github.com/repos/mitodl/odl-video-service/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/odl-video-service/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/odl-video-service/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/odl-video-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/odl-video-service/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/odl-video-service/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/odl-video-service/deployments","created_at":"2017-04-18T15:41:48Z","updated_at":"2018-03-21T15:10:32Z","pushed_at":"2018-03-21T18:01:10Z","git_url":"git://github.com/mitodl/odl-video-service.git","ssh_url":"git@github.com:mitodl/odl-video-service.git","clone_url":"https://github.com/mitodl/odl-video-service.git","svn_url":"https://github.com/mitodl/odl-video-service","homepage":null,"size":845,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":88,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":0,"open_issues":88,"watchers":2,"default_branch":"master"}},"base":{"label":"mitodl:master","ref":"master","sha":"b1ffe5092b6207341ef3abde4cc7b7fdf69c5c54","user":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":88642420,"name":"odl-video-service","full_name":"mitodl/odl-video-service","owner":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars2.githubusercontent.com/u/7918516?v=4","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/odl-video-service","description":"building blocks for a basic video service for ODL","fork":false,"url":"https://api.github.com/repos/mitodl/odl-video-service","forks_url":"https://api.github.com/repos/mitodl/odl-video-service/forks","keys_url":"https://api.github.com/repos/mitodl/odl-video-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/odl-video-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/odl-video-service/teams","hooks_url":"https://api.github.com/repos/mitodl/odl-video-service/hooks","issue_events_url":"https://api.github.com/repos/mitodl/odl-video-service/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/odl-video-service/events","assignees_url":"https://api.github.com/repos/mitodl/odl-video-service/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/odl-video-service/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/odl-video-service/tags","blobs_url":"https://api.github.com/repos/mitodl/odl-video-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/odl-video-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/odl-video-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/odl-video-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/odl-video-service/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/odl-video-service/languages","stargazers_url":"https://api.github.com/repos/mitodl/odl-video-service/stargazers","contributors_url":"https://api.github.com/repos/mitodl/odl-video-service/contributors","subscribers_url":"https://api.github.com/repos/mitodl/odl-video-service/subscribers","subscription_url":"https://api.github.com/repos/mitodl/odl-video-service/subscription","commits_url":"https://api.github.com/repos/mitodl/odl-video-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/odl-video-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/odl-video-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/odl-video-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/odl-video-service/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/odl-video-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/odl-video-service/merges","archive_url":"https://api.github.com/repos/mitodl/odl-video-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/odl-video-service/downloads","issues_url":"https://api.github.com/repos/mitodl/odl-video-service/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/odl-video-service/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/odl-video-service/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/odl-video-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/odl-video-service/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/odl-video-service/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/odl-video-service/deployments","created_at":"2017-04-18T15:41:48Z","updated_at":"2018-03-21T15:10:32Z","pushed_at":"2018-03-21T18:01:10Z","git_url":"git://github.com/mitodl/odl-video-service.git","ssh_url":"git@github.com:mitodl/odl-video-service.git","clone_url":"https://github.com/mitodl/odl-video-service.git","svn_url":"https://github.com/mitodl/odl-video-service","homepage":null,"size":845,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":88,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":0,"open_issues":88,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460"},"html":{"href":"https://github.com/mitodl/odl-video-service/pull/460"},"issue":{"href":"https://api.github.com/repos/mitodl/odl-video-service/issues/460"},"comments":{"href":"https://api.github.com/repos/mitodl/odl-video-service/issues/460/comments"},"review_comments":{"href":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460/comments"},"review_comment":{"href":"https://api.github.com/repos/mitodl/odl-video-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mitodl/odl-video-service/pulls/460/commits"},"statuses":{"href":"https://api.github.com/repos/mitodl/odl-video-service/statuses/96f104774af66ab9a1e52db2d855d9928760b7d1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"aliceriot"}}