@remotion/media 4.0.496 → 4.0.497

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.
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { type InteractivitySchema } from 'remotion';
3
+ export declare const audioSchema: InteractivitySchema;
2
4
  export declare const Audio: React.ComponentType<{
3
5
  src: string;
4
6
  trimBefore?: number | undefined;
@@ -5,6 +5,8 @@ import { type AudioBufferSlice } from './make-iterator-with-priming';
5
5
  import type { Nonce } from './nonce-manager';
6
6
  import type { SharedAudioContextForMediaPlayer } from './shared-audio-context-for-media-player';
7
7
  type ScheduleAudioNode = (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number, sourceOffsetInSeconds: number, sourceDurationInSeconds: number) => ScheduleAudioNodeResult;
8
+ export declare const MINIMUM_AUDIO_BUFFERING_TIME_SECONDS = 0.1;
9
+ export declare const hasEnoughAudioToStartPlayback: (bufferedDuration: number) => boolean;
8
10
  export type AudioIteratorAnchor = {
9
11
  unloopedStartInSeconds: number;
10
12
  mediaStartInSeconds: number;
@@ -415,6 +415,10 @@ async function* makeLoopingIterator({
415
415
  }
416
416
 
417
417
  // src/audio-iterator-manager.ts
418
+ var MINIMUM_AUDIO_BUFFERING_TIME_SECONDS = 0.1;
419
+ var hasEnoughAudioToStartPlayback = (bufferedDuration) => {
420
+ return bufferedDuration >= MINIMUM_AUDIO_BUFFERING_TIME_SECONDS;
421
+ };
418
422
  var anchorToContinuousTime = ({
419
423
  anchor,
420
424
  unloopedTimeInSeconds,
@@ -597,7 +601,7 @@ var audioIteratorManager = ({
597
601
  onDone();
598
602
  return;
599
603
  }
600
- onScheduled(result.value.timelineTimestamp);
604
+ onScheduled(result.value.sourceDurationInSeconds);
601
605
  notifyNodeScheduled();
602
606
  onAudioChunk({
603
607
  buffer: result.value,
@@ -679,24 +683,32 @@ var audioIteratorManager = ({
679
683
  });
680
684
  audioIteratorsCreated++;
681
685
  audioBufferIterator = iterator;
682
- let chunksScheduled = 0;
686
+ let bufferedDuration = 0;
687
+ let hasUnblockedPlayback = false;
688
+ const unblockPlayback = () => {
689
+ if (hasUnblockedPlayback) {
690
+ return;
691
+ }
692
+ hasUnblockedPlayback = true;
693
+ delayHandle.unblock();
694
+ };
683
695
  proceedScheduling({
684
696
  iterator,
685
697
  nonce,
686
698
  getTargetTime,
687
699
  playbackRate,
688
700
  scheduleAudioNode,
689
- onScheduled: () => {
690
- chunksScheduled++;
691
- if (chunksScheduled === 6) {
692
- delayHandle.unblock();
701
+ onScheduled: (sourceDurationInSeconds) => {
702
+ bufferedDuration += sourceDurationInSeconds;
703
+ if (hasEnoughAudioToStartPlayback(bufferedDuration)) {
704
+ unblockPlayback();
693
705
  }
694
706
  },
695
707
  onDestroyed: () => {
696
- delayHandle.unblock();
708
+ unblockPlayback();
697
709
  },
698
710
  onDone: () => {
699
- delayHandle.unblock();
711
+ unblockPlayback();
700
712
  },
701
713
  logLevel,
702
714
  currentTime: sharedAudioContext.audioContext.currentTime,
@@ -5893,7 +5905,6 @@ var videoSchema = {
5893
5905
  },
5894
5906
  ...Internals22.baseSchema,
5895
5907
  ...Internals22.premountSchema,
5896
- ...Internals22.premountStyleSchema,
5897
5908
  volume: {
5898
5909
  type: "number",
5899
5910
  min: 0,
@@ -5914,7 +5925,9 @@ var videoSchema = {
5914
5925
  },
5915
5926
  muted: { type: "boolean", default: false, description: "Muted" },
5916
5927
  loop: { type: "boolean", default: false, description: "Loop" },
5917
- ...Internals22.transformSchema
5928
+ ...Internals22.transformSchema,
5929
+ ...Interactive2.backgroundSchema,
5930
+ ...Interactive2.borderSchema
5918
5931
  };
5919
5932
  var InnerVideo = ({
5920
5933
  src,
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { type InteractivitySchema } from 'remotion';
3
+ export declare const videoSchema: InteractivitySchema;
2
4
  export declare const Video: React.ComponentType<{
3
5
  src: string;
4
6
  } & Partial<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/media",
3
- "version": "4.0.496",
3
+ "version": "4.0.497",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "mediabunny": "1.50.8",
26
- "remotion": "4.0.496",
26
+ "remotion": "4.0.497",
27
27
  "zod": "4.3.6"
28
28
  },
29
29
  "peerDependencies": {
@@ -31,8 +31,8 @@
31
31
  "react-dom": ">=16.8.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@remotion/eslint-config-internal": "4.0.496",
35
- "@remotion/player": "4.0.496",
34
+ "@remotion/eslint-config-internal": "4.0.497",
35
+ "@remotion/player": "4.0.497",
36
36
  "@vitest/browser-webdriverio": "4.0.9",
37
37
  "eslint": "9.19.0",
38
38
  "react": "19.2.3",