Skip to content

Commit

Permalink
use webpack umd deps manager
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbar42 committed May 1, 2017
1 parent 58233ca commit 8241097
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Plays HLS with [video.js](https://github.com/videojs/video.js) on any platform,
This bundled plugin is an **alternative** to the original [videojs-contrib-hls](https://github.com/videojs/videojs-contrib-hls) and runs directly on top of [video.js 5.0+](https://github.com/videojs/video.js).

Like the original implementation, this plugin implements a source handler for m3u8 files.
`hls.js` is bundled inside and there is no need to include it in addition.

## Installation
### NPM
Expand Down
2 changes: 1 addition & 1 deletion dist/videojs-contrib-hlsjs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/videojs-contrib-hlsjs.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- increase browser support with MSE polyfill -->
<script src="http://unpkg.com/videojs-contrib-media-sources@4.4.4/dist/videojs-contrib-media-sources.min.js"></script>

<script src="../dist/videojs-contrib-hlsjs.js"></script>
<script src="../dist/videojs-contrib-hlsjs.min.js"></script>
</head>
<body>
<video id="player" class="video-js vjs-default-skin" height="360" width="640" controls preload="none">
Expand All @@ -20,4 +20,4 @@
var player = videojs('#player');
</script>
</body>
</html>
</html>
10 changes: 1 addition & 9 deletions src/videojs5.hlsjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,7 @@ var HlsSourceHandler = {
};

if (Hls.isSupported()) {
var videojs = window.videojs;
if (!videojs) {
try {
videojs = require('video.js');
}
catch (e) {
// ignore
}
}
var videojs = require('video.js'); // resolved UMD-wise through webpack

if (videojs) {
videojs.getComponent('Html5').registerSourceHandler(HlsSourceHandler, 0);
Expand Down
24 changes: 15 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
'use strict';

module.exports = {
entry: __dirname + '/src/videojs5.hlsjs',
devtool: 'source-map',
output: {
path: __dirname + '/dist',
filename: 'videojs-contrib-hlsjs.min.js'
},
externals: [{
'video\.js': 'commonjs video.js'
}]
entry: __dirname + '/src/videojs5.hlsjs',
devtool: 'source-map',
output: {
path: __dirname + '/dist',
filename: 'videojs-contrib-hlsjs.min.js',
libraryTarget: 'umd'
},
externals: {
'video\.js': {
commonjs: 'video.js',
commonjs2: 'video.js',
amd: 'video.js',
root: 'videojs'
}
}
};

0 comments on commit 8241097

Please sign in to comment.