@cycjimmy/jsmpeg-player 5.1.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +1 -1
- package/dist/{jsmpeg-player.cjs.js → jsmpeg-player.cjs} +12 -8
- package/dist/jsmpeg-player.esm.js +12 -8
- package/dist/jsmpeg-player.umd.js +12 -8
- package/package.json +7 -41
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2017 cycjimmy
|
|
3
|
+
Copyright (c) 2017-2022 cycjimmy
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ new JSMpeg.VideoElement(videoWrapper, videoUrl [, options] [, overlayOptions])
|
|
|
81
81
|
## CDN
|
|
82
82
|
To use via a CDN include this in your HTML:
|
|
83
83
|
```text
|
|
84
|
-
<script src="https://cdn.jsdelivr.net/npm/@cycjimmy/jsmpeg-player@
|
|
84
|
+
<script src="https://cdn.jsdelivr.net/npm/@cycjimmy/jsmpeg-player@6/dist/jsmpeg-player.umd.min.js"></script>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
## Encoding Video/Audio for [jsmpeg](https://github.com/phoboslab/jsmpeg) by [ffmpeg](https://ffmpeg.org/). E.g:
|
|
@@ -643,8 +643,7 @@ var WSSource = /*#__PURE__*/function () {
|
|
|
643
643
|
data: []
|
|
644
644
|
};
|
|
645
645
|
this.destination = null;
|
|
646
|
-
this.reconnectInterval =
|
|
647
|
-
options.reconnectInterval !== undefined ? options.reconnectInterval : 5;
|
|
646
|
+
this.reconnectInterval = options.reconnectInterval !== undefined ? options.reconnectInterval : 5;
|
|
648
647
|
this.shouldAttemptReconnect = !!this.reconnectInterval;
|
|
649
648
|
this.completed = false;
|
|
650
649
|
this.established = false;
|
|
@@ -760,7 +759,9 @@ var BitBuffer = /*#__PURE__*/function () {
|
|
|
760
759
|
this.byteLength = 0;
|
|
761
760
|
this.index = 0;
|
|
762
761
|
return;
|
|
763
|
-
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
if (bytePos === 0) {
|
|
764
765
|
// Nothing read yet - we can't evict anything
|
|
765
766
|
return;
|
|
766
767
|
} // Some browsers don't support copyWithin() yet - we may have to do
|
|
@@ -873,6 +874,7 @@ var BitBuffer = /*#__PURE__*/function () {
|
|
|
873
874
|
};
|
|
874
875
|
|
|
875
876
|
_proto.skip = function skip(count) {
|
|
877
|
+
// eslint-disable-next-line no-return-assign
|
|
876
878
|
return this.index += count;
|
|
877
879
|
};
|
|
878
880
|
|
|
@@ -1535,6 +1537,7 @@ var MPEG1 = /*#__PURE__*/function (_BaseDecoder) {
|
|
|
1535
1537
|
this.decodeMotionVectors();
|
|
1536
1538
|
this.copyMacroblock(this.motionFwH, this.motionFwV, this.forwardY, this.forwardCr, this.forwardCb);
|
|
1537
1539
|
} // Decode blocks
|
|
1540
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1538
1541
|
|
|
1539
1542
|
|
|
1540
1543
|
var cbp = (this.macroblockType & 0x02) !== 0 ? this.readHuffman(MPEG1.CODE_BLOCK_PATTERN) : this.macroblockIntra ? 0x3f : 0;
|
|
@@ -3644,7 +3647,7 @@ MP2.QUANT_TAB = {
|
|
|
3644
3647
|
MP2.QUANT_LUT_STEP_2 = [// 44.1 kHz, 48 kHz, 32 kHz
|
|
3645
3648
|
[MP2.QUANT_TAB.C, MP2.QUANT_TAB.C, MP2.QUANT_TAB.D], // 32 - 48 kbit/sec/ch
|
|
3646
3649
|
[MP2.QUANT_TAB.A, MP2.QUANT_TAB.A, MP2.QUANT_TAB.A], // 56 - 80 kbit/sec/ch
|
|
3647
|
-
[MP2.QUANT_TAB.B, MP2.QUANT_TAB.A, MP2.QUANT_TAB.B] // 96+
|
|
3650
|
+
[MP2.QUANT_TAB.B, MP2.QUANT_TAB.A, MP2.QUANT_TAB.B] // 96+ kbit/sec/ch
|
|
3648
3651
|
]; // Quantizer lookup, step 3: B2 table, subband -> nbal, row index
|
|
3649
3652
|
// (upper 4 bits: nbal, lower 4 bits: row index)
|
|
3650
3653
|
|
|
@@ -4866,9 +4869,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
4866
4869
|
this.options.onEnded(this);
|
|
4867
4870
|
}
|
|
4868
4871
|
}
|
|
4869
|
-
}
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
+
} else if (notEnoughData && this.options.onStalled) {
|
|
4873
|
+
// If there's not enough data and the source is not completed, we have
|
|
4874
|
+
// just stalled.
|
|
4872
4875
|
this.options.onStalled(this);
|
|
4873
4876
|
}
|
|
4874
4877
|
};
|
|
@@ -4908,7 +4911,8 @@ var FetchSource = /*#__PURE__*/function () {
|
|
|
4908
4911
|
method: 'GET',
|
|
4909
4912
|
headers: new Headers(),
|
|
4910
4913
|
cache: 'default'
|
|
4911
|
-
};
|
|
4914
|
+
}; // eslint-disable-next-line no-restricted-globals
|
|
4915
|
+
|
|
4912
4916
|
self.fetch(this.url, params) // eslint-disable-next-line consistent-return
|
|
4913
4917
|
.then(function (res) {
|
|
4914
4918
|
if (res.ok && res.status >= 200 && res.status <= 299) {
|
|
@@ -641,8 +641,7 @@ var WSSource = /*#__PURE__*/function () {
|
|
|
641
641
|
data: []
|
|
642
642
|
};
|
|
643
643
|
this.destination = null;
|
|
644
|
-
this.reconnectInterval =
|
|
645
|
-
options.reconnectInterval !== undefined ? options.reconnectInterval : 5;
|
|
644
|
+
this.reconnectInterval = options.reconnectInterval !== undefined ? options.reconnectInterval : 5;
|
|
646
645
|
this.shouldAttemptReconnect = !!this.reconnectInterval;
|
|
647
646
|
this.completed = false;
|
|
648
647
|
this.established = false;
|
|
@@ -758,7 +757,9 @@ var BitBuffer = /*#__PURE__*/function () {
|
|
|
758
757
|
this.byteLength = 0;
|
|
759
758
|
this.index = 0;
|
|
760
759
|
return;
|
|
761
|
-
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
if (bytePos === 0) {
|
|
762
763
|
// Nothing read yet - we can't evict anything
|
|
763
764
|
return;
|
|
764
765
|
} // Some browsers don't support copyWithin() yet - we may have to do
|
|
@@ -871,6 +872,7 @@ var BitBuffer = /*#__PURE__*/function () {
|
|
|
871
872
|
};
|
|
872
873
|
|
|
873
874
|
_proto.skip = function skip(count) {
|
|
875
|
+
// eslint-disable-next-line no-return-assign
|
|
874
876
|
return this.index += count;
|
|
875
877
|
};
|
|
876
878
|
|
|
@@ -1533,6 +1535,7 @@ var MPEG1 = /*#__PURE__*/function (_BaseDecoder) {
|
|
|
1533
1535
|
this.decodeMotionVectors();
|
|
1534
1536
|
this.copyMacroblock(this.motionFwH, this.motionFwV, this.forwardY, this.forwardCr, this.forwardCb);
|
|
1535
1537
|
} // Decode blocks
|
|
1538
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1536
1539
|
|
|
1537
1540
|
|
|
1538
1541
|
var cbp = (this.macroblockType & 0x02) !== 0 ? this.readHuffman(MPEG1.CODE_BLOCK_PATTERN) : this.macroblockIntra ? 0x3f : 0;
|
|
@@ -3642,7 +3645,7 @@ MP2.QUANT_TAB = {
|
|
|
3642
3645
|
MP2.QUANT_LUT_STEP_2 = [// 44.1 kHz, 48 kHz, 32 kHz
|
|
3643
3646
|
[MP2.QUANT_TAB.C, MP2.QUANT_TAB.C, MP2.QUANT_TAB.D], // 32 - 48 kbit/sec/ch
|
|
3644
3647
|
[MP2.QUANT_TAB.A, MP2.QUANT_TAB.A, MP2.QUANT_TAB.A], // 56 - 80 kbit/sec/ch
|
|
3645
|
-
[MP2.QUANT_TAB.B, MP2.QUANT_TAB.A, MP2.QUANT_TAB.B] // 96+
|
|
3648
|
+
[MP2.QUANT_TAB.B, MP2.QUANT_TAB.A, MP2.QUANT_TAB.B] // 96+ kbit/sec/ch
|
|
3646
3649
|
]; // Quantizer lookup, step 3: B2 table, subband -> nbal, row index
|
|
3647
3650
|
// (upper 4 bits: nbal, lower 4 bits: row index)
|
|
3648
3651
|
|
|
@@ -4864,9 +4867,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
4864
4867
|
this.options.onEnded(this);
|
|
4865
4868
|
}
|
|
4866
4869
|
}
|
|
4867
|
-
}
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
+
} else if (notEnoughData && this.options.onStalled) {
|
|
4871
|
+
// If there's not enough data and the source is not completed, we have
|
|
4872
|
+
// just stalled.
|
|
4870
4873
|
this.options.onStalled(this);
|
|
4871
4874
|
}
|
|
4872
4875
|
};
|
|
@@ -4906,7 +4909,8 @@ var FetchSource = /*#__PURE__*/function () {
|
|
|
4906
4909
|
method: 'GET',
|
|
4907
4910
|
headers: new Headers(),
|
|
4908
4911
|
cache: 'default'
|
|
4909
|
-
};
|
|
4912
|
+
}; // eslint-disable-next-line no-restricted-globals
|
|
4913
|
+
|
|
4910
4914
|
self.fetch(this.url, params) // eslint-disable-next-line consistent-return
|
|
4911
4915
|
.then(function (res) {
|
|
4912
4916
|
if (res.ok && res.status >= 200 && res.status <= 299) {
|
|
@@ -647,8 +647,7 @@
|
|
|
647
647
|
data: []
|
|
648
648
|
};
|
|
649
649
|
this.destination = null;
|
|
650
|
-
this.reconnectInterval =
|
|
651
|
-
options.reconnectInterval !== undefined ? options.reconnectInterval : 5;
|
|
650
|
+
this.reconnectInterval = options.reconnectInterval !== undefined ? options.reconnectInterval : 5;
|
|
652
651
|
this.shouldAttemptReconnect = !!this.reconnectInterval;
|
|
653
652
|
this.completed = false;
|
|
654
653
|
this.established = false;
|
|
@@ -764,7 +763,9 @@
|
|
|
764
763
|
this.byteLength = 0;
|
|
765
764
|
this.index = 0;
|
|
766
765
|
return;
|
|
767
|
-
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
if (bytePos === 0) {
|
|
768
769
|
// Nothing read yet - we can't evict anything
|
|
769
770
|
return;
|
|
770
771
|
} // Some browsers don't support copyWithin() yet - we may have to do
|
|
@@ -877,6 +878,7 @@
|
|
|
877
878
|
};
|
|
878
879
|
|
|
879
880
|
_proto.skip = function skip(count) {
|
|
881
|
+
// eslint-disable-next-line no-return-assign
|
|
880
882
|
return this.index += count;
|
|
881
883
|
};
|
|
882
884
|
|
|
@@ -1539,6 +1541,7 @@
|
|
|
1539
1541
|
this.decodeMotionVectors();
|
|
1540
1542
|
this.copyMacroblock(this.motionFwH, this.motionFwV, this.forwardY, this.forwardCr, this.forwardCb);
|
|
1541
1543
|
} // Decode blocks
|
|
1544
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1542
1545
|
|
|
1543
1546
|
|
|
1544
1547
|
var cbp = (this.macroblockType & 0x02) !== 0 ? this.readHuffman(MPEG1.CODE_BLOCK_PATTERN) : this.macroblockIntra ? 0x3f : 0;
|
|
@@ -3648,7 +3651,7 @@
|
|
|
3648
3651
|
MP2.QUANT_LUT_STEP_2 = [// 44.1 kHz, 48 kHz, 32 kHz
|
|
3649
3652
|
[MP2.QUANT_TAB.C, MP2.QUANT_TAB.C, MP2.QUANT_TAB.D], // 32 - 48 kbit/sec/ch
|
|
3650
3653
|
[MP2.QUANT_TAB.A, MP2.QUANT_TAB.A, MP2.QUANT_TAB.A], // 56 - 80 kbit/sec/ch
|
|
3651
|
-
[MP2.QUANT_TAB.B, MP2.QUANT_TAB.A, MP2.QUANT_TAB.B] // 96+
|
|
3654
|
+
[MP2.QUANT_TAB.B, MP2.QUANT_TAB.A, MP2.QUANT_TAB.B] // 96+ kbit/sec/ch
|
|
3652
3655
|
]; // Quantizer lookup, step 3: B2 table, subband -> nbal, row index
|
|
3653
3656
|
// (upper 4 bits: nbal, lower 4 bits: row index)
|
|
3654
3657
|
|
|
@@ -4870,9 +4873,9 @@
|
|
|
4870
4873
|
this.options.onEnded(this);
|
|
4871
4874
|
}
|
|
4872
4875
|
}
|
|
4873
|
-
}
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
+
} else if (notEnoughData && this.options.onStalled) {
|
|
4877
|
+
// If there's not enough data and the source is not completed, we have
|
|
4878
|
+
// just stalled.
|
|
4876
4879
|
this.options.onStalled(this);
|
|
4877
4880
|
}
|
|
4878
4881
|
};
|
|
@@ -4912,7 +4915,8 @@
|
|
|
4912
4915
|
method: 'GET',
|
|
4913
4916
|
headers: new Headers(),
|
|
4914
4917
|
cache: 'default'
|
|
4915
|
-
};
|
|
4918
|
+
}; // eslint-disable-next-line no-restricted-globals
|
|
4919
|
+
|
|
4916
4920
|
self.fetch(this.url, params) // eslint-disable-next-line consistent-return
|
|
4917
4921
|
.then(function (res) {
|
|
4918
4922
|
if (res.ok && res.status >= 200 && res.status <= 299) {
|
package/package.json
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cycjimmy/jsmpeg-player",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "MPEG1 Video Player Based On JSMpeg",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/jsmpeg-player.cjs",
|
|
6
7
|
"module": "dist/jsmpeg-player.esm.js",
|
|
7
8
|
"browser": "dist/jsmpeg-player.umd.min.js",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"lint:fix": "eslint --fix -c .eslintrc 'src/**/*.js' --fix",
|
|
12
|
-
"dev": "cross-env NODE_ENV=development rollup -c rollup/rollup.config.dev.js --watch",
|
|
13
|
-
"build": "npm run build:prod:umd && npm run build:prod",
|
|
14
|
-
"build:prod": "cross-env NODE_ENV=production rollup -c rollup/rollup.config.prod.js",
|
|
15
|
-
"build:prod:umd": "cross-env NODE_ENV=production rollup -c rollup/rollup.config.dev.js",
|
|
16
|
-
"build:deployment": "cross-env NODE_ENV=deployment rollup -c rollup/rollup.config.dev.js"
|
|
9
|
+
"exports": {
|
|
10
|
+
"require": "./dist/jsmpeg-player.cjs",
|
|
11
|
+
"import": "./dist/jsmpeg-player.esm.js"
|
|
17
12
|
},
|
|
18
13
|
"repository": {
|
|
19
14
|
"type": "git",
|
|
@@ -31,34 +26,5 @@
|
|
|
31
26
|
"homepage": "https://github.com/cycjimmy/jsmpeg-player#readme",
|
|
32
27
|
"files": [
|
|
33
28
|
"/dist"
|
|
34
|
-
]
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@cycjimmy/awesome-js-funcs": "^3.1.0",
|
|
40
|
-
"@cycjimmy/sass-lib": "^1.1.0"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@babel/core": "^7.17.5",
|
|
44
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
45
|
-
"@babel/plugin-transform-object-assign": "^7.16.7",
|
|
46
|
-
"@babel/preset-env": "^7.16.11",
|
|
47
|
-
"@cycjimmy/config-lib": "^2.0.0",
|
|
48
|
-
"@rollup/plugin-babel": "^5.3.1",
|
|
49
|
-
"@rollup/plugin-commonjs": "^21.0.2",
|
|
50
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
51
|
-
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
52
|
-
"autoprefixer": "^10.4.2",
|
|
53
|
-
"cross-env": "^7.0.3",
|
|
54
|
-
"eslint": "^8.11.0",
|
|
55
|
-
"eslint-config-rollup": "^0.1.0",
|
|
56
|
-
"node-sass": "^7.0.1",
|
|
57
|
-
"rollup": "^2.70.1",
|
|
58
|
-
"rollup-plugin-browsersync": "^1.3.3",
|
|
59
|
-
"rollup-plugin-copy": "^3.4.0",
|
|
60
|
-
"rollup-plugin-eslint": "^7.0.0",
|
|
61
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
62
|
-
"rollup-plugin-terser": "^7.0.2"
|
|
63
|
-
}
|
|
29
|
+
]
|
|
64
30
|
}
|