@banou/media-player 0.4.3 → 0.4.5
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 +655 -651
- package/package.json +1 -1
- package/src/components/control-bar.tsx +3 -3
- package/src/state-machines/subtitles.ts +7 -3
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { RefObject, useCallback, useContext, useEffect,
|
|
1
|
+
import { RefObject, useCallback, useContext, useEffect, useState } from 'react'
|
|
2
2
|
import { css } from '@emotion/react'
|
|
3
3
|
import { Maximize, Minimize, Pause, Play, RotateCcw } from 'react-feather'
|
|
4
4
|
|
|
5
|
+
import { linearToLogVolume, logToLinearVolume } from '../utils/volume-utils'
|
|
5
6
|
import { MediaMachineContext } from '../state-machines'
|
|
6
7
|
import { TooltipDisplay } from './tooltip-display'
|
|
7
8
|
import { togglePlay } from '../utils/actor-utils'
|
|
@@ -13,14 +14,13 @@ import pictureInPicture from '../assets/picture-in-picture.svg'
|
|
|
13
14
|
import SettingsAction from './settings'
|
|
14
15
|
import colors from '../utils/colors'
|
|
15
16
|
import Sound from './sound'
|
|
16
|
-
import { linearToLogVolume, logToLinearVolume } from '../utils/volume-utils'
|
|
17
17
|
|
|
18
18
|
const style = css`
|
|
19
19
|
position: absolute;
|
|
20
20
|
bottom: 0;
|
|
21
21
|
width: 100%;
|
|
22
22
|
|
|
23
|
-
background: linear-gradient(0deg
|
|
23
|
+
background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.45) 20%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.15) 70%, transparent 100%);
|
|
24
24
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
25
25
|
|
|
26
26
|
.actions {
|
|
@@ -4,7 +4,7 @@ import type { ASS_Event, JassubOptions } from 'jassub'
|
|
|
4
4
|
import JASSUB from 'jassub'
|
|
5
5
|
import { Attachment, SubtitleFragment } from 'libav-wasm/build/worker'
|
|
6
6
|
|
|
7
|
-
import { parse } from 'ass-compiler'
|
|
7
|
+
import { parse, stringify } from 'ass-compiler'
|
|
8
8
|
import { fromAsyncCallback } from './utils'
|
|
9
9
|
|
|
10
10
|
type SubtitlesEvents =
|
|
@@ -148,7 +148,9 @@ export default fromAsyncCallback<SubtitlesEvents, SubtitlesInput, SubtitlesEmitt
|
|
|
148
148
|
if (!newSubtitleStreams) {
|
|
149
149
|
throw new Error('newSubtitleStreams is undefined')
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
const parsedHeader = parse(newSubtitleStreams.header.content)
|
|
152
|
+
const modifiedHeader = { ...parsedHeader, info: { ...parsedHeader.info, ScaledBorderAndShadow: 'no' as const } }
|
|
153
|
+
jassubInstance.setTrack(stringify(modifiedHeader))
|
|
152
154
|
jassubInstance.setCurrentTime(video.paused, video.currentTime, video.playbackRate)
|
|
153
155
|
for (const styleIndex in newSubtitleStreams.header.parsed.styles) {
|
|
154
156
|
const style = newSubtitleStreams.header.parsed.styles.style[Number(styleIndex)]
|
|
@@ -209,10 +211,12 @@ export default fromAsyncCallback<SubtitlesEvents, SubtitlesInput, SubtitlesEmitt
|
|
|
209
211
|
appendedSubtitleParts.push(subtitlePart)
|
|
210
212
|
} else if (subtitlePart.type === 'header') {
|
|
211
213
|
if (!jassubInstance) {
|
|
214
|
+
const parsedHeader = parse(subtitlePart.content)
|
|
215
|
+
const modifiedHeader = { ...parsedHeader, info: { ...parsedHeader.info, ScaledBorderAndShadow: 'no' as const } }
|
|
212
216
|
jassubInstance = new JASSUB({
|
|
213
217
|
video,
|
|
214
218
|
canvas,
|
|
215
|
-
subContent:
|
|
219
|
+
subContent: stringify(modifiedHeader),
|
|
216
220
|
workerUrl: subtitlesRendererOptions.workerUrl,
|
|
217
221
|
modernWasmUrl: subtitlesRendererOptions.wasmUrl,
|
|
218
222
|
fonts: attachments.filter(Boolean).map(([filename, data]) => data),
|