Merge pull request #568 from videojs/browserify-p5
Browserify p5
Showing
16 changed files
with
55 additions
and
109 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": [ |
... | @@ -88,10 +89,10 @@ | ... | @@ -88,10 +89,10 @@ |
88 | "utils/" | 89 | "utils/" |
89 | ], | 90 | ], |
90 | "dependencies": { | 91 | "dependencies": { |
91 | "pkcs7": "^0.2.3", | 92 | "pkcs7": "^0.2.2", |
92 | "video.js": "^5.0.0", | 93 | "video.js": "^5.2.1", |
93 | "videojs-contrib-media-sources": "^2.4.4", | 94 | "videojs-contrib-media-sources": "^3.0.0", |
94 | "videojs-swf": "^5.0.1" | 95 | "videojs-swf": "^5.0.0" |
95 | }, | 96 | }, |
96 | "devDependencies": { | 97 | "devDependencies": { |
97 | "babel": "^5.8.0", | 98 | "babel": "^5.8.0", |
... | @@ -117,12 +118,13 @@ | ... | @@ -117,12 +118,13 @@ |
117 | "minimist": "^1.2.0", | 118 | "minimist": "^1.2.0", |
118 | "npm-run-all": "^1.2.0", | 119 | "npm-run-all": "^1.2.0", |
119 | "portscanner": "^1.0.0", | 120 | "portscanner": "^1.0.0", |
120 | "qunitjs": "^1.0.0", | 121 | "qunitjs": "^1.18.0", |
121 | "serve-static": "^1.10.0", | 122 | "serve-static": "^1.10.0", |
122 | "shelljs": "^0.5.3", | 123 | "shelljs": "^0.5.3", |
123 | "sinon": "1.10.2", | 124 | "sinon": "1.10.2", |
124 | "uglify-js": "^2.5.0", | 125 | "uglify-js": "^2.5.0", |
125 | "videojs-standard": "^4.0.0", | 126 | "videojs-standard": "^4.0.0", |
126 | "watchify": "^3.6.0" | 127 | "watchify": "^3.6.0", |
128 | "webworkify": "^1.1.0" | ||
127 | } | 129 | } |
128 | } | 130 | } | ... | ... |
... | @@ -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) { | ||
3 | return range.start(i) + '-' + range.end(i); | 2 | return range.start(i) + '-' + range.end(i); |
4 | }; | 3 | }; |
5 | var module = { | 4 | |
6 | hexDump: function(data) { | 5 | const formatHexString = function(e, i) { |
7 | var | 6 | let value = e.toString(16); |
8 | bytes = Array.prototype.slice.call(data), | 7 | |
9 | step = 16, | 8 | return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); |
10 | formatHexString = function(e, i) { | 9 | }; |
11 | var value = e.toString(16); | 10 | const formatAsciiString = function(e) { |
12 | return "00".substring(0, 2 - value.length) + value + (i % 2 ? ' ' : ''); | ||
13 | }, | ||
14 | formatAsciiString = function(e) { | ||
15 | if (e >= 0x20 && e < 0x7e) { | 11 | if (e >= 0x20 && e < 0x7e) { |
16 | return String.fromCharCode(e); | 12 | return String.fromCharCode(e); |
17 | } | 13 | } |
18 | return '.'; | 14 | return '.'; |
19 | }, | 15 | }; |
20 | result = '', | 16 | |
21 | hex, | 17 | const utils = { |
22 | ascii; | 18 | hexDump(data) { |
23 | for (var j = 0; j < bytes.length / step; j++) { | 19 | let bytes = Array.prototype.slice.call(data); |
20 | let step = 16; | ||
21 | let result = ''; | ||
22 | let hex; | ||
23 | let ascii; | ||
24 | |||
25 | for (let j = 0; j < bytes.length / step; j++) { | ||
24 | hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); | 26 | hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(''); |
25 | ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); | 27 | ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); |
26 | result += hex + ' ' + ascii + '\n'; | 28 | result += hex + ' ' + ascii + '\n'; |
27 | } | 29 | } |
28 | return result; | 30 | return result; |
29 | }, | 31 | }, |
30 | tagDump: function(tag) { | 32 | tagDump(tag) { |
31 | return module.hexDump(tag.bytes); | 33 | return utils.hexDump(tag.bytes); |
32 | }, | 34 | }, |
33 | textRanges: function(ranges) { | 35 | textRanges(ranges) { |
34 | var result = '', i; | 36 | let result = ''; |
37 | let i; | ||
38 | |||
35 | for (i = 0; i < ranges.length; i++) { | 39 | for (i = 0; i < ranges.length; i++) { |
36 | result += textRange(ranges, i) + ' '; | 40 | result += textRange(ranges, i) + ' '; |
37 | } | 41 | } |
38 | return result; | 42 | return result; |
39 | } | 43 | } |
40 | }; | 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