{"action":"created","comment":{"url":"https://api.github.com/repos/google/shaka-player/pulls/comments/220660231","pull_request_review_id":159119867,"id":220660231,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDY2MDIzMQ==","diff_hunk":"@@ -770,6 +788,61 @@ shaka.offline.Storage.prototype.createOfflineManifest_ = function(\n   };\n };\n \n+/**\n+ * Extract DRM initData from first segment\n+ *\n+ * @param {shaka.extern.Manifest} manifest\n+ * @param {shaka.net.NetworkingEngine} networkingEngine\n+ * @return {Promise<shaka.extern.Manifest>}\n+ * @private\n+ */\n+shaka.offline.Storage.prototype.extractInitDataFromFirstSegment_ = async function(\n+  manifest, networkingEngine) {\n+  // get init segments uri of all variants\n+  /** @type {Array<Array<string>>} */\n+  let initSegmentReferences = [].concat.apply([], manifest.periods.map((period) => {\n+    return period.variants.map((variant) => {\n+      return variant.video.initSegmentReference;\n+    });\n+  }));\n+\n+  // download init segments\n+  let segmentResult = await Promise.all(\n+    initSegmentReferences.map((initSegmentReference) => {\n+      this.checkDestroyed_();\n+      let retryParams = this.player_.getConfiguration()\n+          .streaming.retryParameters;\n+      let request = shaka.net.NetworkingEngine.makeRequest(\n+        initSegmentReference.getUris(), retryParams);\n+      if (initSegmentReference.startByte != null) {\n+        let end = (initSegmentReference.endByte != null ?\n+          initSegmentReference.endByte : '');\n+        request.headers['Range'] = 'bytes=' + initSegmentReference.startByte\n+          + '-' + end;\n+      }\n+      let type = shaka.net.NetworkingEngine.RequestType.SEGMENT;\n+      return networkingEngine.request(type, request).promise;\n+    })\n+  );\n+\n+  // search for pssh atom in segment and insert init data into manifest\n+  let counter = 0;\n+  manifest.periods.forEach((period) => {","path":"lib/offline/storage.js","position":75,"original_position":75,"commit_id":"f2463916d0a5635831faa75183e40d7cbeccede2","original_commit_id":"f2463916d0a5635831faa75183e40d7cbeccede2","user":{"login":"bartsidee","id":521633,"node_id":"MDQ6VXNlcjUyMTYzMw==","avatar_url":"https://avatars3.githubusercontent.com/u/521633?v=4","gravatar_id":"","url":"https://api.github.com/users/bartsidee","html_url":"https://github.com/bartsidee","followers_url":"https://api.github.com/users/bartsidee/followers","following_url":"https://api.github.com/users/bartsidee/following{/other_user}","gists_url":"https://api.github.com/users/bartsidee/gists{/gist_id}","starred_url":"https://api.github.com/users/bartsidee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartsidee/subscriptions","organizations_url":"https://api.github.com/users/bartsidee/orgs","repos_url":"https://api.github.com/users/bartsidee/repos","events_url":"https://api.github.com/users/bartsidee/events{/privacy}","received_events_url":"https://api.github.com/users/bartsidee/received_events","type":"User","site_admin":false},"body":"we can update to the latest shaka standards","created_at":"2018-09-26T17:46:45Z","updated_at":"2018-09-26T17:46:45Z","html_url":"https://github.com/google/shaka-player/pull/1600#discussion_r220660231","pull_request_url":"https://api.github.com/repos/google/shaka-player/pulls/1600","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/google/shaka-player/pulls/comments/220660231"},"html":{"href":"https://github.com/google/shaka-player/pull/1600#discussion_r220660231"},"pull_request":{"href":"https://api.github.com/repos/google/shaka-player/pulls/1600"}},"in_reply_to_id":220554339},"pull_request":{"url":"https://api.github.com/repos/google/shaka-player/pulls/1600","id":218215380,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4MjE1Mzgw","html_url":"https://github.com/google/shaka-player/pull/1600","diff_url":"https://github.com/google/shaka-player/pull/1600.diff","patch_url":"https://github.com/google/shaka-player/pull/1600.patch","issue_url":"https://api.github.com/repos/google/shaka-player/issues/1600","number":1600,"state":"open","locked":false,"title":"Offline PSSH support for manifest that are missing inline init data (#1531)","user":{"login":"bartsidee","id":521633,"node_id":"MDQ6VXNlcjUyMTYzMw==","avatar_url":"https://avatars3.githubusercontent.com/u/521633?v=4","gravatar_id":"","url":"https://api.github.com/users/bartsidee","html_url":"https://github.com/bartsidee","followers_url":"https://api.github.com/users/bartsidee/followers","following_url":"https://api.github.com/users/bartsidee/following{/other_user}","gists_url":"https://api.github.com/users/bartsidee/gists{/gist_id}","starred_url":"https://api.github.com/users/bartsidee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartsidee/subscriptions","organizations_url":"https://api.github.com/users/bartsidee/orgs","repos_url":"https://api.github.com/users/bartsidee/repos","events_url":"https://api.github.com/users/bartsidee/events{/privacy}","received_events_url":"https://api.github.com/users/bartsidee/received_events","type":"User","site_admin":false},"body":"This is an initial implementation to manually parse the first media segments to extract the PSSH data from the moov atom to support offline storage of content that does not include inline PSSH init data. \r\n\r\nPer ticket #1531\r\n> When we store content, we need to create an EME offline session so we can play the encrypted content later. To create the session we need the init data, which is usually PSSH data. If it is in the manifest, we can just pass it to EME to create the offline session. But if we don't have it, we need to get it from the media.\r\n\r\n> In a streaming situation, we pass the media to the browser and it gives us an encrypted event with the PSSH data in it. But when we are storing content, we can't give it to the browser since we don't want to create a <video> element and have to deal with MSE.\r\n\r\nThe implementation manually fetches the first segments of the stream and then parses them using the existing shaka mp4 atom parser and re-used logic from the 'shaka.polyfill.PatchedMediaKeysMs' to correctly extract the PSSH value which is then inserted into the DrmEngine.","created_at":"2018-09-26T07:33:14Z","updated_at":"2018-09-26T17:46:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/shaka-player/pulls/1600/commits","review_comments_url":"https://api.github.com/repos/google/shaka-player/pulls/1600/comments","review_comment_url":"https://api.github.com/repos/google/shaka-player/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/shaka-player/issues/1600/comments","statuses_url":"https://api.github.com/repos/google/shaka-player/statuses/f2463916d0a5635831faa75183e40d7cbeccede2","head":{"label":"twc-apps:feature/1531","ref":"feature/1531","sha":"f2463916d0a5635831faa75183e40d7cbeccede2","user":{"login":"twc-apps","id":23452717,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNDUyNzE3","avatar_url":"https://avatars1.githubusercontent.com/u/23452717?v=4","gravatar_id":"","url":"https://api.github.com/users/twc-apps","html_url":"https://github.com/twc-apps","followers_url":"https://api.github.com/users/twc-apps/followers","following_url":"https://api.github.com/users/twc-apps/following{/other_user}","gists_url":"https://api.github.com/users/twc-apps/gists{/gist_id}","starred_url":"https://api.github.com/users/twc-apps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twc-apps/subscriptions","organizations_url":"https://api.github.com/users/twc-apps/orgs","repos_url":"https://api.github.com/users/twc-apps/repos","events_url":"https://api.github.com/users/twc-apps/events{/privacy}","received_events_url":"https://api.github.com/users/twc-apps/received_events","type":"Organization","site_admin":false},"repo":{"id":145396430,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUzOTY0MzA=","name":"shaka-player","full_name":"twc-apps/shaka-player","private":false,"owner":{"login":"twc-apps","id":23452717,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNDUyNzE3","avatar_url":"https://avatars1.githubusercontent.com/u/23452717?v=4","gravatar_id":"","url":"https://api.github.com/users/twc-apps","html_url":"https://github.com/twc-apps","followers_url":"https://api.github.com/users/twc-apps/followers","following_url":"https://api.github.com/users/twc-apps/following{/other_user}","gists_url":"https://api.github.com/users/twc-apps/gists{/gist_id}","starred_url":"https://api.github.com/users/twc-apps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twc-apps/subscriptions","organizations_url":"https://api.github.com/users/twc-apps/orgs","repos_url":"https://api.github.com/users/twc-apps/repos","events_url":"https://api.github.com/users/twc-apps/events{/privacy}","received_events_url":"https://api.github.com/users/twc-apps/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/twc-apps/shaka-player","description":"JavaScript player library / DASH client / MSE-EME player","fork":true,"url":"https://api.github.com/repos/twc-apps/shaka-player","forks_url":"https://api.github.com/repos/twc-apps/shaka-player/forks","keys_url":"https://api.github.com/repos/twc-apps/shaka-player/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twc-apps/shaka-player/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twc-apps/shaka-player/teams","hooks_url":"https://api.github.com/repos/twc-apps/shaka-player/hooks","issue_events_url":"https://api.github.com/repos/twc-apps/shaka-player/issues/events{/number}","events_url":"https://api.github.com/repos/twc-apps/shaka-player/events","assignees_url":"https://api.github.com/repos/twc-apps/shaka-player/assignees{/user}","branches_url":"https://api.github.com/repos/twc-apps/shaka-player/branches{/branch}","tags_url":"https://api.github.com/repos/twc-apps/shaka-player/tags","blobs_url":"https://api.github.com/repos/twc-apps/shaka-player/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twc-apps/shaka-player/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twc-apps/shaka-player/git/refs{/sha}","trees_url":"https://api.github.com/repos/twc-apps/shaka-player/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twc-apps/shaka-player/statuses/{sha}","languages_url":"https://api.github.com/repos/twc-apps/shaka-player/languages","stargazers_url":"https://api.github.com/repos/twc-apps/shaka-player/stargazers","contributors_url":"https://api.github.com/repos/twc-apps/shaka-player/contributors","subscribers_url":"https://api.github.com/repos/twc-apps/shaka-player/subscribers","subscription_url":"https://api.github.com/repos/twc-apps/shaka-player/subscription","commits_url":"https://api.github.com/repos/twc-apps/shaka-player/commits{/sha}","git_commits_url":"https://api.github.com/repos/twc-apps/shaka-player/git/commits{/sha}","comments_url":"https://api.github.com/repos/twc-apps/shaka-player/comments{/number}","issue_comment_url":"https://api.github.com/repos/twc-apps/shaka-player/issues/comments{/number}","contents_url":"https://api.github.com/repos/twc-apps/shaka-player/contents/{+path}","compare_url":"https://api.github.com/repos/twc-apps/shaka-player/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twc-apps/shaka-player/merges","archive_url":"https://api.github.com/repos/twc-apps/shaka-player/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twc-apps/shaka-player/downloads","issues_url":"https://api.github.com/repos/twc-apps/shaka-player/issues{/number}","pulls_url":"https://api.github.com/repos/twc-apps/shaka-player/pulls{/number}","milestones_url":"https://api.github.com/repos/twc-apps/shaka-player/milestones{/number}","notifications_url":"https://api.github.com/repos/twc-apps/shaka-player/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twc-apps/shaka-player/labels{/name}","releases_url":"https://api.github.com/repos/twc-apps/shaka-player/releases{/id}","deployments_url":"https://api.github.com/repos/twc-apps/shaka-player/deployments","created_at":"2018-08-20T09:30:30Z","updated_at":"2018-08-20T09:30:33Z","pushed_at":"2018-09-17T09:26:24Z","git_url":"git://github.com/twc-apps/shaka-player.git","ssh_url":"git@github.com:twc-apps/shaka-player.git","clone_url":"https://github.com/twc-apps/shaka-player.git","svn_url":"https://github.com/twc-apps/shaka-player","homepage":"","size":102748,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"2e0ebba1052af09307b93567daece9a04115bf71","user":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":28246472,"node_id":"MDEwOlJlcG9zaXRvcnkyODI0NjQ3Mg==","name":"shaka-player","full_name":"google/shaka-player","private":false,"owner":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/google/shaka-player","description":"JavaScript player library / DASH client / MSE-EME player","fork":false,"url":"https://api.github.com/repos/google/shaka-player","forks_url":"https://api.github.com/repos/google/shaka-player/forks","keys_url":"https://api.github.com/repos/google/shaka-player/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/shaka-player/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/shaka-player/teams","hooks_url":"https://api.github.com/repos/google/shaka-player/hooks","issue_events_url":"https://api.github.com/repos/google/shaka-player/issues/events{/number}","events_url":"https://api.github.com/repos/google/shaka-player/events","assignees_url":"https://api.github.com/repos/google/shaka-player/assignees{/user}","branches_url":"https://api.github.com/repos/google/shaka-player/branches{/branch}","tags_url":"https://api.github.com/repos/google/shaka-player/tags","blobs_url":"https://api.github.com/repos/google/shaka-player/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/shaka-player/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/shaka-player/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/shaka-player/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/shaka-player/statuses/{sha}","languages_url":"https://api.github.com/repos/google/shaka-player/languages","stargazers_url":"https://api.github.com/repos/google/shaka-player/stargazers","contributors_url":"https://api.github.com/repos/google/shaka-player/contributors","subscribers_url":"https://api.github.com/repos/google/shaka-player/subscribers","subscription_url":"https://api.github.com/repos/google/shaka-player/subscription","commits_url":"https://api.github.com/repos/google/shaka-player/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/shaka-player/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/shaka-player/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/shaka-player/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/shaka-player/contents/{+path}","compare_url":"https://api.github.com/repos/google/shaka-player/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/shaka-player/merges","archive_url":"https://api.github.com/repos/google/shaka-player/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/shaka-player/downloads","issues_url":"https://api.github.com/repos/google/shaka-player/issues{/number}","pulls_url":"https://api.github.com/repos/google/shaka-player/pulls{/number}","milestones_url":"https://api.github.com/repos/google/shaka-player/milestones{/number}","notifications_url":"https://api.github.com/repos/google/shaka-player/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/shaka-player/labels{/name}","releases_url":"https://api.github.com/repos/google/shaka-player/releases{/id}","deployments_url":"https://api.github.com/repos/google/shaka-player/deployments","created_at":"2014-12-19T21:12:18Z","updated_at":"2018-09-25T23:38:58Z","pushed_at":"2018-09-26T07:33:15Z","git_url":"git://github.com/google/shaka-player.git","ssh_url":"git@github.com:google/shaka-player.git","clone_url":"https://github.com/google/shaka-player.git","svn_url":"https://github.com/google/shaka-player","homepage":"","size":103194,"stargazers_count":2401,"watchers_count":2401,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":478,"mirror_url":null,"archived":false,"open_issues_count":187,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":478,"open_issues":187,"watchers":2401,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/shaka-player/pulls/1600"},"html":{"href":"https://github.com/google/shaka-player/pull/1600"},"issue":{"href":"https://api.github.com/repos/google/shaka-player/issues/1600"},"comments":{"href":"https://api.github.com/repos/google/shaka-player/issues/1600/comments"},"review_comments":{"href":"https://api.github.com/repos/google/shaka-player/pulls/1600/comments"},"review_comment":{"href":"https://api.github.com/repos/google/shaka-player/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/shaka-player/pulls/1600/commits"},"statuses":{"href":"https://api.github.com/repos/google/shaka-player/statuses/f2463916d0a5635831faa75183e40d7cbeccede2"}},"author_association":"NONE"}}
{"actor":{"display_login":"bartsidee"}}