Skip to content

Don't pollute global namespace with internal dependencies

Vinay Rosenberg requested to merge github/fork/niklasvh/development into development

Created by: niklasvh

Thanks for the great dash library! Was a breeze to setup apart from a few minor details:

Currently the dash.js library requires you to have ISOBoxer, ObjectIron and X2JS in your global namespace. They also require the build step to perform concatenation to the browserified module. This pull request changes the ISOBoxer into an npm dependency (https://www.npmjs.com/package/codem-isoboxer) and changes the externals/ObjectIron and externals/X2JS into CommonJS modules. Ideally, if they really are "external" modules, they would also be imported as npm modules from their corresponding codebases.

This change reduces the global namespace polluting of those 3 modules, and allows you to import the dash.js library as an npm module into your own project without the need for a grunt build step, i.e:

$ git submodule add git@github.com:niklasvh/dash.js.git dash

And in your custom-player-whatever.js you can simply do:

import MediaPlayer from './dash/src/streaming/MediaPlayer';
const mediaPlayer = MediaPlayer().create();
mediaPlayer.initialize(document.querySelector("#videoPlayer"), url, true);

It would be great if you could simply use the dash.js library as npm dependency directly as well, either through npm or as a npm git dependency.

Merge request reports