@banou/media-player 0.4.5 → 0.4.7

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.5",
3
+ "version": "0.4.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -15,6 +15,8 @@ const style = css`
15
15
  display: flex;
16
16
  justify-content: center;
17
17
  align-items: center;
18
+ height: 100%;
19
+ width: 100%;
18
20
 
19
21
  & > div:not(:last-of-type) {
20
22
  position: absolute;
@@ -33,6 +35,7 @@ const style = css`
33
35
  height: 100%;
34
36
  width: 100%;
35
37
  background-color: black;
38
+ object-fit: contain;
36
39
  }
37
40
 
38
41
  &.hide {
@@ -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
package/src/index.tsx CHANGED
@@ -17,6 +17,7 @@ const FKNVideoRootStyle = css`
17
17
  justify-content: center;
18
18
  background-color: #111;
19
19
  height: 100%;
20
+ width: 100%;
20
21
  overflow: hidden;
21
22
  `
22
23
 
@@ -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 = { ...parsedHeader, info: { ...parsedHeader.info, ScaledBorderAndShadow: 'no' as const } }
153
- jassubInstance.setTrack(stringify(modifiedHeader))
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 = { ...parsedHeader, info: { ...parsedHeader.info, ScaledBorderAndShadow: 'no' as const } }
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: stringify(modifiedHeader),
237
+ subContent: header,
220
238
  workerUrl: subtitlesRendererOptions.workerUrl,
221
239
  modernWasmUrl: subtitlesRendererOptions.wasmUrl,
222
240
  fonts: attachments.filter(Boolean).map(([filename, data]) => data),