jassub 1.1.11 → 1.1.13
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 -1
- package/README.md +3 -3
- package/dist/COPYRIGHT +951 -950
- package/dist/jassub-worker-legacy.js +20 -20
- package/dist/jassub-worker-legacy.js.mem +0 -0
- package/dist/jassub-worker.js +1 -1
- package/dist/jassub-worker.wasm +0 -0
- package/dist/jassub.es.js +32 -39
- package/dist/jassub.js +1607 -1605
- package/dist/jassub.umd.js +1 -1
- package/package.json +2 -2
- package/src/jassub.js +23 -17
package/dist/jassub.es.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
3
|
var __publicField = (obj, key, value) => {
|
|
18
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
5
|
return value;
|
|
@@ -22,10 +8,10 @@ if (!("requestVideoFrameCallback" in HTMLVideoElement.prototype) && "getVideoPla
|
|
|
22
8
|
HTMLVideoElement.prototype._rvfcpolyfillmap = {};
|
|
23
9
|
HTMLVideoElement.prototype.requestVideoFrameCallback = function(callback) {
|
|
24
10
|
const quality = this.getVideoPlaybackQuality();
|
|
25
|
-
const baseline = this.mozPresentedFrames || quality.totalVideoFrames - quality.droppedVideoFrames;
|
|
11
|
+
const baseline = this.mozPresentedFrames || this.mozPaintedFrames || quality.totalVideoFrames - quality.droppedVideoFrames;
|
|
26
12
|
const check = (old, now2) => {
|
|
27
13
|
const newquality = this.getVideoPlaybackQuality();
|
|
28
|
-
const presentedFrames = this.mozPresentedFrames || newquality.totalVideoFrames - newquality.droppedVideoFrames;
|
|
14
|
+
const presentedFrames = this.mozPresentedFrames || this.mozPaintedFrames || newquality.totalVideoFrames - newquality.droppedVideoFrames;
|
|
29
15
|
if (presentedFrames > baseline) {
|
|
30
16
|
const processingDuration = this.mozFrameDelay || newquality.totalFrameDelay - quality.totalFrameDelay || 0;
|
|
31
17
|
const timediff = now2 - old;
|
|
@@ -119,6 +105,9 @@ const _JASSUB = class extends EventTarget {
|
|
|
119
105
|
});
|
|
120
106
|
if (_offscreenRender === true)
|
|
121
107
|
this.sendMessage("offscreenCanvas", null, [this._canvasctrl]);
|
|
108
|
+
this._boundResize = this.resize.bind(this);
|
|
109
|
+
this._boundTimeUpdate = this._timeupdate.bind(this);
|
|
110
|
+
this._boundSetRate = this.setRate.bind(this);
|
|
122
111
|
this.setVideo(options.video);
|
|
123
112
|
if (this._onDemandRender) {
|
|
124
113
|
this.busy = false;
|
|
@@ -172,7 +161,7 @@ const _JASSUB = class extends EventTarget {
|
|
|
172
161
|
let videoSize = null;
|
|
173
162
|
if ((!width || !height) && this._video) {
|
|
174
163
|
videoSize = this._getVideoPosition();
|
|
175
|
-
const newsize = this._computeCanvasSize(videoSize.width || 0 * (window.devicePixelRatio || 1), videoSize.height || 0 * (window.devicePixelRatio || 1));
|
|
164
|
+
const newsize = this._computeCanvasSize((videoSize.width || 0) * (window.devicePixelRatio || 1), (videoSize.height || 0) * (window.devicePixelRatio || 1));
|
|
176
165
|
width = newsize.width;
|
|
177
166
|
height = newsize.height;
|
|
178
167
|
top = videoSize.y - (this._canvasParent.getBoundingClientRect().top - this._video.getBoundingClientRect().top);
|
|
@@ -255,16 +244,16 @@ const _JASSUB = class extends EventTarget {
|
|
|
255
244
|
this._video = video;
|
|
256
245
|
if (this._onDemandRender !== true) {
|
|
257
246
|
this._playstate = video.paused;
|
|
258
|
-
video.addEventListener("timeupdate", this.
|
|
259
|
-
video.addEventListener("progress", this.
|
|
260
|
-
video.addEventListener("waiting", this.
|
|
261
|
-
video.addEventListener("seeking", this.
|
|
262
|
-
video.addEventListener("playing", this.
|
|
263
|
-
video.addEventListener("ratechange", this.
|
|
247
|
+
video.addEventListener("timeupdate", this._boundTimeUpdate, false);
|
|
248
|
+
video.addEventListener("progress", this._boundTimeUpdate, false);
|
|
249
|
+
video.addEventListener("waiting", this._boundTimeUpdate, false);
|
|
250
|
+
video.addEventListener("seeking", this._boundTimeUpdate, false);
|
|
251
|
+
video.addEventListener("playing", this._boundTimeUpdate, false);
|
|
252
|
+
video.addEventListener("ratechange", this._boundSetRate, false);
|
|
264
253
|
}
|
|
265
254
|
if (video.videoWidth > 0)
|
|
266
255
|
this.resize();
|
|
267
|
-
video.addEventListener("resize", this.
|
|
256
|
+
video.addEventListener("resize", this._boundResize);
|
|
268
257
|
if (typeof ResizeObserver !== "undefined") {
|
|
269
258
|
if (!this._ro)
|
|
270
259
|
this._ro = new ResizeObserver(() => this.resize());
|
|
@@ -347,9 +336,11 @@ const _JASSUB = class extends EventTarget {
|
|
|
347
336
|
}
|
|
348
337
|
}
|
|
349
338
|
_getLocalFont({ font }) {
|
|
339
|
+
var _a, _b;
|
|
350
340
|
try {
|
|
351
|
-
|
|
352
|
-
|
|
341
|
+
const query = ((_a = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : _a.request) || ((_b = navigator == null ? void 0 : navigator.permissions) == null ? void 0 : _b.query);
|
|
342
|
+
if (query) {
|
|
343
|
+
query({ name: "local-fonts" }).then((permission) => {
|
|
353
344
|
if (permission.state === "granted") {
|
|
354
345
|
this._sendLocalFont(font);
|
|
355
346
|
}
|
|
@@ -410,14 +401,16 @@ const _JASSUB = class extends EventTarget {
|
|
|
410
401
|
}
|
|
411
402
|
sendMessage(target, data = {}, transferable) {
|
|
412
403
|
if (transferable) {
|
|
413
|
-
this._worker.postMessage(
|
|
404
|
+
this._worker.postMessage({
|
|
414
405
|
target,
|
|
415
|
-
transferable
|
|
416
|
-
|
|
406
|
+
transferable,
|
|
407
|
+
...data
|
|
408
|
+
}, [...transferable]);
|
|
417
409
|
} else {
|
|
418
|
-
this._worker.postMessage(
|
|
419
|
-
target
|
|
420
|
-
|
|
410
|
+
this._worker.postMessage({
|
|
411
|
+
target,
|
|
412
|
+
...data
|
|
413
|
+
});
|
|
421
414
|
}
|
|
422
415
|
}
|
|
423
416
|
_fetchFromWorker(workerOptions, callback) {
|
|
@@ -463,13 +456,13 @@ const _JASSUB = class extends EventTarget {
|
|
|
463
456
|
if (this._video) {
|
|
464
457
|
if (this._ro)
|
|
465
458
|
this._ro.unobserve(this._video);
|
|
466
|
-
this._video.removeEventListener("timeupdate", this.
|
|
467
|
-
this._video.removeEventListener("progress", this.
|
|
468
|
-
this._video.removeEventListener("waiting", this.
|
|
469
|
-
this._video.removeEventListener("seeking", this.
|
|
470
|
-
this._video.removeEventListener("playing", this.
|
|
471
|
-
this._video.removeEventListener("ratechange", this.
|
|
472
|
-
this._video.removeEventListener("resize", this.
|
|
459
|
+
this._video.removeEventListener("timeupdate", this._boundTimeUpdate);
|
|
460
|
+
this._video.removeEventListener("progress", this._boundTimeUpdate);
|
|
461
|
+
this._video.removeEventListener("waiting", this._boundTimeUpdate);
|
|
462
|
+
this._video.removeEventListener("seeking", this._boundTimeUpdate);
|
|
463
|
+
this._video.removeEventListener("playing", this._boundTimeUpdate);
|
|
464
|
+
this._video.removeEventListener("ratechange", this._boundSetRate);
|
|
465
|
+
this._video.removeEventListener("resize", this._boundResize);
|
|
473
466
|
}
|
|
474
467
|
}
|
|
475
468
|
destroy(err) {
|