@spatialwalk/avatarkit-rtc 1.0.0-beta.8 → 1.0.0-beta.9

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.
Files changed (44) hide show
  1. package/README.md +2 -571
  2. package/dist/assets/animation-worker-DOGeTjF0.js.map +1 -0
  3. package/dist/core/AvatarPlayer.d.ts +8 -3
  4. package/dist/core/AvatarPlayer.d.ts.map +1 -1
  5. package/dist/core/RTCProvider.d.ts +12 -5
  6. package/dist/core/RTCProvider.d.ts.map +1 -1
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +3 -2
  10. package/dist/index10.js +86 -47
  11. package/dist/index10.js.map +1 -1
  12. package/dist/index11.js +14 -104
  13. package/dist/index11.js.map +1 -1
  14. package/dist/index12.js +390 -14
  15. package/dist/index12.js.map +1 -1
  16. package/dist/index13.js +137 -349
  17. package/dist/index13.js.map +1 -1
  18. package/dist/index14.js.map +1 -1
  19. package/dist/index15.js +1 -1
  20. package/dist/index2.js +38 -17
  21. package/dist/index2.js.map +1 -1
  22. package/dist/index3.js +141 -42
  23. package/dist/index3.js.map +1 -1
  24. package/dist/index4.js +101 -70
  25. package/dist/index4.js.map +1 -1
  26. package/dist/index5.js +6 -2
  27. package/dist/index5.js.map +1 -1
  28. package/dist/index6.js +73 -18
  29. package/dist/index6.js.map +1 -1
  30. package/dist/index8.js +5 -2
  31. package/dist/index8.js.map +1 -1
  32. package/dist/index9.js +65 -164
  33. package/dist/index9.js.map +1 -1
  34. package/dist/providers/agora/AgoraProvider.d.ts.map +1 -1
  35. package/dist/providers/agora/types.d.ts.map +1 -1
  36. package/dist/providers/base/BaseProvider.d.ts +9 -13
  37. package/dist/providers/base/BaseProvider.d.ts.map +1 -1
  38. package/dist/providers/livekit/LiveKitProvider.d.ts +4 -2
  39. package/dist/providers/livekit/LiveKitProvider.d.ts.map +1 -1
  40. package/dist/providers/livekit/animation-worker.d.ts.map +1 -1
  41. package/dist/types/index.d.ts +21 -0
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/package.json +12 -3
  44. package/dist/assets/animation-worker-CdhDm7lL.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { RTCConnectionConfig } from '../types';
1
+ import { RTCConnectionConfig, RTCPrepareConnectionConfig } from '../types';
2
2
  /**
3
3
  * RTC Provider interface.
4
4
  *
@@ -17,12 +17,19 @@ import { RTCConnectionConfig } from '../types';
17
17
  * }
18
18
  * ```
19
19
  */
20
+ export type RTCProviderEventHandler = (...args: unknown[]) => void;
20
21
  export interface RTCProvider {
21
22
  /**
22
23
  * Provider name identifier (e.g., 'livekit', 'agora').
23
24
  * Used for logging and debugging.
24
25
  */
25
26
  readonly name: string;
27
+ /**
28
+ * Pre-warm a future connection if the provider supports it.
29
+ * This should not establish a full RTC session or change connection state,
30
+ * but may warm DNS/TLS caches or select an edge region.
31
+ */
32
+ prepareConnection?(config: RTCPrepareConnectionConfig): Promise<void>;
26
33
  /**
27
34
  * Connect to RTC server.
28
35
  * @param config - Connection configuration containing server URL and credentials
@@ -41,9 +48,9 @@ export interface RTCProvider {
41
48
  getConnectionState(): string;
42
49
  /**
43
50
  * Publish local audio track (microphone) to the RTC server.
44
- * @param track - MediaStreamTrack from getUserMedia
51
+ * @param track - Optional MediaStreamTrack from getUserMedia; when omitted the provider may create a microphone track
45
52
  */
46
- publishAudioTrack(track: MediaStreamTrack): Promise<void>;
53
+ publishAudioTrack(track?: MediaStreamTrack): Promise<void>;
47
54
  /**
48
55
  * Unpublish audio track from the RTC server.
49
56
  */
@@ -53,13 +60,13 @@ export interface RTCProvider {
53
60
  * @param event - Event name
54
61
  * @param handler - Event handler function
55
62
  */
56
- on(event: string, handler: Function): void;
63
+ on(event: string, handler: RTCProviderEventHandler): void;
57
64
  /**
58
65
  * Remove event listener.
59
66
  * @param event - Event name
60
67
  * @param handler - Event handler function
61
68
  */
62
- off(event: string, handler: Function): void;
69
+ off(event: string, handler: RTCProviderEventHandler): void;
63
70
  /**
64
71
  * Get the native RTC client object.
65
72
  *
@@ -1 +1 @@
1
- {"version":3,"file":"RTCProvider.d.ts","sourceRoot":"","sources":["../../src/core/RTCProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAMpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;OAGG;IACH,kBAAkB,IAAI,MAAM,CAAC;IA4B7B;;;OAGG;IACH,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC;;;;OAIG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE3C;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE5C;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"RTCProvider.d.ts","sourceRoot":"","sources":["../../src/core/RTCProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAGhF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAEnE,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,iBAAiB,CAAC,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;OAGG;IACH,kBAAkB,IAAI,MAAM,CAAC;IA4B7B;;;OAGG;IACH,iBAAiB,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC;;;;OAIG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAE1D;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAE3D;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAAC;CAC5B"}
package/dist/index.d.ts CHANGED
@@ -9,8 +9,8 @@
9
9
  export { AvatarPlayer } from './core';
10
10
  export type { AvatarPlayerOptions } from './core';
11
11
  export { LiveKitProvider, AgoraProvider } from './providers';
12
- export type { AgoraProviderOptions, LiveKitRoom, AgoraClient } from './providers';
13
- export { ConnectionState, isLiveKitConfig, isAgoraConfig } from './types';
14
- export type { RTCConnectionConfig, LiveKitConnectionConfig, AgoraConnectionConfig, } from './types';
12
+ export type { AgoraProviderOptions, LiveKitRoom, AgoraClient, } from './providers';
13
+ export { ConnectionState, isLiveKitConfig, isLiveKitPrepareConfig, isAgoraConfig, } from './types';
14
+ export type { RTCConnectionConfig, RTCPrepareConnectionConfig, LiveKitConnectionConfig, LiveKitPrepareConnectionConfig, AgoraConnectionConfig, } from './types';
15
15
  export type { LogLevel } from './utils';
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1E,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import { AvatarPlayer } from "./index2.js";
2
2
  import { LiveKitProvider } from "./index3.js";
3
3
  import { AgoraProvider } from "./index4.js";
4
- import { ConnectionState, isAgoraConfig, isLiveKitConfig } from "./index5.js";
4
+ import { ConnectionState, isAgoraConfig, isLiveKitConfig, isLiveKitPrepareConfig } from "./index5.js";
5
5
  export {
6
6
  AgoraProvider,
7
7
  AvatarPlayer,
8
8
  ConnectionState,
9
9
  LiveKitProvider,
10
10
  isAgoraConfig,
11
- isLiveKitConfig
11
+ isLiveKitConfig,
12
+ isLiveKitPrepareConfig
12
13
  };
13
14
  //# sourceMappingURL=index.js.map
package/dist/index10.js CHANGED
@@ -1,75 +1,114 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { createAnimationReceiverTransform } from "./index14.js";
4
5
  import { logger } from "./index7.js";
5
- class BaseProvider {
6
+ import WorkerWrapper from "./index15.js";
7
+ const DEFAULT_TRANSITION_START_FRAMES = 8;
8
+ const DEFAULT_TRANSITION_END_FRAMES = 12;
9
+ class VP8Extractor {
6
10
  constructor() {
7
11
  /** @internal */
8
- __publicField(this, "connectionState", "disconnected");
12
+ __publicField(this, "callbacks", null);
9
13
  /** @internal */
10
- __publicField(this, "eventHandlers", /* @__PURE__ */ new Map());
14
+ __publicField(this, "receiver", null);
15
+ /** @internal */
16
+ __publicField(this, "transform", null);
11
17
  }
12
18
  /**
13
- * Add event listener.
14
- * @param event - Event name
15
- * @param handler - Event handler
19
+ * Initialize the extractor with a receiver and callbacks.
20
+ * @param receiver - RTCRtpReceiver to extract data from
21
+ * @param callbacks - Callbacks to receive extracted data
22
+ * @internal
16
23
  */
17
- on(event, handler) {
18
- if (!this.eventHandlers.has(event)) {
19
- this.eventHandlers.set(event, /* @__PURE__ */ new Set());
24
+ async initialize(receiver, callbacks) {
25
+ if (this.receiver || this.transform) {
26
+ throw new Error("VP8Extractor already initialized");
20
27
  }
21
- this.eventHandlers.get(event).add(handler);
28
+ this.receiver = receiver;
29
+ this.callbacks = callbacks;
30
+ if (receiver.transform) {
31
+ return;
32
+ }
33
+ const worker = new WorkerWrapper();
34
+ const onEvent = (evt) => {
35
+ this.handleTransformEvent(evt);
36
+ };
37
+ this.transform = createAnimationReceiverTransform(worker, onEvent);
38
+ receiver.transform = this.transform;
22
39
  }
23
40
  /**
24
- * Remove event listener.
25
- * @param event - Event name
26
- * @param handler - Event handler
41
+ * Handle events from the animation transform.
42
+ * @internal
27
43
  */
28
- off(event, handler) {
29
- const handlers = this.eventHandlers.get(event);
30
- if (handlers) {
31
- handlers.delete(handler);
44
+ handleTransformEvent(evt) {
45
+ if (!this.callbacks) return;
46
+ if (evt.type === "metadata") {
47
+ this.callbacks.onStreamStats({
48
+ framesPerSec: evt.framesPerSec,
49
+ totalFrames: evt.totalFrames ?? 0,
50
+ framesSent: evt.framesSent ?? 0,
51
+ framesLost: evt.framesLost ?? 0,
52
+ framesRecovered: evt.framesRecovered ?? 0,
53
+ framesDropped: evt.framesDropped ?? 0,
54
+ framesOutOfOrder: evt.framesOutOfOrder ?? 0,
55
+ framesDuplicate: evt.framesDuplicate ?? 0,
56
+ lastRenderedSeq: evt.lastRenderedSeq ?? -1
57
+ });
58
+ } else if (evt.type === "transition") {
59
+ this.callbacks.onTransition(
60
+ evt.protobufData,
61
+ DEFAULT_TRANSITION_START_FRAMES
62
+ );
63
+ } else if (evt.type === "transitionEnd") {
64
+ this.callbacks.onTransitionEnd(
65
+ evt.protobufData,
66
+ DEFAULT_TRANSITION_END_FRAMES
67
+ );
68
+ } else if (evt.type === "animation") {
69
+ if (!evt.isIdle) {
70
+ this.callbacks.onAnimationData(evt.protobufData, {
71
+ frameSeq: evt.frameSeq,
72
+ isStart: evt.isStart,
73
+ isEnd: evt.isEnd,
74
+ isIdle: evt.isIdle,
75
+ isRecovered: evt.isRecovered
76
+ });
77
+ }
78
+ } else if (evt.type === "idleStart") {
79
+ this.callbacks.onIdleStart();
80
+ } else if (evt.type === "error") {
81
+ logger.error("VP8Extractor", "Error:", evt.error);
32
82
  }
33
83
  }
34
84
  /**
35
- * Emit event to all listeners.
36
- * @param event - Event name
37
- * @param args - Event arguments
85
+ * Check if this extractor is connected to the given receiver.
86
+ * @param receiver - RTCRtpReceiver to check
87
+ * @returns true if connected to this receiver
38
88
  * @internal
39
89
  */
40
- emit(event, ...args) {
41
- const handlers = this.eventHandlers.get(event);
42
- if (handlers) {
43
- handlers.forEach((handler) => {
44
- try {
45
- handler(...args);
46
- } catch (error) {
47
- logger.error(this.name, `Error in event handler for ${event}:`, error);
48
- }
49
- });
50
- }
90
+ isConnectedTo(receiver) {
91
+ return this.receiver === receiver;
51
92
  }
52
93
  /**
53
- * Update connection state and emit event.
54
- * @param state - New connection state
94
+ * Get the receiver this extractor is connected to.
95
+ * @returns The connected RTCRtpReceiver or null
55
96
  * @internal
56
97
  */
57
- setConnectionState(state) {
58
- if (this.connectionState !== state) {
59
- const prevState = this.connectionState;
60
- this.connectionState = state;
61
- if (state === "disconnected" || state === "failed") {
62
- logger.error(this.name, `Connection state: ${prevState} -> ${state}`);
63
- } else if (state === "reconnecting") {
64
- logger.warn(this.name, `Connection state: ${prevState} -> ${state}`);
65
- } else {
66
- logger.info(this.name, `Connection state: ${prevState} -> ${state}`);
67
- }
68
- this.emit("connection-state-changed", state);
69
- }
98
+ getReceiver() {
99
+ return this.receiver;
100
+ }
101
+ /**
102
+ * Dispose the extractor and release resources.
103
+ * @internal
104
+ */
105
+ dispose() {
106
+ this.receiver = null;
107
+ this.transform = null;
108
+ this.callbacks = null;
70
109
  }
71
110
  }
72
111
  export {
73
- BaseProvider
112
+ VP8Extractor
74
113
  };
75
114
  //# sourceMappingURL=index10.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index10.js","sources":["../src/providers/base/BaseProvider.ts"],"sourcesContent":["/**\n * Base Provider - Common implementation for RTC providers.\n *\n * This class provides common functionality that can be shared\n * across different provider implementations.\n *\n * @internal\n * @packageDocumentation\n */\n\nimport type { RTCProviderEvents, AnimationTrackCallbacks, AudioTrackCallbacks } from '../../core/types';\nimport { logger } from '../../utils';\n\n/**\n * Base class for RTC providers.\n * Provides common event handling and state management.\n */\nexport abstract class BaseProvider {\n /** Provider name identifier */\n abstract readonly name: string;\n\n /** @internal */\n protected connectionState: string = 'disconnected';\n /** @internal */\n protected eventHandlers: Map<string, Set<Function>> = new Map();\n\n /**\n * Connect to RTC server.\n * @param config - Connection configuration\n */\n abstract connect(config: import('../../types').RTCConnectionConfig): Promise<void>;\n\n /**\n * Disconnect from RTC server.\n */\n abstract disconnect(): Promise<void>;\n\n /**\n * Get current connection state.\n */\n abstract getConnectionState(): string;\n\n /**\n * Subscribe to animation track.\n * @param callbacks - Animation track callbacks\n * @internal\n */\n abstract subscribeAnimationTrack(callbacks: AnimationTrackCallbacks): Promise<void>;\n\n /**\n * Unsubscribe from animation track.\n * @internal\n */\n abstract unsubscribeAnimationTrack(): Promise<void>;\n\n /**\n * Subscribe to audio track.\n * @param callbacks - Audio track callbacks\n * @internal\n */\n abstract subscribeAudioTrack(callbacks: AudioTrackCallbacks): Promise<void>;\n\n /**\n * Unsubscribe from audio track.\n * @internal\n */\n abstract unsubscribeAudioTrack(): Promise<void>;\n\n /**\n * Publish local audio track.\n * @param track - MediaStreamTrack to publish\n */\n abstract publishAudioTrack(track: MediaStreamTrack): Promise<void>;\n\n /**\n * Unpublish audio track.\n */\n abstract unpublishAudioTrack(): Promise<void>;\n\n /**\n * Get the native RTC client object.\n * @returns The native client, or null if not connected\n */\n abstract getNativeClient(): unknown;\n\n /**\n * Add event listener.\n * @param event - Event name\n * @param handler - Event handler\n */\n on(event: string, handler: Function): void {\n if (!this.eventHandlers.has(event)) {\n this.eventHandlers.set(event, new Set());\n }\n this.eventHandlers.get(event)!.add(handler);\n }\n\n /**\n * Remove event listener.\n * @param event - Event name\n * @param handler - Event handler\n */\n off(event: string, handler: Function): void {\n const handlers = this.eventHandlers.get(event);\n if (handlers) {\n handlers.delete(handler);\n }\n }\n\n /**\n * Emit event to all listeners.\n * @param event - Event name\n * @param args - Event arguments\n * @internal\n */\n protected emit<K extends keyof RTCProviderEvents>(\n event: K,\n ...args: Parameters<RTCProviderEvents[K]>\n ): void {\n const handlers = this.eventHandlers.get(event);\n if (handlers) {\n handlers.forEach((handler) => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (handler as any)(...args);\n } catch (error) {\n logger.error(this.name, `Error in event handler for ${event}:`, error);\n }\n });\n }\n }\n\n /**\n * Update connection state and emit event.\n * @param state - New connection state\n * @internal\n */\n protected setConnectionState(state: string): void {\n if (this.connectionState !== state) {\n const prevState = this.connectionState;\n this.connectionState = state;\n \n // Log connection state changes\n if (state === 'disconnected' || state === 'failed') {\n logger.error(this.name, `Connection state: ${prevState} -> ${state}`);\n } else if (state === 'reconnecting') {\n logger.warn(this.name, `Connection state: ${prevState} -> ${state}`);\n } else {\n logger.info(this.name, `Connection state: ${prevState} -> ${state}`);\n }\n \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.emit('connection-state-changed', state as any);\n }\n }\n}\n"],"names":[],"mappings":";;;;AAiBO,MAAe,aAAa;AAAA,EAA5B;AAKK;AAAA,2CAA0B;AAE1B;AAAA,6DAAgD,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkE1D,GAAG,OAAe,SAAyB;AACzC,QAAI,CAAC,KAAK,cAAc,IAAI,KAAK,GAAG;AAClC,WAAK,cAAc,IAAI,OAAO,oBAAI,KAAK;AAAA,IACzC;AACA,SAAK,cAAc,IAAI,KAAK,EAAG,IAAI,OAAO;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAe,SAAyB;AAC1C,UAAM,WAAW,KAAK,cAAc,IAAI,KAAK;AAC7C,QAAI,UAAU;AACZ,eAAS,OAAO,OAAO;AAAA,IACzB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQU,KACR,UACG,MACG;AACN,UAAM,WAAW,KAAK,cAAc,IAAI,KAAK;AAC7C,QAAI,UAAU;AACZ,eAAS,QAAQ,CAAC,YAAY;AAC5B,YAAI;AAED,kBAAgB,GAAG,IAAI;AAAA,QAC1B,SAAS,OAAO;AACd,iBAAO,MAAM,KAAK,MAAM,8BAA8B,KAAK,KAAK,KAAK;AAAA,QACvE;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOU,mBAAmB,OAAqB;AAChD,QAAI,KAAK,oBAAoB,OAAO;AAClC,YAAM,YAAY,KAAK;AACvB,WAAK,kBAAkB;AAGvB,UAAI,UAAU,kBAAkB,UAAU,UAAU;AAClD,eAAO,MAAM,KAAK,MAAM,qBAAqB,SAAS,OAAO,KAAK,EAAE;AAAA,MACtE,WAAW,UAAU,gBAAgB;AACnC,eAAO,KAAK,KAAK,MAAM,qBAAqB,SAAS,OAAO,KAAK,EAAE;AAAA,MACrE,OAAO;AACL,eAAO,KAAK,KAAK,MAAM,qBAAqB,SAAS,OAAO,KAAK,EAAE;AAAA,MACrE;AAGA,WAAK,KAAK,4BAA4B,KAAY;AAAA,IACpD;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"index10.js","sources":["../src/providers/livekit/VP8Extractor.ts"],"sourcesContent":["/**\n * VP8 Data Extractor for LiveKit.\n *\n * Extracts animation data from VP8 video tracks using RTCRtpScriptTransform.\n *\n * @internal\n * @packageDocumentation\n */\n\nimport type { AnimationTrackCallbacks } from '../../core/types';\nimport type { AnimationTransformEvent } from './types';\nimport { createAnimationReceiverTransform } from './animation-transform';\nimport { logger } from '../../utils';\n\n// Import worker with inline - this bundles the worker code as a blob URL\nimport AnimationWorker from './animation-worker.ts?worker&inline';\n\n// Default transition frame counts (used when protocol doesn't specify)\nconst DEFAULT_TRANSITION_START_FRAMES = 8;\nconst DEFAULT_TRANSITION_END_FRAMES = 12;\n\n/**\n * VP8Extractor - Extracts animation data from VP8 video tracks.\n *\n * Uses RTCRtpScriptTransform and a Web Worker to parse VP8 frames\n * and extract embedded animation data.\n *\n * @internal\n */\nexport class VP8Extractor {\n /** @internal */\n private callbacks: AnimationTrackCallbacks | null = null;\n /** @internal */\n private receiver: RTCRtpReceiver | null = null;\n /** @internal */\n private transform: RTCRtpScriptTransform | null = null;\n\n /**\n * Initialize the extractor with a receiver and callbacks.\n * @param receiver - RTCRtpReceiver to extract data from\n * @param callbacks - Callbacks to receive extracted data\n * @internal\n */\n async initialize(\n receiver: RTCRtpReceiver,\n callbacks: AnimationTrackCallbacks,\n ): Promise<void> {\n if (this.receiver || this.transform) {\n throw new Error('VP8Extractor already initialized');\n }\n\n this.receiver = receiver;\n this.callbacks = callbacks;\n\n // Check if transform is already set\n if (receiver.transform) {\n return;\n }\n\n // Create worker and transform\n const worker = new AnimationWorker();\n const onEvent = (evt: AnimationTransformEvent) => {\n this.handleTransformEvent(evt);\n };\n\n this.transform = createAnimationReceiverTransform(worker, onEvent);\n receiver.transform = this.transform;\n }\n\n /**\n * Handle events from the animation transform.\n * @internal\n */\n private handleTransformEvent(evt: AnimationTransformEvent): void {\n if (!this.callbacks) return;\n\n if (evt.type === 'metadata') {\n this.callbacks.onStreamStats({\n framesPerSec: evt.framesPerSec,\n totalFrames: evt.totalFrames ?? 0,\n framesSent: evt.framesSent ?? 0,\n framesLost: evt.framesLost ?? 0,\n framesRecovered: evt.framesRecovered ?? 0,\n framesDropped: evt.framesDropped ?? 0,\n framesOutOfOrder: evt.framesOutOfOrder ?? 0,\n framesDuplicate: evt.framesDuplicate ?? 0,\n lastRenderedSeq: evt.lastRenderedSeq ?? -1,\n });\n } else if (evt.type === 'transition') {\n this.callbacks.onTransition(\n evt.protobufData,\n DEFAULT_TRANSITION_START_FRAMES,\n );\n } else if (evt.type === 'transitionEnd') {\n this.callbacks.onTransitionEnd(\n evt.protobufData,\n DEFAULT_TRANSITION_END_FRAMES,\n );\n } else if (evt.type === 'animation') {\n if (!evt.isIdle) {\n this.callbacks.onAnimationData(evt.protobufData, {\n frameSeq: evt.frameSeq,\n isStart: evt.isStart,\n isEnd: evt.isEnd,\n isIdle: evt.isIdle,\n isRecovered: evt.isRecovered,\n });\n }\n } else if (evt.type === 'idleStart') {\n this.callbacks.onIdleStart();\n } else if (evt.type === 'error') {\n logger.error('VP8Extractor', 'Error:', evt.error);\n }\n }\n\n /**\n * Check if this extractor is connected to the given receiver.\n * @param receiver - RTCRtpReceiver to check\n * @returns true if connected to this receiver\n * @internal\n */\n isConnectedTo(receiver: RTCRtpReceiver): boolean {\n return this.receiver === receiver;\n }\n\n /**\n * Get the receiver this extractor is connected to.\n * @returns The connected RTCRtpReceiver or null\n * @internal\n */\n getReceiver(): RTCRtpReceiver | null {\n return this.receiver;\n }\n\n /**\n * Dispose the extractor and release resources.\n * @internal\n */\n dispose(): void {\n this.receiver = null;\n this.transform = null;\n this.callbacks = null;\n }\n}\n"],"names":["AnimationWorker"],"mappings":";;;;;;AAkBA,MAAM,kCAAkC;AACxC,MAAM,gCAAgC;AAU/B,MAAM,aAAa;AAAA,EAAnB;AAEG;AAAA,qCAA4C;AAE5C;AAAA,oCAAkC;AAElC;AAAA,qCAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,WACJ,UACA,WACe;AACf,QAAI,KAAK,YAAY,KAAK,WAAW;AACnC,YAAM,IAAI,MAAM,kCAAkC;AAAA,IACpD;AAEA,SAAK,WAAW;AAChB,SAAK,YAAY;AAGjB,QAAI,SAAS,WAAW;AACtB;AAAA,IACF;AAGA,UAAM,SAAS,IAAIA,cAAA;AACnB,UAAM,UAAU,CAAC,QAAiC;AAChD,WAAK,qBAAqB,GAAG;AAAA,IAC/B;AAEA,SAAK,YAAY,iCAAiC,QAAQ,OAAO;AACjE,aAAS,YAAY,KAAK;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,qBAAqB,KAAoC;AAC/D,QAAI,CAAC,KAAK,UAAW;AAErB,QAAI,IAAI,SAAS,YAAY;AAC3B,WAAK,UAAU,cAAc;AAAA,QAC3B,cAAc,IAAI;AAAA,QAClB,aAAa,IAAI,eAAe;AAAA,QAChC,YAAY,IAAI,cAAc;AAAA,QAC9B,YAAY,IAAI,cAAc;AAAA,QAC9B,iBAAiB,IAAI,mBAAmB;AAAA,QACxC,eAAe,IAAI,iBAAiB;AAAA,QACpC,kBAAkB,IAAI,oBAAoB;AAAA,QAC1C,iBAAiB,IAAI,mBAAmB;AAAA,QACxC,iBAAiB,IAAI,mBAAmB;AAAA,MAAA,CACzC;AAAA,IACH,WAAW,IAAI,SAAS,cAAc;AACpC,WAAK,UAAU;AAAA,QACb,IAAI;AAAA,QACJ;AAAA,MAAA;AAAA,IAEJ,WAAW,IAAI,SAAS,iBAAiB;AACvC,WAAK,UAAU;AAAA,QACb,IAAI;AAAA,QACJ;AAAA,MAAA;AAAA,IAEJ,WAAW,IAAI,SAAS,aAAa;AACnC,UAAI,CAAC,IAAI,QAAQ;AACf,aAAK,UAAU,gBAAgB,IAAI,cAAc;AAAA,UAC/C,UAAU,IAAI;AAAA,UACd,SAAS,IAAI;AAAA,UACb,OAAO,IAAI;AAAA,UACX,QAAQ,IAAI;AAAA,UACZ,aAAa,IAAI;AAAA,QAAA,CAClB;AAAA,MACH;AAAA,IACF,WAAW,IAAI,SAAS,aAAa;AACnC,WAAK,UAAU,YAAA;AAAA,IACjB,WAAW,IAAI,SAAS,SAAS;AAC/B,aAAO,MAAM,gBAAgB,UAAU,IAAI,KAAK;AAAA,IAClD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cAAc,UAAmC;AAC/C,WAAO,KAAK,aAAa;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAqC;AACnC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAgB;AACd,SAAK,WAAW;AAChB,SAAK,YAAY;AACjB,SAAK,YAAY;AAAA,EACnB;AACF;"}
package/dist/index11.js CHANGED
@@ -1,108 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { createAnimationReceiverTransform } from "./index14.js";
5
- import { logger } from "./index7.js";
6
- import WorkerWrapper from "./index15.js";
7
- const DEFAULT_TRANSITION_START_FRAMES = 8;
8
- const DEFAULT_TRANSITION_END_FRAMES = 12;
9
- class VP8Extractor {
10
- constructor() {
11
- /** @internal */
12
- __publicField(this, "callbacks", null);
13
- /** @internal */
14
- __publicField(this, "receiver", null);
15
- /** @internal */
16
- __publicField(this, "transform", null);
17
- }
18
- /**
19
- * Initialize the extractor with a receiver and callbacks.
20
- * @param receiver - RTCRtpReceiver to extract data from
21
- * @param callbacks - Callbacks to receive extracted data
22
- * @internal
23
- */
24
- async initialize(receiver, callbacks) {
25
- if (this.receiver || this.transform) {
26
- throw new Error("VP8Extractor already initialized");
27
- }
28
- this.receiver = receiver;
29
- this.callbacks = callbacks;
30
- if (receiver.transform) {
31
- return;
32
- }
33
- const worker = new WorkerWrapper();
34
- const onEvent = (evt) => {
35
- this.handleTransformEvent(evt);
36
- };
37
- this.transform = createAnimationReceiverTransform(worker, onEvent);
38
- receiver.transform = this.transform;
39
- }
40
- /**
41
- * Handle events from the animation transform.
42
- * @internal
43
- */
44
- handleTransformEvent(evt) {
45
- if (!this.callbacks) return;
46
- if (evt.type === "metadata") {
47
- this.callbacks.onStreamStats({
48
- framesPerSec: evt.framesPerSec,
49
- totalFrames: evt.totalFrames ?? 0,
50
- framesSent: evt.framesSent ?? 0,
51
- framesLost: evt.framesLost ?? 0,
52
- framesRecovered: evt.framesRecovered ?? 0,
53
- framesDropped: evt.framesDropped ?? 0,
54
- framesOutOfOrder: evt.framesOutOfOrder ?? 0,
55
- framesDuplicate: evt.framesDuplicate ?? 0,
56
- lastRenderedSeq: evt.lastRenderedSeq ?? -1
57
- });
58
- } else if (evt.type === "transition") {
59
- this.callbacks.onTransition(evt.protobufData, DEFAULT_TRANSITION_START_FRAMES);
60
- } else if (evt.type === "transitionEnd") {
61
- this.callbacks.onTransitionEnd(evt.protobufData, DEFAULT_TRANSITION_END_FRAMES);
62
- } else if (evt.type === "animation") {
63
- if (!evt.isIdle) {
64
- this.callbacks.onAnimationData(evt.protobufData, {
65
- frameSeq: evt.frameSeq,
66
- isStart: evt.isStart,
67
- isEnd: evt.isEnd,
68
- isIdle: evt.isIdle,
69
- isRecovered: evt.isRecovered
70
- });
71
- }
72
- } else if (evt.type === "idleStart") {
73
- this.callbacks.onIdleStart();
74
- } else if (evt.type === "error") {
75
- logger.error("VP8Extractor", "Error:", evt.error);
76
- }
77
- }
78
- /**
79
- * Check if this extractor is connected to the given receiver.
80
- * @param receiver - RTCRtpReceiver to check
81
- * @returns true if connected to this receiver
82
- * @internal
83
- */
84
- isConnectedTo(receiver) {
85
- return this.receiver === receiver;
86
- }
87
- /**
88
- * Get the receiver this extractor is connected to.
89
- * @returns The connected RTCRtpReceiver or null
90
- * @internal
91
- */
92
- getReceiver() {
93
- return this.receiver;
94
- }
95
- /**
96
- * Dispose the extractor and release resources.
97
- * @internal
98
- */
99
- dispose() {
100
- this.receiver = null;
101
- this.transform = null;
102
- this.callbacks = null;
103
- }
1
+ function supportsScriptTransform() {
2
+ return typeof RTCRtpScriptTransform !== "undefined";
3
+ }
4
+ function supportsEncodedStreams() {
5
+ var _a;
6
+ return typeof ((_a = RTCRtpSender == null ? void 0 : RTCRtpSender.prototype) == null ? void 0 : _a.createEncodedStreams) === "function";
7
+ }
8
+ function getInsertableStreamsMethod() {
9
+ if (supportsScriptTransform()) return "scriptTransform";
10
+ if (supportsEncodedStreams()) return "encodedStreams";
11
+ return null;
104
12
  }
105
13
  export {
106
- VP8Extractor
14
+ getInsertableStreamsMethod,
15
+ supportsEncodedStreams,
16
+ supportsScriptTransform
107
17
  };
108
18
  //# sourceMappingURL=index11.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index11.js","sources":["../src/providers/livekit/VP8Extractor.ts"],"sourcesContent":["/**\n * VP8 Data Extractor for LiveKit.\n *\n * Extracts animation data from VP8 video tracks using RTCRtpScriptTransform.\n *\n * @internal\n * @packageDocumentation\n */\n\nimport type { AnimationTrackCallbacks } from '../../core/types';\nimport type { AnimationTransformEvent } from './types';\nimport { createAnimationReceiverTransform } from './animation-transform';\nimport { logger } from '../../utils';\n\n// Import worker with inline - this bundles the worker code as a blob URL\nimport AnimationWorker from './animation-worker.ts?worker&inline';\n\n// Default transition frame counts (used when protocol doesn't specify)\nconst DEFAULT_TRANSITION_START_FRAMES = 8;\nconst DEFAULT_TRANSITION_END_FRAMES = 12;\n\n/**\n * VP8Extractor - Extracts animation data from VP8 video tracks.\n *\n * Uses RTCRtpScriptTransform and a Web Worker to parse VP8 frames\n * and extract embedded animation data.\n *\n * @internal\n */\nexport class VP8Extractor {\n /** @internal */\n private callbacks: AnimationTrackCallbacks | null = null;\n /** @internal */\n private receiver: RTCRtpReceiver | null = null;\n /** @internal */\n private transform: RTCRtpScriptTransform | null = null;\n\n /**\n * Initialize the extractor with a receiver and callbacks.\n * @param receiver - RTCRtpReceiver to extract data from\n * @param callbacks - Callbacks to receive extracted data\n * @internal\n */\n async initialize(\n receiver: RTCRtpReceiver,\n callbacks: AnimationTrackCallbacks\n ): Promise<void> {\n if (this.receiver || this.transform) {\n throw new Error('VP8Extractor already initialized');\n }\n\n this.receiver = receiver;\n this.callbacks = callbacks;\n\n // Check if transform is already set\n if (receiver.transform) {\n return;\n }\n\n // Create worker and transform\n const worker = new AnimationWorker();\n const onEvent = (evt: AnimationTransformEvent) => {\n this.handleTransformEvent(evt);\n };\n\n this.transform = createAnimationReceiverTransform(worker, onEvent);\n receiver.transform = this.transform;\n }\n\n /**\n * Handle events from the animation transform.\n * @internal\n */\n private handleTransformEvent(evt: AnimationTransformEvent): void {\n if (!this.callbacks) return;\n\n if (evt.type === 'metadata') {\n this.callbacks.onStreamStats({\n framesPerSec: evt.framesPerSec,\n totalFrames: evt.totalFrames ?? 0,\n framesSent: evt.framesSent ?? 0,\n framesLost: evt.framesLost ?? 0,\n framesRecovered: evt.framesRecovered ?? 0,\n framesDropped: evt.framesDropped ?? 0,\n framesOutOfOrder: evt.framesOutOfOrder ?? 0,\n framesDuplicate: evt.framesDuplicate ?? 0,\n lastRenderedSeq: evt.lastRenderedSeq ?? -1,\n });\n } else if (evt.type === 'transition') {\n this.callbacks.onTransition(evt.protobufData, DEFAULT_TRANSITION_START_FRAMES);\n } else if (evt.type === 'transitionEnd') {\n this.callbacks.onTransitionEnd(evt.protobufData, DEFAULT_TRANSITION_END_FRAMES);\n } else if (evt.type === 'animation') {\n if (!evt.isIdle) {\n this.callbacks.onAnimationData(evt.protobufData, {\n frameSeq: evt.frameSeq,\n isStart: evt.isStart,\n isEnd: evt.isEnd,\n isIdle: evt.isIdle,\n isRecovered: evt.isRecovered,\n });\n }\n } else if (evt.type === 'idleStart') {\n this.callbacks.onIdleStart();\n } else if (evt.type === 'error') {\n logger.error('VP8Extractor', 'Error:', evt.error);\n }\n }\n\n /**\n * Check if this extractor is connected to the given receiver.\n * @param receiver - RTCRtpReceiver to check\n * @returns true if connected to this receiver\n * @internal\n */\n isConnectedTo(receiver: RTCRtpReceiver): boolean {\n return this.receiver === receiver;\n }\n\n /**\n * Get the receiver this extractor is connected to.\n * @returns The connected RTCRtpReceiver or null\n * @internal\n */\n getReceiver(): RTCRtpReceiver | null {\n return this.receiver;\n }\n\n /**\n * Dispose the extractor and release resources.\n * @internal\n */\n dispose(): void {\n this.receiver = null;\n this.transform = null;\n this.callbacks = null;\n }\n}\n"],"names":["AnimationWorker"],"mappings":";;;;;;AAkBA,MAAM,kCAAkC;AACxC,MAAM,gCAAgC;AAU/B,MAAM,aAAa;AAAA,EAAnB;AAEG;AAAA,qCAA4C;AAE5C;AAAA,oCAAkC;AAElC;AAAA,qCAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,WACJ,UACA,WACe;AACf,QAAI,KAAK,YAAY,KAAK,WAAW;AACnC,YAAM,IAAI,MAAM,kCAAkC;AAAA,IACpD;AAEA,SAAK,WAAW;AAChB,SAAK,YAAY;AAGjB,QAAI,SAAS,WAAW;AACtB;AAAA,IACF;AAGA,UAAM,SAAS,IAAIA,cAAA;AACnB,UAAM,UAAU,CAAC,QAAiC;AAChD,WAAK,qBAAqB,GAAG;AAAA,IAC/B;AAEA,SAAK,YAAY,iCAAiC,QAAQ,OAAO;AACjE,aAAS,YAAY,KAAK;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,qBAAqB,KAAoC;AAC/D,QAAI,CAAC,KAAK,UAAW;AAErB,QAAI,IAAI,SAAS,YAAY;AAC3B,WAAK,UAAU,cAAc;AAAA,QAC3B,cAAc,IAAI;AAAA,QAClB,aAAa,IAAI,eAAe;AAAA,QAChC,YAAY,IAAI,cAAc;AAAA,QAC9B,YAAY,IAAI,cAAc;AAAA,QAC9B,iBAAiB,IAAI,mBAAmB;AAAA,QACxC,eAAe,IAAI,iBAAiB;AAAA,QACpC,kBAAkB,IAAI,oBAAoB;AAAA,QAC1C,iBAAiB,IAAI,mBAAmB;AAAA,QACxC,iBAAiB,IAAI,mBAAmB;AAAA,MAAA,CACzC;AAAA,IACH,WAAW,IAAI,SAAS,cAAc;AACpC,WAAK,UAAU,aAAa,IAAI,cAAc,+BAA+B;AAAA,IAC/E,WAAW,IAAI,SAAS,iBAAiB;AACvC,WAAK,UAAU,gBAAgB,IAAI,cAAc,6BAA6B;AAAA,IAChF,WAAW,IAAI,SAAS,aAAa;AACnC,UAAI,CAAC,IAAI,QAAQ;AACf,aAAK,UAAU,gBAAgB,IAAI,cAAc;AAAA,UAC/C,UAAU,IAAI;AAAA,UACd,SAAS,IAAI;AAAA,UACb,OAAO,IAAI;AAAA,UACX,QAAQ,IAAI;AAAA,UACZ,aAAa,IAAI;AAAA,QAAA,CAClB;AAAA,MACH;AAAA,IACF,WAAW,IAAI,SAAS,aAAa;AACnC,WAAK,UAAU,YAAA;AAAA,IACjB,WAAW,IAAI,SAAS,SAAS;AAC/B,aAAO,MAAM,gBAAgB,UAAU,IAAI,KAAK;AAAA,IAClD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cAAc,UAAmC;AAC/C,WAAO,KAAK,aAAa;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAqC;AACnC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAgB;AACd,SAAK,WAAW;AAChB,SAAK,YAAY;AACjB,SAAK,YAAY;AAAA,EACnB;AACF;"}
1
+ {"version":3,"file":"index11.js","sources":["../src/providers/livekit/utils.ts"],"sourcesContent":["/**\n * Insertable Streams utilities.\n *\n * Note: Audio tracks no longer embed metadata - animation data is now sent via a separate video track.\n * These utilities are kept for potential future use and backwards compatibility.\n *\n * @internal\n * @packageDocumentation\n */\n\n/**\n * Check if browser supports RTCRtpScriptTransform (the modern Insertable Streams API).\n * @returns true if RTCRtpScriptTransform is available\n * @internal\n */\nexport function supportsScriptTransform(): boolean {\n return typeof RTCRtpScriptTransform !== 'undefined';\n}\n\n/**\n * Check if browser supports createEncodedStreams (older Insertable Streams API).\n * @returns true if createEncodedStreams is available\n * @internal\n */\nexport function supportsEncodedStreams(): boolean {\n // This is deprecated but still works in some browsers\n // @ts-expect-error - experimental API\n return typeof RTCRtpSender?.prototype?.createEncodedStreams === 'function';\n}\n\n/**\n * Insertable Streams method type.\n * @internal\n */\nexport type InsertableStreamsMethod =\n | 'scriptTransform'\n | 'encodedStreams'\n | null;\n\n/**\n * Get supported Insertable Streams method.\n * @returns The supported method or null if none available\n * @internal\n */\nexport function getInsertableStreamsMethod(): InsertableStreamsMethod {\n if (supportsScriptTransform()) return 'scriptTransform';\n if (supportsEncodedStreams()) return 'encodedStreams';\n return null;\n}\n"],"names":[],"mappings":"AAeO,SAAS,0BAAmC;AACjD,SAAO,OAAO,0BAA0B;AAC1C;AAOO,SAAS,yBAAkC;AAT3C;AAYL,SAAO,SAAO,kDAAc,cAAd,mBAAyB,0BAAyB;AAClE;AAgBO,SAAS,6BAAsD;AACpE,MAAI,wBAAA,EAA2B,QAAO;AACtC,MAAI,uBAAA,EAA0B,QAAO;AACrC,SAAO;AACT;"}