@banou/media-player 0.4.4 → 0.4.6
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/build/index.js +479 -463
- package/package.json +1 -1
- package/src/components/progress-bar.tsx +1 -0
- package/src/state-machines/subtitles.ts +22 -4
package/package.json
CHANGED
|
@@ -143,6 +143,7 @@ export const ProgressBar = () => {
|
|
|
143
143
|
setProgressBarOverTime(undefined)
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// file download % does not equal video time %, as the video contains sometimes, big headers including fonts, which might be ~50mb
|
|
146
147
|
const loadedParts = useMemo(() =>
|
|
147
148
|
mediaPlayerContext
|
|
148
149
|
.downloadedRanges
|
|
@@ -149,8 +149,17 @@ export default fromAsyncCallback<SubtitlesEvents, SubtitlesInput, SubtitlesEmitt
|
|
|
149
149
|
throw new Error('newSubtitleStreams is undefined')
|
|
150
150
|
}
|
|
151
151
|
const parsedHeader = parse(newSubtitleStreams.header.content)
|
|
152
|
-
const modifiedHeader = {
|
|
153
|
-
|
|
152
|
+
const modifiedHeader = {
|
|
153
|
+
...parsedHeader,
|
|
154
|
+
info: {
|
|
155
|
+
...parsedHeader.info,
|
|
156
|
+
ScaledBorderAndShadow: 'no' as const,
|
|
157
|
+
LayoutResX: '',
|
|
158
|
+
LayoutResY: ''
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const header = stringify(modifiedHeader)
|
|
162
|
+
jassubInstance.setTrack(header)
|
|
154
163
|
jassubInstance.setCurrentTime(video.paused, video.currentTime, video.playbackRate)
|
|
155
164
|
for (const styleIndex in newSubtitleStreams.header.parsed.styles) {
|
|
156
165
|
const style = newSubtitleStreams.header.parsed.styles.style[Number(styleIndex)]
|
|
@@ -212,11 +221,20 @@ export default fromAsyncCallback<SubtitlesEvents, SubtitlesInput, SubtitlesEmitt
|
|
|
212
221
|
} else if (subtitlePart.type === 'header') {
|
|
213
222
|
if (!jassubInstance) {
|
|
214
223
|
const parsedHeader = parse(subtitlePart.content)
|
|
215
|
-
const modifiedHeader = {
|
|
224
|
+
const modifiedHeader = {
|
|
225
|
+
...parsedHeader,
|
|
226
|
+
info: {
|
|
227
|
+
...parsedHeader.info,
|
|
228
|
+
ScaledBorderAndShadow: 'no' as const,
|
|
229
|
+
LayoutResX: '',
|
|
230
|
+
LayoutResY: ''
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const header = stringify(modifiedHeader)
|
|
216
234
|
jassubInstance = new JASSUB({
|
|
217
235
|
video,
|
|
218
236
|
canvas,
|
|
219
|
-
subContent:
|
|
237
|
+
subContent: header,
|
|
220
238
|
workerUrl: subtitlesRendererOptions.workerUrl,
|
|
221
239
|
modernWasmUrl: subtitlesRendererOptions.wasmUrl,
|
|
222
240
|
fonts: attachments.filter(Boolean).map(([filename, data]) => data),
|