@netless/slide 1.4.55-alpha.2 → 1.4.55-alpha.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.
@@ -0,0 +1,13 @@
1
+ export interface FrozenMediaPlaybackState {
2
+ type: "pause" | "play";
3
+ time: number;
4
+ }
5
+ export declare type FrozenMediaTimes = {
6
+ [key: string]: number;
7
+ };
8
+ export declare function captureFrozenMediaTimes(mediaState: {
9
+ [key: string]: FrozenMediaPlaybackState;
10
+ }, frozenTime: number): FrozenMediaTimes;
11
+ export declare function applyFrozenMediaTimes(mediaState: {
12
+ [key: string]: FrozenMediaPlaybackState;
13
+ }, frozenMediaTimes: FrozenMediaTimes, releaseTime: number): void;
package/lib/Lock.js CHANGED
@@ -4,8 +4,6 @@
4
4
  var Lock = /** @class */ (function () {
5
5
  function Lock(available) {
6
6
  this.autoUnlock = Object.create(null);
7
- this.localKeyAutoRemove = Object.create(null);
8
- this.localKeys = Object.create(null);
9
7
  this.locks = Object.create(null);
10
8
  this.available = false;
11
9
  this.available = available;
@@ -16,32 +14,18 @@ var Lock = /** @class */ (function () {
16
14
  return;
17
15
  }
18
16
  this.locks[type] = key;
19
- this.localKeys[key] = true;
20
- this.localKeyAutoRemove[key] = window.setTimeout(function () {
21
- delete _this.localKeys[key];
22
- delete _this.localKeyAutoRemove[key];
23
- }, 60 * 1000);
24
17
  this.autoUnlock[type] = window.setTimeout(function () {
25
18
  delete _this.locks[type];
26
- delete _this.autoUnlock[type];
27
19
  }, 3000);
28
20
  };
29
21
  Lock.prototype.unlock = function (type, key) {
30
22
  if (!this.available) {
31
- return false;
32
- }
33
- var isLocalEvent = !!key && !!this.localKeys[key];
34
- if (key && isLocalEvent) {
35
- window.clearTimeout(this.localKeyAutoRemove[key]);
36
- delete this.localKeys[key];
37
- delete this.localKeyAutoRemove[key];
23
+ return;
38
24
  }
39
25
  if (key && this.locks[type] && this.locks[type] === key) {
40
26
  window.clearTimeout(this.autoUnlock[type]);
41
27
  delete this.locks[type];
42
- delete this.autoUnlock[type];
43
28
  }
44
- return isLocalEvent;
45
29
  };
46
30
  Lock.prototype.isLocked = function (type) {
47
31
  if (!this.available) {
package/lib/Slide.d.ts CHANGED
@@ -5,6 +5,7 @@ import { AliTrackLogger } from "./AliTrackLogger";
5
5
  import { preloadResource } from "./global";
6
6
  export { ErrorType, PreloadCancelledError } from "@netless/ppt-player";
7
7
  export type { SyncEventQueuePolicy } from "./SyncTaskManager";
8
+ export declare const LOCAL_GIF_RUNTIME_CAPABILITY = "netless-slide-local-gif-production-client-geometry";
8
9
  export declare type UrlInterrupter = (url: string) => Promise<string>;
9
10
  export interface ILoaderDelegate {
10
11
  /**
@@ -179,6 +180,10 @@ export interface ISlideRenderOptions {
179
180
  */
180
181
  transitionResolutionLevel?: number;
181
182
  antialias?: boolean;
183
+ /** Maximum compressed bytes accepted for one client-decoded GIF. */
184
+ localGifMaxCompressedBytes?: number;
185
+ /** Maximum estimated GIF working set for one cached slide. */
186
+ localGifMaxWorkingSetBytes?: number;
182
187
  }
183
188
  export interface INavigatorDelegate {
184
189
  gotoPage?: (index: number) => void;
@@ -284,13 +289,18 @@ export interface ISlideConfig {
284
289
  skipActionWhenFrozen?: boolean;
285
290
  enableAutoForward?: boolean;
286
291
  customLinks?: CustomLink[];
292
+ /**
293
+ * Disable the built-in ResizeObserver and rely on external notifyFrameResize() calls.
294
+ * Set this to true when using window-manager's boxSizeChange event as the resize signal.
295
+ * @default false
296
+ */
297
+ disableFrameResizeObserver?: boolean;
287
298
  resourceMaxRetries?: number;
288
299
  onResourceMaxRetries?: (url: string, error: Error) => void;
289
300
  }
290
301
  interface MediaState {
291
302
  type: "pause" | "play";
292
303
  time: number;
293
- frozenTime?: number;
294
304
  fullscreen?: boolean;
295
305
  }
296
306
  interface TimeNodeSeqState {
@@ -441,6 +451,7 @@ export declare class Slide extends Slide_base {
441
451
  private userInputTime;
442
452
  private isSyncingSlideState;
443
453
  private frozenTaskManager;
454
+ private frozenMediaTimes;
444
455
  private randomId;
445
456
  private resize;
446
457
  private isAnimating;
@@ -509,6 +520,12 @@ export declare class Slide extends Slide_base {
509
520
  private updateStageCountLimit;
510
521
  private setMedianControllerAttribute;
511
522
  private frameResizeHandler;
523
+ /**
524
+ * Notify the slide that its frame container may have changed size.
525
+ * Call this when using an external resize signal (e.g. window-manager's boxSizeChange event)
526
+ * instead of the built-in ResizeObserver.
527
+ */
528
+ notifyFrameResize(): void;
512
529
  /**
513
530
  * Update ppt fixed height and width, this method only takes effect when the fixedFrameSize configuration item is set.
514
531
  * @param width Width value that needs to be updated, unit px.