{"action":"closed","issue":{"url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/issues/866","repository_url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js","labels_url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/issues/866/labels{/name}","comments_url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/issues/866/comments","events_url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/issues/866/events","html_url":"https://github.com/Dash-Industry-Forum/dash.js/issues/866","id":114017692,"number":866,"title":"btoa and atob declarations break native browser implementations for other libraries","user":{"login":"thomaspeeters","id":4222888,"avatar_url":"https://avatars.githubusercontent.com/u/4222888?v=3","gravatar_id":"","url":"https://api.github.com/users/thomaspeeters","html_url":"https://github.com/thomaspeeters","followers_url":"https://api.github.com/users/thomaspeeters/followers","following_url":"https://api.github.com/users/thomaspeeters/following{/other_user}","gists_url":"https://api.github.com/users/thomaspeeters/gists{/gist_id}","starred_url":"https://api.github.com/users/thomaspeeters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomaspeeters/subscriptions","organizations_url":"https://api.github.com/users/thomaspeeters/orgs","repos_url":"https://api.github.com/users/thomaspeeters/repos","events_url":"https://api.github.com/users/thomaspeeters/events{/privacy}","received_events_url":"https://api.github.com/users/thomaspeeters/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/labels/Pri-Critical","name":"Pri-Critical","color":"ff0000"}],"state":"closed","locked":false,"assignee":{"login":"AkamaiDASH","id":7864462,"avatar_url":"https://avatars.githubusercontent.com/u/7864462?v=3","gravatar_id":"","url":"https://api.github.com/users/AkamaiDASH","html_url":"https://github.com/AkamaiDASH","followers_url":"https://api.github.com/users/AkamaiDASH/followers","following_url":"https://api.github.com/users/AkamaiDASH/following{/other_user}","gists_url":"https://api.github.com/users/AkamaiDASH/gists{/gist_id}","starred_url":"https://api.github.com/users/AkamaiDASH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AkamaiDASH/subscriptions","organizations_url":"https://api.github.com/users/AkamaiDASH/orgs","repos_url":"https://api.github.com/users/AkamaiDASH/repos","events_url":"https://api.github.com/users/AkamaiDASH/events{/privacy}","received_events_url":"https://api.github.com/users/AkamaiDASH/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/milestones/9","html_url":"https://github.com/Dash-Industry-Forum/dash.js/milestones/2.1.0","labels_url":"https://api.github.com/repos/Dash-Industry-Forum/dash.js/milestones/9/labels","id":1542711,"number":9,"title":"2.1.0","description":"","creator":{"login":"AkamaiDASH","id":7864462,"avatar_url":"https://avatars.githubusercontent.com/u/7864462?v=3","gravatar_id":"","url":"https://api.github.com/users/AkamaiDASH","html_url":"https://github.com/AkamaiDASH","followers_url":"https://api.github.com/users/AkamaiDASH/followers","following_url":"https://api.github.com/users/AkamaiDASH/following{/other_user}","gists_url":"https://api.github.com/users/AkamaiDASH/gists{/gist_id}","starred_url":"https://api.github.com/users/AkamaiDASH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AkamaiDASH/subscriptions","organizations_url":"https://api.github.com/users/AkamaiDASH/orgs","repos_url":"https://api.github.com/users/AkamaiDASH/repos","events_url":"https://api.github.com/users/AkamaiDASH/events{/privacy}","received_events_url":"https://api.github.com/users/AkamaiDASH/received_events","type":"User","site_admin":false},"open_issues":26,"closed_issues":15,"state":"open","created_at":"2016-01-25T21:35:48Z","updated_at":"2016-03-03T23:06:55Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2015-10-29T10:08:35Z","updated_at":"2016-03-03T23:06:55Z","closed_at":"2016-03-03T23:06:55Z","body":"I'm currently trying to set up a video.js player using dash.js, videojs-contrib-dash and videojs-contrib-hls.\r\n\r\nvideojs-contrib-hls uses `window.btoa` several times and it seems this part of dash.debug.js overrides this native implementation of `btoa`. \r\n\r\n```javascript\r\nif (undefined === btoa) {\r\n    var btoa = BASE64.encode;\r\n}\r\n\r\nif (undefined === atob) {\r\n    var atob = BASE64.decode;\r\n}\r\n```\r\n\r\nThis isn't a problem in Firefox and Chrome, but breaks playback of HLS streams in IE (tested in IE11 on Win7).\r\n\r\nI did some testing and following changes fix the problem:\r\n\r\n* Removing the `var` keyword\r\n```javascript\r\nif (undefined === btoa) {\r\n    btoa = BASE64.encode;\r\n}\r\n\r\nif (undefined === atob) {\r\n    atob = BASE64.decode;\r\n}\r\n```\r\n\r\n* Changing to `encodeASCII` and `decodeASCII` as per #419 \r\n```javascript\r\nif (undefined === btoa) {\r\n    var btoa = BASE64.encodeASCII;\r\n}\r\n\r\nif (undefined === atob) {\r\n    var atob = BASE64.decodeASCII;\r\n}\r\n```\r\n\r\n* Or just removing the declarations altogether, because they don't seem to be used anywhere anymore. See commit fabeba33fc86dabb9c600652b65c2746361f5560 where all references to `btoa` and `atob` seem to have been removed."}}