jassub 1.3.0 → 1.4.1
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/README.md +0 -1
- package/dist/COPYRIGHT +951 -951
- package/dist/jassub-worker-legacy.js +26 -12
- package/dist/{jassub-worker-legacy.js.mem → jassub-worker-legacy.mem} +0 -0
- package/dist/jassub-worker.js +1 -1
- package/dist/jassub-worker.wasm +0 -0
- package/dist/jassub.es.js +40 -34
- package/dist/jassub.umd.js +1 -1
- package/package.json +1 -1
- package/src/jassub.js +35 -31
- package/dist/jassub.js +0 -689
package/package.json
CHANGED
package/src/jassub.js
CHANGED
|
@@ -84,38 +84,41 @@ export default class JASSUB extends EventTarget {
|
|
|
84
84
|
this._worker.onmessage = e => this._onmessage(e)
|
|
85
85
|
this._worker.onerror = e => this._error(e)
|
|
86
86
|
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
this._init = () => {
|
|
88
|
+
if (this._destroyed) return
|
|
89
|
+
this._worker.postMessage({
|
|
90
|
+
target: 'init',
|
|
91
|
+
asyncRender,
|
|
92
|
+
onDemandRender: this._onDemandRender,
|
|
93
|
+
width: this._canvasctrl.width,
|
|
94
|
+
height: this._canvasctrl.height,
|
|
95
|
+
preMain: true,
|
|
96
|
+
blendMode,
|
|
97
|
+
subUrl: options.subUrl,
|
|
98
|
+
subContent: options.subContent || null,
|
|
99
|
+
fonts: options.fonts || [],
|
|
100
|
+
availableFonts: options.availableFonts || { 'liberation sans': './default.woff2' },
|
|
101
|
+
fallbackFont: options.fallbackFont || 'liberation sans',
|
|
102
|
+
debug: this.debug,
|
|
103
|
+
targetFps: options.targetFps || 24,
|
|
104
|
+
dropAllAnimations: options.dropAllAnimations,
|
|
105
|
+
libassMemoryLimit: options.libassMemoryLimit || 0,
|
|
106
|
+
libassGlyphLimit: options.libassGlyphLimit || 0,
|
|
107
|
+
hasAlphaBug: JASSUB._hasAlphaBug,
|
|
108
|
+
useLocalFonts: ('queryLocalFonts' in self) && (options.useLocalFonts ?? true)
|
|
109
|
+
})
|
|
110
|
+
if (offscreenRender === true) this.sendMessage('offscreenCanvas', null, [this._canvasctrl])
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
this._boundResize = this.resize.bind(this)
|
|
113
|
+
this._boundTimeUpdate = this._timeupdate.bind(this)
|
|
114
|
+
this._boundSetRate = this.setRate.bind(this)
|
|
115
|
+
if (this._video) this.setVideo(options.video)
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (this._onDemandRender) {
|
|
118
|
+
this.busy = false
|
|
119
|
+
this._lastDemandTime = null
|
|
120
|
+
this._video?.requestVideoFrameCallback(this._handleRVFC.bind(this))
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
|
|
@@ -582,6 +585,7 @@ export default class JASSUB extends EventTarget {
|
|
|
582
585
|
}
|
|
583
586
|
|
|
584
587
|
_ready () {
|
|
588
|
+
this._init()
|
|
585
589
|
this.dispatchEvent(new CustomEvent('ready'))
|
|
586
590
|
}
|
|
587
591
|
|
|
@@ -648,7 +652,7 @@ export default class JASSUB extends EventTarget {
|
|
|
648
652
|
}
|
|
649
653
|
|
|
650
654
|
_error (err) {
|
|
651
|
-
this.dispatchEvent(err instanceof ErrorEvent ? err : new ErrorEvent('error', { cause: err instanceof Error ? err.cause : err }))
|
|
655
|
+
this.dispatchEvent(err instanceof ErrorEvent ? new ErrorEvent(err.type, err) : new ErrorEvent('error', { cause: err instanceof Error ? err.cause : err }))
|
|
652
656
|
if (!(err instanceof Error)) {
|
|
653
657
|
if (err instanceof ErrorEvent) {
|
|
654
658
|
err = err.error
|