@banou/media-player 0.4.2 → 0.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banou/media-player",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -39,7 +39,7 @@
39
39
  "@xstate/react": "^5.0.1",
40
40
  "ass-compiler": "^0.1.15",
41
41
  "jassub": "^1.7.18",
42
- "libav-wasm": "^0.5.4",
42
+ "libav-wasm": "^0.5.5",
43
43
  "osra": "^0.1.2",
44
44
  "p-queue": "^7.3.4",
45
45
  "react": "^19.0.0",
@@ -1,7 +1,8 @@
1
- import { RefObject, useCallback, useContext, useEffect, useRef, useState } from 'react'
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,#000 0,rgba(0,0,0,.4) 60%,transparent);
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
- jassubInstance.setTrack(newSubtitleStreams.header.content)
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: subtitlePart.content,
219
+ subContent: stringify(modifiedHeader),
216
220
  workerUrl: subtitlesRendererOptions.workerUrl,
217
221
  modernWasmUrl: subtitlesRendererOptions.wasmUrl,
218
222
  fonts: attachments.filter(Boolean).map(([filename, data]) => data),