browserify-p5: videojs-contrib-hls and bin-utils conversion
removed stub test and stub src files updated build scripts to continue working fixed several linting issues that were previously unnoticed turn the linter back on remove init function from stream added ignore for playlist-loader as it will be finished later
Showing
15 changed files
with
61 additions
and
115 deletions
... | @@ -46,10 +46,7 @@ | ... | @@ -46,10 +46,7 @@ |
46 | </ul> | 46 | </ul> |
47 | 47 | ||
48 | <script src="/node_modules/video.js/dist/video.js"></script> | 48 | <script src="/node_modules/video.js/dist/video.js"></script> |
49 | <script src="/node_modules/videojs-contrib-media-sources/dist/videojs-media-sources.js"></script> | ||
50 | <script src="/src/videojs-contrib-hls.js"></script> | ||
51 | <script src="/dist/videojs-contrib-hls.js"></script> | 49 | <script src="/dist/videojs-contrib-hls.js"></script> |
52 | <script src="/src/bin-utils.js"></script> | ||
53 | <script> | 50 | <script> |
54 | (function(window, videojs) { | 51 | (function(window, videojs) { |
55 | var player = window.player = videojs('videojs-contrib-hls-player'); | 52 | var player = window.player = videojs('videojs-contrib-hls-player'); | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | "name": "videojs-contrib-hls", | 2 | "name": "videojs-contrib-hls", |
3 | "version": "1.3.5", | 3 | "version": "1.3.5", |
4 | "description": "Play back HLS with video.js, even where it's not natively supported", | 4 | "description": "Play back HLS with video.js, even where it's not natively supported", |
5 | "main": "es5/stub.js", | 5 | "main": "es5/videojs-contrib-hls.js", |
6 | "engines": { | 6 | "engines": { |
7 | "node": ">= 0.10.12" | 7 | "node": ">= 0.10.12" |
8 | }, | 8 | }, |
... | @@ -27,7 +27,7 @@ | ... | @@ -27,7 +27,7 @@ |
27 | "docs": "npm-run-all docs:*", | 27 | "docs": "npm-run-all docs:*", |
28 | "docs:api": "jsdoc src -r -d docs/api", | 28 | "docs:api": "jsdoc src -r -d docs/api", |
29 | "docs:toc": "doctoc README.md", | 29 | "docs:toc": "doctoc README.md", |
30 | "lint": "vjsstandard :", | 30 | "lint": "vjsstandard", |
31 | "prestart": "npm-run-all docs build", | 31 | "prestart": "npm-run-all docs build", |
32 | "start": "npm-run-all -p start:* watch:*", | 32 | "start": "npm-run-all -p start:* watch:*", |
33 | "start:serve": "babel-node scripts/server.js", | 33 | "start:serve": "babel-node scripts/server.js", |
... | @@ -40,7 +40,7 @@ | ... | @@ -40,7 +40,7 @@ |
40 | "preversion": "npm test", | 40 | "preversion": "npm test", |
41 | "version": "npm run build", | 41 | "version": "npm run build", |
42 | "watch": "npm-run-all -p watch:*", | 42 | "watch": "npm-run-all -p watch:*", |
43 | "watch:js": "watchify src/stub.js -t babelify -v -o dist/videojs-contrib-hls.js", | 43 | "watch:js": "watchify src/videojs-contrib-hls.js -t babelify -v -o dist/videojs-contrib-hls.js", |
44 | "watch:test": "npm-run-all -p watch:test:*", | 44 | "watch:test": "npm-run-all -p watch:test:*", |
45 | "watch:test:js": "node scripts/watch-test.js", | 45 | "watch:test:js": "node scripts/watch-test.js", |
46 | "watch:test:manifest": "node -e \"var b=require('./scripts/manifest-data.js'); b.watch();\"", | 46 | "watch:test:manifest": "node -e \"var b=require('./scripts/manifest-data.js'); b.watch();\"", |
... | @@ -72,7 +72,8 @@ | ... | @@ -72,7 +72,8 @@ |
72 | "scripts", | 72 | "scripts", |
73 | "utils", | 73 | "utils", |
74 | "test/test-manifests.js", | 74 | "test/test-manifests.js", |
75 | "test/test-expected.js" | 75 | "test/test-expected.js", |
76 | "src/playlist-loader.js" | ||
76 | ] | 77 | ] |
77 | }, | 78 | }, |
78 | "files": [ | 79 | "files": [ | ... | ... |
... | @@ -2,7 +2,7 @@ var browserify = require('browserify'); | ... | @@ -2,7 +2,7 @@ var browserify = require('browserify'); |
2 | var fs = require('fs'); | 2 | var fs = require('fs'); |
3 | var glob = require('glob'); | 3 | var glob = require('glob'); |
4 | 4 | ||
5 | glob('test/{playlist*,decryper,m3u8,stub}.test.js', function(err, files) { | 5 | glob('test/**/*.test.js', function(err, files) { |
6 | browserify(files) | 6 | browserify(files) |
7 | .transform('babelify') | 7 | .transform('babelify') |
8 | .bundle() | 8 | .bundle() | ... | ... |
... | @@ -3,7 +3,7 @@ var fs = require('fs'); | ... | @@ -3,7 +3,7 @@ var fs = require('fs'); |
3 | var glob = require('glob'); | 3 | var glob = require('glob'); |
4 | var watchify = require('watchify'); | 4 | var watchify = require('watchify'); |
5 | 5 | ||
6 | glob('test/{playlist*,decrypter,m3u8,stub}.test.js', function(err, files) { | 6 | glob('test/**/*.test.js', function(err, files) { |
7 | var b = browserify(files, { | 7 | var b = browserify(files, { |
8 | cache: {}, | 8 | cache: {}, |
9 | packageCache: {}, | 9 | packageCache: {}, | ... | ... |
1 | (function(window) { | 1 | const textRange = function(range, i) { |
2 | var textRange = function(range, i) { | 2 | return range.start(i) + '-' + range.end(i); |
3 | return range.start(i) + '-' + range.end(i); | 3 | }; |
4 | }; | 4 | |
5 | var module = { | 5 | const formatHexString = function(e, i) { |
6 | hexDump: function(data) { | 6 | let value = e.toString(16); |
7 | var | 7 | |
8 | bytes = Array.prototype.slice.call(data), | 8 | return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); |
9 | step = 16, | 9 | }; |
10 | formatHexString = function(e, i) { | 10 | const formatAsciiString = function(e) { |
11 | var value = e.toString(16); | 11 | if (e >= 0x20 && e < 0x7e) { |
12 | return "00".substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); | 12 | return String.fromCharCode(e); |
13 | }, | 13 | } |
14 | formatAsciiString = function(e) { | 14 | return '.'; |
15 | if (e >= 0x20 && e < 0x7e) { | 15 | }; |
16 | return String.fromCharCode(e); | 16 | |
17 | } | 17 | const utils = { |
18 | return '.'; | 18 | hexDump(data) { |
19 | }, | 19 | let bytes = Array.prototype.slice.call(data); |
20 | result = '', | 20 | let step = 16; |
21 | hex, | 21 | let result = ''; |
22 | ascii; | 22 | let hex; |
23 | for (var j = 0; j < bytes.length / step; j++) { | 23 | let ascii; |
24 | hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); | 24 | |
25 | ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); | 25 | for (let j = 0; j < bytes.length / step; j++) { |
26 | result += hex + ' ' + ascii + '\n'; | 26 | hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); |
27 | } | 27 | ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); |
28 | return result; | 28 | result += hex + ' ' + ascii + '\n'; |
29 | }, | 29 | } |
30 | tagDump: function(tag) { | 30 | return result; |
31 | return module.hexDump(tag.bytes); | 31 | }, |
32 | }, | 32 | tagDump(tag) { |
33 | textRanges: function(ranges) { | 33 | return utils.hexDump(tag.bytes); |
34 | var result = '', i; | 34 | }, |
35 | for (i = 0; i < ranges.length; i++) { | 35 | textRanges(ranges) { |
36 | result += textRange(ranges, i) + ' '; | 36 | let result = ''; |
37 | } | 37 | let i; |
38 | return result; | 38 | |
39 | for (i = 0; i < ranges.length; i++) { | ||
40 | result += textRange(ranges, i) + ' '; | ||
39 | } | 41 | } |
40 | }; | 42 | return result; |
43 | } | ||
44 | }; | ||
41 | 45 | ||
42 | window.videojs.Hls.utils = module; | 46 | export default utils; |
43 | })(this); | ... | ... |
... | @@ -89,10 +89,9 @@ const precompute = function() { | ... | @@ -89,10 +89,9 @@ const precompute = function() { |
89 | decTable[i] = decTable[i].slice(0); | 89 | decTable[i] = decTable[i].slice(0); |
90 | } | 90 | } |
91 | return tables; | 91 | return tables; |
92 | } | 92 | }; |
93 | |||
94 | |||
95 | let aesTables = null; | 93 | let aesTables = null; |
94 | |||
96 | /** | 95 | /** |
97 | * Schedule out an AES key for both encryption and decryption. This | 96 | * Schedule out an AES key for both encryption and decryption. This |
98 | * is a low-level class. Use a cipher mode to do bulk encryption. | 97 | * is a low-level class. Use a cipher mode to do bulk encryption. |
... | @@ -116,7 +115,7 @@ export default class AES { | ... | @@ -116,7 +115,7 @@ export default class AES { |
116 | */ | 115 | */ |
117 | // if we have yet to precompute the S-box tables | 116 | // if we have yet to precompute the S-box tables |
118 | // do so now | 117 | // do so now |
119 | if(!aesTables) { | 118 | if (!aesTables) { |
120 | aesTables = precompute(); | 119 | aesTables = precompute(); |
121 | } | 120 | } |
122 | // then make a copy of that object for use | 121 | // then make a copy of that object for use | ... | ... |
1 | /** | 1 | /** |
2 | * A lightweight readable stream implemention that handles event dispatching. | 2 | * A lightweight readable stream implemention that handles event dispatching. |
3 | * Objects that inherit from streams should call init in their constructors. | ||
4 | */ | 3 | */ |
5 | export default class Stream { | 4 | export default class Stream { |
6 | constructor() { | 5 | constructor() { |
7 | this.init(); | ||
8 | } | ||
9 | |||
10 | init() { | ||
11 | this.listeners = {}; | 6 | this.listeners = {}; |
12 | } | 7 | } |
13 | 8 | ... | ... |
src/stub.js
deleted
100644 → 0
1 | import m3u8 from './m3u8'; | ||
2 | import Stream from './stream'; | ||
3 | import videojs from 'video.js'; | ||
4 | import {Decrypter, decrypt, AsyncStream} from './decrypter'; | ||
5 | import Playlist from './playlist'; | ||
6 | import PlaylistLoader from './playlist-loader'; | ||
7 | import xhr from './xhr'; | ||
8 | |||
9 | |||
10 | if(typeof window.videojs.Hls === 'undefined') { | ||
11 | videojs.Hls = {}; | ||
12 | } | ||
13 | videojs.Hls.Stream = Stream; | ||
14 | videojs.m3u8 = m3u8; | ||
15 | videojs.Hls.decrypt = decrypt; | ||
16 | videojs.Hls.Decrypter = Decrypter; | ||
17 | videojs.Hls.AsyncStream = AsyncStream; | ||
18 | videojs.Hls.xhr = xhr; | ||
19 | videojs.Hls.Playlist = Playlist; | ||
20 | videojs.Hls.PlaylistLoader = PlaylistLoader; |
This diff is collapsed.
Click to expand it.
... | @@ -90,7 +90,6 @@ function() { | ... | @@ -90,7 +90,6 @@ function() { |
90 | 90 | ||
91 | }); | 91 | }); |
92 | 92 | ||
93 | |||
94 | QUnit.module('Incremental Processing', { | 93 | QUnit.module('Incremental Processing', { |
95 | beforeEach() { | 94 | beforeEach() { |
96 | this.clock = sinon.useFakeTimers(); | 95 | this.clock = sinon.useFakeTimers(); | ... | ... |
... | @@ -13,13 +13,6 @@ | ... | @@ -13,13 +13,6 @@ |
13 | <script src="/node_modules/sinon/pkg/sinon.js"></script> | 13 | <script src="/node_modules/sinon/pkg/sinon.js"></script> |
14 | <script src="/node_modules/qunitjs/qunit/qunit.js"></script> | 14 | <script src="/node_modules/qunitjs/qunit/qunit.js"></script> |
15 | <script src="/node_modules/video.js/dist/video.js"></script> | 15 | <script src="/node_modules/video.js/dist/video.js"></script> |
16 | <script src="/node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js"></script> | ||
17 | |||
18 | <script src="/src/videojs-contrib-hls.js"></script> | ||
19 | <script src="/dist/videojs-contrib-hls.js"></script> | ||
20 | <script src="/src/bin-utils.js"></script> | ||
21 | |||
22 | <script src="/test/videojs-contrib-hls.test.js"></script> | ||
23 | <script src="/dist-test/videojs-contrib-hls.js"></script> | 16 | <script src="/dist-test/videojs-contrib-hls.js"></script> |
24 | 17 | ||
25 | </body> | 18 | </body> | ... | ... |
... | @@ -11,29 +11,11 @@ var DEFAULTS = { | ... | @@ -11,29 +11,11 @@ var DEFAULTS = { |
11 | 'node_modules/video.js/dist/video.js', | 11 | 'node_modules/video.js/dist/video.js', |
12 | 'node_modules/video.js/dist/video-js.css', | 12 | 'node_modules/video.js/dist/video-js.css', |
13 | 13 | ||
14 | // REMOVE ME WHEN BROWSERIFIED | 14 | 'test/**/*.test.js' |
15 | 'node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js', | ||
16 | |||
17 | // these two stub old functionality | ||
18 | 'src/videojs-contrib-hls.js', | ||
19 | 'dist/videojs-contrib-hls.js', | ||
20 | |||
21 | 'src/bin-utils.js', | ||
22 | |||
23 | 'test/stub.test.js', | ||
24 | |||
25 | 'test/videojs-contrib-hls.test.js', | ||
26 | 'test/m3u8.test.js', | ||
27 | 'test/playlist.test.js', | ||
28 | 'test/playlist-loader.test.js', | ||
29 | 'test/decrypter.test.js', | ||
30 | // END REMOVE ME | ||
31 | // 'test/**/*.js' | ||
32 | ], | 15 | ], |
33 | 16 | ||
34 | exclude: [ | 17 | exclude: [ |
35 | 'test/bundle.js', | 18 | 'test/data/**' |
36 | // 'test/data/**' | ||
37 | ], | 19 | ], |
38 | 20 | ||
39 | plugins: [ | 21 | plugins: [ |
... | @@ -42,7 +24,7 @@ var DEFAULTS = { | ... | @@ -42,7 +24,7 @@ var DEFAULTS = { |
42 | ], | 24 | ], |
43 | 25 | ||
44 | preprocessors: { | 26 | preprocessors: { |
45 | 'test/{playlist*,decrypter,stub,m3u8}.test.js': ['browserify'] | 27 | 'test/**/*.test.js': ['browserify'] |
46 | }, | 28 | }, |
47 | 29 | ||
48 | reporters: ['dots'], | 30 | reporters: ['dots'], | ... | ... |
... | @@ -29,9 +29,11 @@ QUnit.test('the environment is sane', function(assert) { | ... | @@ -29,9 +29,11 @@ QUnit.test('the environment is sane', function(assert) { |
29 | assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists'); | 29 | assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists'); |
30 | assert.strictEqual(typeof sinon, 'object', 'sinon exists'); | 30 | assert.strictEqual(typeof sinon, 'object', 'sinon exists'); |
31 | assert.strictEqual(typeof videojs, 'function', 'videojs exists'); | 31 | assert.strictEqual(typeof videojs, 'function', 'videojs exists'); |
32 | assert.strictEqual(typeof videojs.MediaSource, 'object', 'MediaSource is an object'); | 32 | assert.strictEqual(typeof videojs.MediaSource, 'function', 'MediaSource is an object'); |
33 | assert.strictEqual(typeof videojs.URL, 'object', 'URL is an object'); | 33 | assert.strictEqual(typeof videojs.URL, 'object', 'URL is an object'); |
34 | assert.strictEqual(typeof videojs.Hls, 'object', 'Hls is an object'); | 34 | assert.strictEqual(typeof videojs.Hls, 'object', 'Hls is an object'); |
35 | assert.strictEqual(typeof videojs.HlsSourceHandler,'function', 'HlsSourceHandler is a function'); | 35 | assert.strictEqual(typeof videojs.HlsSourceHandler, |
36 | 'function', | ||
37 | 'HlsSourceHandler is a function'); | ||
36 | assert.strictEqual(typeof videojs.HlsHandler, 'function', 'HlsHandler is a function'); | 38 | assert.strictEqual(typeof videojs.HlsHandler, 'function', 'HlsHandler is a function'); |
37 | }); | 39 | }); | ... | ... |
test/stub.test.js
deleted
100644 → 0
This diff could not be displayed because it is too large.
-
Please register or sign in to post a comment