@taole/giftstage 0.1.30 → 0.1.32

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/README.md CHANGED
@@ -249,8 +249,9 @@ Promise<GiftHandle>;
249
249
  - `height?: number`
250
250
  - `useOriginalSize?: boolean`
251
251
  - `objectFit?: 'contain' | 'cover'`
252
- - `loop?: number`
253
- - `0` 表示无限循环
252
+ - `loop?: number`
253
+ - `0` 表示无限循环
254
+ - VAP / AlphaVideo 的 HTMLVideo 回退路径会为有限循环设置“媒体总时长 + 容错窗口”的超时保护;即使浏览器未触发 `ended`,也会进入正常完成和清理流程
254
255
  - `opacity?: number`
255
256
  - 全局透明度,范围 `0 ~ 1`,默认 `1`
256
257
  - `rotation?: number`
@@ -267,6 +268,11 @@ Promise<GiftHandle>;
267
268
  - 播放结束后,是否自动移除礼物
268
269
  - 默认 `true`,传 `false` 时会停留最后一帧,方便后续继续调用 `gift.animate(...).start()`
269
270
  - `mute?: boolean`
271
+ - `VAP / AlphaVideo` 传 `false` 时使用 `HTMLVideoElement` 播放声音;该礼物不会进入仅解码视频帧的 WebCodecs 路径
272
+ - 如果浏览器阻止有声自动播放,会自动回退静音播放,保证画面正常完成
273
+ - `onFrame?: (frame, gift) => void`
274
+ - 仅用于 SVGA;画面帧推进时触发
275
+ - 性能不足时可能跨帧,业务应使用 `frame >= target` 的阈值判断
270
276
  - `onComplete?: (gift) => void`
271
277
 
272
278
  图片专用参数:
@@ -4,6 +4,11 @@ export declare class GiftStage {
4
4
  private static readonly SVGA_ATLAS_MAX_SIZE;
5
5
  private static readonly SVGA_ATLAS_PADDING;
6
6
  private static readonly DEFAULT_SHARED_VIDEO_PLAYBACK_WINDOW_MS;
7
+ private static readonly HTML_VIDEO_READY_TIMEOUT_MS;
8
+ private static readonly HTML_VIDEO_WATCHDOG_MIN_GRACE_MS;
9
+ private static readonly HTML_VIDEO_WATCHDOG_MAX_GRACE_MS;
10
+ private static readonly HTML_VIDEO_WATCHDOG_GRACE_RATIO;
11
+ private static readonly MAX_TIMER_DELAY_MS;
7
12
  private static readonly DEFAULT_RESOURCE_CACHE_MEMORY_BYTES;
8
13
  private static readonly DEFAULT_RESOURCE_CACHE_PERSISTENT_BYTES;
9
14
  private readonly sharedSVGAEntities;
@@ -85,6 +90,9 @@ export declare class GiftStage {
85
90
  * Drive repeat / infinite playback explicitly from `ended` (aligns with SVGA `loop`: 0 = ∞, default 1).
86
91
  */
87
92
  private bindVideoLoopOnEnded;
93
+ private clearHtmlVideoPlaybackWatchdog;
94
+ private completeHtmlVideoPlayback;
95
+ private armHtmlVideoPlaybackWatchdog;
88
96
  private createVideo;
89
97
  private waitVideoMetadata;
90
98
  private probeVideoNaturalSize;