{"action":"created","comment":{"url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/comments/59432475","id":59432475,"diff_hunk":"@@ -134,27 +134,73 @@ export default class HlsHandler extends Component {\n       this.tech_.audioTracks().addEventListener('change', this.audioTrackChange_);\n     });\n \n-    this.masterPlaylistController_.on('selectedinitialmedia', () => {\n+    this.masterPlaylistController_.on('audioinfochanged', (e) => {\n+      if (!videojs.browser.IS_FIREFOX) {\n+        return;\n+      }\n       let audioTrackList = this.tech_.audioTracks();\n-      let media = this.masterPlaylistController_.media();\n-      let master = this.masterPlaylistController_.master();\n-      let mediaGroups = master.mediaGroups;\n-      let attributes = {\n-        audio: {main: {default: true}}\n-      };\n-\n-      if (!media.attributes) {\n-        // source URL was playlist manifest, not master\n-        // no audio tracks to add\n+      let error = 'had different audio properties (channels, sample rate, etc.) ' +\n+                  'or changed in some other way.  This behavior is currently ' +\n+                  'unsupported in Firefox due to an issue: \\n\\n' +\n+                  'https://bugzilla.mozilla.org/show_bug.cgi?id=1247138\\n\\n';\n+\n+      let attributes = this.masterPlaylistController_.getPlaylistAttributes_();\n+      let mainLabel;\n+\n+      for (let label in attributes.audio) {\n+        let hlstrack = attributes.audio[label];\n+\n+        /* eslint-disable dot-notation */\n+        // dot notation used on the key default to support ie8\n+        if (hlstrack['default']) {\n+          mainLabel = label;\n+          break;\n+        }\n+        /* eslint-enable dot-notation */\n+      }\n+\n+      let trackToRemove;\n+      let mainTrack;\n+\n+      for (let i = 0; i < audioTrackList.length; i++) {\n+        let track = audioTrackList[i];\n+\n+        if (track.enabled) {\n+          trackToRemove = track;\n+        } else if (track.label === mainLabel) {","path":"src/videojs-contrib-hls.js","position":48,"original_position":48,"commit_id":"5e90bc8fe22034651c6591dfc7e779ae97acdc9c","original_commit_id":"5e90bc8fe22034651c6591dfc7e779ae97acdc9c","user":{"login":"gesinger","id":356726,"avatar_url":"https://avatars.githubusercontent.com/u/356726?v=3","gravatar_id":"","url":"https://api.github.com/users/gesinger","html_url":"https://github.com/gesinger","followers_url":"https://api.github.com/users/gesinger/followers","following_url":"https://api.github.com/users/gesinger/following{/other_user}","gists_url":"https://api.github.com/users/gesinger/gists{/gist_id}","starred_url":"https://api.github.com/users/gesinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gesinger/subscriptions","organizations_url":"https://api.github.com/users/gesinger/orgs","repos_url":"https://api.github.com/users/gesinger/repos","events_url":"https://api.github.com/users/gesinger/events{/privacy}","received_events_url":"https://api.github.com/users/gesinger/received_events","type":"User","site_admin":false},"body":"Nevermind, I noticed the guard below. Looks safe!","created_at":"2016-04-12T18:51:08Z","updated_at":"2016-04-12T18:51:08Z","html_url":"https://github.com/videojs/videojs-contrib-hls/pull/641#discussion_r59432475","pull_request_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641","_links":{"self":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/comments/59432475"},"html":{"href":"https://github.com/videojs/videojs-contrib-hls/pull/641#discussion_r59432475"},"pull_request":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641"}}},"pull_request":{"url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641","id":65363742,"html_url":"https://github.com/videojs/videojs-contrib-hls/pull/641","diff_url":"https://github.com/videojs/videojs-contrib-hls/pull/641.diff","patch_url":"https://github.com/videojs/videojs-contrib-hls/pull/641.patch","issue_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/641","number":641,"state":"open","locked":false,"title":"Workaround for the firefox audio sample/channel change crash","user":{"login":"BrandonOCasey","id":2381475,"avatar_url":"https://avatars.githubusercontent.com/u/2381475?v=3","gravatar_id":"","url":"https://api.github.com/users/BrandonOCasey","html_url":"https://github.com/BrandonOCasey","followers_url":"https://api.github.com/users/BrandonOCasey/followers","following_url":"https://api.github.com/users/BrandonOCasey/following{/other_user}","gists_url":"https://api.github.com/users/BrandonOCasey/gists{/gist_id}","starred_url":"https://api.github.com/users/BrandonOCasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrandonOCasey/subscriptions","organizations_url":"https://api.github.com/users/BrandonOCasey/orgs","repos_url":"https://api.github.com/users/BrandonOCasey/repos","events_url":"https://api.github.com/users/BrandonOCasey/events{/privacy}","received_events_url":"https://api.github.com/users/BrandonOCasey/received_events","type":"User","site_admin":false},"body":"MPC re-emits audiotrackchanged and HLS picks it up\r\nunify the interface to get parsed playlist attributes in MPC","created_at":"2016-04-05T19:51:16Z","updated_at":"2016-04-12T18:51:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d818dc4a1bf6868c40a1caf8b134041fe49d62f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641/commits","review_comments_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641/comments","review_comment_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/641/comments","statuses_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/statuses/5e90bc8fe22034651c6591dfc7e779ae97acdc9c","head":{"label":"BrandonOCasey:fix/ff-audio-change-crash","ref":"fix/ff-audio-change-crash","sha":"5e90bc8fe22034651c6591dfc7e779ae97acdc9c","user":{"login":"BrandonOCasey","id":2381475,"avatar_url":"https://avatars.githubusercontent.com/u/2381475?v=3","gravatar_id":"","url":"https://api.github.com/users/BrandonOCasey","html_url":"https://github.com/BrandonOCasey","followers_url":"https://api.github.com/users/BrandonOCasey/followers","following_url":"https://api.github.com/users/BrandonOCasey/following{/other_user}","gists_url":"https://api.github.com/users/BrandonOCasey/gists{/gist_id}","starred_url":"https://api.github.com/users/BrandonOCasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrandonOCasey/subscriptions","organizations_url":"https://api.github.com/users/BrandonOCasey/orgs","repos_url":"https://api.github.com/users/BrandonOCasey/repos","events_url":"https://api.github.com/users/BrandonOCasey/events{/privacy}","received_events_url":"https://api.github.com/users/BrandonOCasey/received_events","type":"User","site_admin":false},"repo":{"id":49234533,"name":"videojs-contrib-hls","full_name":"BrandonOCasey/videojs-contrib-hls","owner":{"login":"BrandonOCasey","id":2381475,"avatar_url":"https://avatars.githubusercontent.com/u/2381475?v=3","gravatar_id":"","url":"https://api.github.com/users/BrandonOCasey","html_url":"https://github.com/BrandonOCasey","followers_url":"https://api.github.com/users/BrandonOCasey/followers","following_url":"https://api.github.com/users/BrandonOCasey/following{/other_user}","gists_url":"https://api.github.com/users/BrandonOCasey/gists{/gist_id}","starred_url":"https://api.github.com/users/BrandonOCasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrandonOCasey/subscriptions","organizations_url":"https://api.github.com/users/BrandonOCasey/orgs","repos_url":"https://api.github.com/users/BrandonOCasey/repos","events_url":"https://api.github.com/users/BrandonOCasey/events{/privacy}","received_events_url":"https://api.github.com/users/BrandonOCasey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BrandonOCasey/videojs-contrib-hls","description":"HLS library for video.js","fork":true,"url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls","forks_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/forks","keys_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/teams","hooks_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/hooks","issue_events_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/issues/events{/number}","events_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/events","assignees_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/assignees{/user}","branches_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/branches{/branch}","tags_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/tags","blobs_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/statuses/{sha}","languages_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/languages","stargazers_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/stargazers","contributors_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/contributors","subscribers_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/subscribers","subscription_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/subscription","commits_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/contents/{+path}","compare_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/merges","archive_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/downloads","issues_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/issues{/number}","pulls_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/pulls{/number}","milestones_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/milestones{/number}","notifications_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/labels{/name}","releases_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/releases{/id}","deployments_url":"https://api.github.com/repos/BrandonOCasey/videojs-contrib-hls/deployments","created_at":"2016-01-07T22:24:59Z","updated_at":"2016-01-20T18:12:37Z","pushed_at":"2016-04-11T21:15:51Z","git_url":"git://github.com/BrandonOCasey/videojs-contrib-hls.git","ssh_url":"git@github.com:BrandonOCasey/videojs-contrib-hls.git","clone_url":"https://github.com/BrandonOCasey/videojs-contrib-hls.git","svn_url":"https://github.com/BrandonOCasey/videojs-contrib-hls","homepage":"http://videojs.github.io/videojs-contrib-hls/","size":14784,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"videojs:development","ref":"development","sha":"4c453764b2b4b3bb34668cace14755fef243d3d5","user":{"login":"videojs","id":3287189,"avatar_url":"https://avatars.githubusercontent.com/u/3287189?v=3","gravatar_id":"","url":"https://api.github.com/users/videojs","html_url":"https://github.com/videojs","followers_url":"https://api.github.com/users/videojs/followers","following_url":"https://api.github.com/users/videojs/following{/other_user}","gists_url":"https://api.github.com/users/videojs/gists{/gist_id}","starred_url":"https://api.github.com/users/videojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/videojs/subscriptions","organizations_url":"https://api.github.com/users/videojs/orgs","repos_url":"https://api.github.com/users/videojs/repos","events_url":"https://api.github.com/users/videojs/events{/privacy}","received_events_url":"https://api.github.com/users/videojs/received_events","type":"Organization","site_admin":false},"repo":{"id":14029328,"name":"videojs-contrib-hls","full_name":"videojs/videojs-contrib-hls","owner":{"login":"videojs","id":3287189,"avatar_url":"https://avatars.githubusercontent.com/u/3287189?v=3","gravatar_id":"","url":"https://api.github.com/users/videojs","html_url":"https://github.com/videojs","followers_url":"https://api.github.com/users/videojs/followers","following_url":"https://api.github.com/users/videojs/following{/other_user}","gists_url":"https://api.github.com/users/videojs/gists{/gist_id}","starred_url":"https://api.github.com/users/videojs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/videojs/subscriptions","organizations_url":"https://api.github.com/users/videojs/orgs","repos_url":"https://api.github.com/users/videojs/repos","events_url":"https://api.github.com/users/videojs/events{/privacy}","received_events_url":"https://api.github.com/users/videojs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/videojs/videojs-contrib-hls","description":"HLS library for video.js","fork":false,"url":"https://api.github.com/repos/videojs/videojs-contrib-hls","forks_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/forks","keys_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/teams","hooks_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/hooks","issue_events_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/events{/number}","events_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/events","assignees_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/assignees{/user}","branches_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/branches{/branch}","tags_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/tags","blobs_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/git/refs{/sha}","trees_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/statuses/{sha}","languages_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/languages","stargazers_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/stargazers","contributors_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/contributors","subscribers_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/subscribers","subscription_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/subscription","commits_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/commits{/sha}","git_commits_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/git/commits{/sha}","comments_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/comments{/number}","issue_comment_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/comments{/number}","contents_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/contents/{+path}","compare_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/merges","archive_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/downloads","issues_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues{/number}","pulls_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls{/number}","milestones_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/milestones{/number}","notifications_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/labels{/name}","releases_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/releases{/id}","deployments_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/deployments","created_at":"2013-10-31T21:55:21Z","updated_at":"2016-04-12T15:52:51Z","pushed_at":"2016-04-11T21:18:17Z","git_url":"git://github.com/videojs/videojs-contrib-hls.git","ssh_url":"git@github.com:videojs/videojs-contrib-hls.git","clone_url":"https://github.com/videojs/videojs-contrib-hls.git","svn_url":"https://github.com/videojs/videojs-contrib-hls","homepage":"http://videojs.github.io/videojs-contrib-hls/","size":23913,"stargazers_count":541,"watchers_count":541,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":281,"mirror_url":null,"open_issues_count":128,"forks":281,"open_issues":128,"watchers":541,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641"},"html":{"href":"https://github.com/videojs/videojs-contrib-hls/pull/641"},"issue":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/641"},"comments":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/641/comments"},"review_comments":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641/comments"},"review_comment":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/pulls/641/commits"},"statuses":{"href":"https://api.github.com/repos/videojs/videojs-contrib-hls/statuses/5e90bc8fe22034651c6591dfc7e779ae97acdc9c"}}}}