@arbidocs/react 0.5.177 → 0.5.179
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/dist/artifacts/index.cjs +1 -1
- package/dist/calls/gate.js +11 -1
- package/dist/calls/gate.js.map +2 -2
- package/dist/calls/livekit/call-media-player.js +131 -0
- package/dist/calls/livekit/call-media-player.js.map +7 -0
- package/dist/calls/livekit/index.cjs +240 -41
- package/dist/calls/livekit/index.cjs.map +1 -1
- package/dist/calls/livekit/index.d.ts +40 -1
- package/dist/calls/livekit/index.js +5 -0
- package/dist/calls/livekit/index.js.map +2 -2
- package/dist/calls/livekit/useCallMedia.js +78 -0
- package/dist/calls/livekit/useCallMedia.js.map +7 -0
- package/dist/{chunk-3IBQW2UD.cjs → chunk-CWNBKVMV.cjs} +3 -3
- package/dist/{chunk-3IBQW2UD.cjs.map → chunk-CWNBKVMV.cjs.map} +1 -1
- package/dist/{chunk-UMQY6L7P.cjs → chunk-SVIDS6ST.cjs} +3 -3
- package/dist/{chunk-UMQY6L7P.cjs.map → chunk-SVIDS6ST.cjs.map} +1 -1
- package/dist/{chunk-C5O4BH7B.cjs → chunk-VCYRQZ3R.cjs} +10 -2
- package/dist/chunk-VCYRQZ3R.cjs.map +1 -0
- package/dist/{chunk-UR5F4DNJ.cjs → chunk-WU47JY4V.cjs} +3 -3
- package/dist/{chunk-UR5F4DNJ.cjs.map → chunk-WU47JY4V.cjs.map} +1 -1
- package/dist/document-tools/core.cjs +64 -64
- package/dist/document-tools/index.cjs +64 -64
- package/dist/index.cjs +707 -703
- package/dist/index.d.ts +6 -1
- package/dist/shell/index.cjs +39 -39
- package/dist/ui/index.cjs +162 -162
- package/package.json +3 -3
- package/dist/chunk-C5O4BH7B.cjs.map +0 -1
package/dist/artifacts/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ var chunk5QOZLKAY_cjs = require('../chunk-5QOZLKAY.cjs');
|
|
|
8
8
|
require('../chunk-N73IMVFF.cjs');
|
|
9
9
|
var chunkDQODLWFX_cjs = require('../chunk-DQODLWFX.cjs');
|
|
10
10
|
require('../chunk-5NOZDH3F.cjs');
|
|
11
|
-
require('../chunk-S6A6FSG7.cjs');
|
|
12
11
|
var chunkVOFNX4P6_cjs = require('../chunk-VOFNX4P6.cjs');
|
|
12
|
+
require('../chunk-S6A6FSG7.cjs');
|
|
13
13
|
var react = require('react');
|
|
14
14
|
var reactQuery = require('@tanstack/react-query');
|
|
15
15
|
var jsxRuntime = require('react/jsx-runtime');
|
package/dist/calls/gate.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { useFeature } from "../host/features.js";
|
|
2
2
|
import { useIsEntitled } from "../account/entitlements.js";
|
|
3
|
-
import { useServerCallsEnabled, useServerCallsExperimental } from "./hooks.js";
|
|
3
|
+
import { useCallsConfig, useServerCallsEnabled, useServerCallsExperimental } from "./hooks.js";
|
|
4
|
+
import { useUserSettings } from "../account/settings.js";
|
|
5
|
+
import { useArbiHost } from "../host/config.js";
|
|
4
6
|
function useCallsEnabled() {
|
|
5
7
|
const serverEnabled = useServerCallsEnabled();
|
|
6
8
|
const experimental = useServerCallsExperimental();
|
|
7
9
|
const switchedOn = useFeature("calls");
|
|
8
10
|
return serverEnabled && (switchedOn || !experimental);
|
|
9
11
|
}
|
|
12
|
+
function useCallAvatarsEnabled() {
|
|
13
|
+
const explicitlyConfigured = !!useArbiHost().features?.callAvatars;
|
|
14
|
+
const feature = useFeature("callAvatars");
|
|
15
|
+
const config = useCallsConfig();
|
|
16
|
+
const { data: settings } = useUserSettings();
|
|
17
|
+
return explicitlyConfigured && feature && config?.avatar_available === true && settings?.developer === true;
|
|
18
|
+
}
|
|
10
19
|
function useCanHostCalls() {
|
|
11
20
|
const callsEnabled = useCallsEnabled();
|
|
12
21
|
const entitled = useIsEntitled("host_calls");
|
|
13
22
|
return callsEnabled && entitled;
|
|
14
23
|
}
|
|
15
24
|
export {
|
|
25
|
+
useCallAvatarsEnabled,
|
|
16
26
|
useCallsEnabled,
|
|
17
27
|
useCanHostCalls
|
|
18
28
|
};
|
package/dist/calls/gate.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/calls/gate.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The call-UI gate. The call UI (call buttons, the incoming-call ringer, upcoming calls) shows only\n * when the server has calls enabled AND the host's `calls` feature is on (`useFeature('calls')`:\n * ARBI's Settings \u2192 Experimental toggle; a host that does not list it, on). The switch is an\n * experimental opt-in: on a deployment where calls are not experimental (`experimental: false`) the\n * call UI shows whatever it says. A call link opens whenever the server has calls enabled.\n */\n\nimport { useFeature } from '../host/features'\nimport { useIsEntitled } from '../account/entitlements'\nimport { useServerCallsEnabled, useServerCallsExperimental } from './hooks'\n\n/** The call UI shows: the server has calls AND (they are not experimental there OR the host's switch is on). */\nexport function useCallsEnabled(): boolean {\n const serverEnabled = useServerCallsEnabled()\n const experimental = useServerCallsExperimental()\n const switchedOn = useFeature('calls')\n return serverEnabled && (switchedOn || !experimental)\n}\n\n/**\n * Whether the person may HOST calls (start or schedule one, record one): the call UI is on and they\n * are entitled (Pro on the hosted service, an internal user on a Box). Joining a call someone else\n * hosts needs only `useCallsEnabled`.\n */\nexport function useCanHostCalls(): boolean {\n const callsEnabled = useCallsEnabled()\n const entitled = useIsEntitled('host_calls')\n return callsEnabled && entitled\n}\n"],
|
|
5
|
-
"mappings": "AAQA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB,kCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * The call-UI gate. The call UI (call buttons, the incoming-call ringer, upcoming calls) shows only\n * when the server has calls enabled AND the host's `calls` feature is on (`useFeature('calls')`:\n * ARBI's Settings \u2192 Experimental toggle; a host that does not list it, on). The switch is an\n * experimental opt-in: on a deployment where calls are not experimental (`experimental: false`) the\n * call UI shows whatever it says. A call link opens whenever the server has calls enabled.\n */\n\nimport { useFeature } from '../host/features'\nimport { useIsEntitled } from '../account/entitlements'\nimport { useCallsConfig, useServerCallsEnabled, useServerCallsExperimental } from './hooks'\nimport { useUserSettings } from '../account/settings'\nimport { useArbiHost } from '../host/config'\n\n/** The call UI shows: the server has calls AND (they are not experimental there OR the host's switch is on). */\nexport function useCallsEnabled(): boolean {\n const serverEnabled = useServerCallsEnabled()\n const experimental = useServerCallsExperimental()\n const switchedOn = useFeature('calls')\n return serverEnabled && (switchedOn || !experimental)\n}\n\n/** The default-off avatar experiment requires both the deployment and a developer's opt-in. */\nexport function useCallAvatarsEnabled(): boolean {\n const explicitlyConfigured = !!useArbiHost().features?.callAvatars\n const feature = useFeature('callAvatars')\n const config = useCallsConfig()\n const { data: settings } = useUserSettings()\n return (\n explicitlyConfigured &&\n feature &&\n config?.avatar_available === true &&\n settings?.developer === true\n )\n}\n\n/**\n * Whether the person may HOST calls (start or schedule one, record one): the call UI is on and they\n * are entitled (Pro on the hosted service, an internal user on a Box). Joining a call someone else\n * hosts needs only `useCallsEnabled`.\n */\nexport function useCanHostCalls(): boolean {\n const callsEnabled = useCallsEnabled()\n const entitled = useIsEntitled('host_calls')\n return callsEnabled && entitled\n}\n"],
|
|
5
|
+
"mappings": "AAQA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,uBAAuB,kCAAkC;AAClF,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAGrB,SAAS,kBAA2B;AACzC,QAAM,gBAAgB,sBAAsB;AAC5C,QAAM,eAAe,2BAA2B;AAChD,QAAM,aAAa,WAAW,OAAO;AACrC,SAAO,kBAAkB,cAAc,CAAC;AAC1C;AAGO,SAAS,wBAAiC;AAC/C,QAAM,uBAAuB,CAAC,CAAC,YAAY,EAAE,UAAU;AACvD,QAAM,UAAU,WAAW,aAAa;AACxC,QAAM,SAAS,eAAe;AAC9B,QAAM,EAAE,MAAM,SAAS,IAAI,gBAAgB;AAC3C,SACE,wBACA,WACA,QAAQ,qBAAqB,QAC7B,UAAU,cAAc;AAE5B;AAOO,SAAS,kBAA2B;AACzC,QAAM,eAAe,gBAAgB;AACrC,QAAM,WAAW,cAAc,YAAY;AAC3C,SAAO,gBAAgB;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { base64ToBytes } from "@arbidocs/client";
|
|
2
|
+
function checkedCallMedia(value, participant) {
|
|
3
|
+
if (!value || typeof value !== "object") throw new Error("Invalid call media");
|
|
4
|
+
const v = value;
|
|
5
|
+
if (v.protocol !== "arbi.call.media.v1" || v.participant !== participant || typeof v.utterance_id !== "string" || v.utterance_id.length > 64 || !Number.isSafeInteger(v.sequence) || Number(v.sequence) < 0 || !["start", "media", "end", "stop", "fallback"].includes(String(v.type)))
|
|
6
|
+
throw new Error("Invalid call media identity or sequence");
|
|
7
|
+
if (v.type === "start" && (v.sample_rate !== 24e3 || v.fps !== 60 || typeof v.avatar !== "string" || !Array.isArray(v.names) || v.names.length !== 52 || new Set(v.names).size !== 52 || !v.names.every((name) => typeof name === "string" && name.length < 80)))
|
|
8
|
+
throw new Error("Invalid call media configuration");
|
|
9
|
+
if (v.type === "media" && (!Number.isSafeInteger(v.start_sample) || Number(v.start_sample) < 0 || typeof v.pcm !== "string" || v.pcm.length > 6400 || !Array.isArray(v.frames) || !v.frames.length || v.frames.length > 6 || !v.frames.every(
|
|
10
|
+
(frame) => Array.isArray(frame) && frame.length === 52 && frame.every(
|
|
11
|
+
(x) => typeof x === "number" && Number.isFinite(x) && x >= -2 && x <= 2
|
|
12
|
+
)
|
|
13
|
+
)))
|
|
14
|
+
throw new Error("Invalid call media samples");
|
|
15
|
+
return v;
|
|
16
|
+
}
|
|
17
|
+
class CallMediaPlayer {
|
|
18
|
+
constructor(context, changed) {
|
|
19
|
+
this.context = context;
|
|
20
|
+
this.changed = changed;
|
|
21
|
+
this.recording = context.createMediaStreamDestination();
|
|
22
|
+
}
|
|
23
|
+
context;
|
|
24
|
+
changed;
|
|
25
|
+
active = false;
|
|
26
|
+
/** Retain transport ownership between utterances; reattaching RTC can replay its buffered tail. */
|
|
27
|
+
suppressesTrack = false;
|
|
28
|
+
avatar = "";
|
|
29
|
+
names = [];
|
|
30
|
+
utterance = "";
|
|
31
|
+
sequence = -1;
|
|
32
|
+
nextSample = 0;
|
|
33
|
+
nextTime = 0;
|
|
34
|
+
segments = [];
|
|
35
|
+
sources = /* @__PURE__ */ new Set();
|
|
36
|
+
seen = /* @__PURE__ */ new Set();
|
|
37
|
+
finishTimer;
|
|
38
|
+
recording;
|
|
39
|
+
push(message) {
|
|
40
|
+
if (message.type === "fallback" && message.sequence === 0 && message.utterance_id !== this.utterance) {
|
|
41
|
+
if (this.seen.has(message.utterance_id)) return;
|
|
42
|
+
this.utterance = message.utterance_id;
|
|
43
|
+
this.sequence = 0;
|
|
44
|
+
this.seen.add(message.utterance_id);
|
|
45
|
+
if (this.seen.size > 64) this.seen.delete(this.seen.values().next().value);
|
|
46
|
+
this.reset(true);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (message.type === "start") {
|
|
50
|
+
if (message.sequence !== 0 || this.seen.has(message.utterance_id)) return;
|
|
51
|
+
this.reset();
|
|
52
|
+
this.seen.add(message.utterance_id);
|
|
53
|
+
if (this.seen.size > 64) this.seen.delete(this.seen.values().next().value);
|
|
54
|
+
this.utterance = message.utterance_id;
|
|
55
|
+
this.avatar = message.avatar;
|
|
56
|
+
this.names = message.names;
|
|
57
|
+
this.sequence = 0;
|
|
58
|
+
this.nextSample = 0;
|
|
59
|
+
this.nextTime = this.context.currentTime + 0.15;
|
|
60
|
+
this.active = true;
|
|
61
|
+
this.suppressesTrack = true;
|
|
62
|
+
this.changed();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (message.utterance_id !== this.utterance || message.sequence <= this.sequence) return;
|
|
66
|
+
if (message.sequence !== this.sequence + 1) throw new Error("Call media sequence gap");
|
|
67
|
+
this.sequence = message.sequence;
|
|
68
|
+
if (message.type === "media") {
|
|
69
|
+
if (!this.active || message.start_sample !== this.nextSample)
|
|
70
|
+
throw new Error("Call media sample gap");
|
|
71
|
+
const pcm = base64ToBytes(message.pcm);
|
|
72
|
+
if (pcm.length % 2 || pcm.length > message.frames.length * 800)
|
|
73
|
+
throw new Error("Invalid PCM length");
|
|
74
|
+
if (this.nextTime - this.context.currentTime > 2) throw new Error("Call media queue exceeded");
|
|
75
|
+
const buffer = this.context.createBuffer(1, pcm.length / 2, 24e3);
|
|
76
|
+
const values = buffer.getChannelData(0);
|
|
77
|
+
const view = new DataView(pcm.buffer, pcm.byteOffset, pcm.byteLength);
|
|
78
|
+
for (let i = 0; i < values.length; i++) values[i] = view.getInt16(i * 2, true) / 32768;
|
|
79
|
+
const at = Math.max(this.nextTime, this.context.currentTime + 0.02);
|
|
80
|
+
const source = this.context.createBufferSource();
|
|
81
|
+
source.buffer = buffer;
|
|
82
|
+
source.connect(this.context.destination);
|
|
83
|
+
source.connect(this.recording);
|
|
84
|
+
this.sources.add(source);
|
|
85
|
+
source.onended = () => {
|
|
86
|
+
source.disconnect();
|
|
87
|
+
this.sources.delete(source);
|
|
88
|
+
};
|
|
89
|
+
source.start(at);
|
|
90
|
+
this.segments.push({ at, duration: buffer.duration, frames: message.frames });
|
|
91
|
+
this.segments = this.segments.filter(
|
|
92
|
+
(s) => s.at + s.duration > this.context.currentTime - 0.1
|
|
93
|
+
);
|
|
94
|
+
this.nextTime = at + buffer.duration;
|
|
95
|
+
this.nextSample += values.length;
|
|
96
|
+
} else if (message.type === "end") {
|
|
97
|
+
this.finishTimer = setTimeout(
|
|
98
|
+
() => this.reset(),
|
|
99
|
+
Math.max(0, this.nextTime - this.context.currentTime) * 1e3 + 30
|
|
100
|
+
);
|
|
101
|
+
} else if (message.type === "fallback" || message.type === "stop") {
|
|
102
|
+
this.reset(message.type === "fallback");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
sample() {
|
|
106
|
+
const now = this.context.currentTime;
|
|
107
|
+
const segment = this.segments.find((s) => now >= s.at && now < s.at + s.duration);
|
|
108
|
+
if (!segment) return null;
|
|
109
|
+
const frame = (now - segment.at) * 60;
|
|
110
|
+
const i = Math.min(Math.floor(frame), segment.frames.length - 1);
|
|
111
|
+
const a = segment.frames[i], b = segment.frames[Math.min(i + 1, segment.frames.length - 1)];
|
|
112
|
+
return a.map((value, j) => value + (b[j] - value) * (frame - i));
|
|
113
|
+
}
|
|
114
|
+
reset(releaseTrack = false) {
|
|
115
|
+
clearTimeout(this.finishTimer);
|
|
116
|
+
for (const source of this.sources) {
|
|
117
|
+
source.stop();
|
|
118
|
+
source.disconnect();
|
|
119
|
+
}
|
|
120
|
+
this.sources.clear();
|
|
121
|
+
this.segments = [];
|
|
122
|
+
this.active = false;
|
|
123
|
+
if (releaseTrack) this.suppressesTrack = false;
|
|
124
|
+
this.changed();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
CallMediaPlayer,
|
|
129
|
+
checkedCallMedia
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=call-media-player.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/calls/livekit/call-media-player.ts"],
|
|
4
|
+
"sourcesContent": ["/** A single PCM clock drives both audible speech and timestamped animation controls. */\nimport { base64ToBytes } from '@arbidocs/client'\n\nexport interface CallMediaEnvelope {\n protocol: 'arbi.call.media.v1'\n participant: string\n utterance_id: string\n sequence: number\n type: 'start' | 'media' | 'end' | 'stop' | 'fallback'\n avatar?: string\n sample_rate?: number\n fps?: number\n names?: string[]\n start_sample?: number\n pcm?: string\n frames?: number[][]\n}\n\nexport function checkedCallMedia(value: unknown, participant: string): CallMediaEnvelope {\n if (!value || typeof value !== 'object') throw new Error('Invalid call media')\n const v = value as Record<string, unknown>\n if (\n v.protocol !== 'arbi.call.media.v1' ||\n v.participant !== participant ||\n typeof v.utterance_id !== 'string' ||\n v.utterance_id.length > 64 ||\n !Number.isSafeInteger(v.sequence) ||\n Number(v.sequence) < 0 ||\n !['start', 'media', 'end', 'stop', 'fallback'].includes(String(v.type))\n )\n throw new Error('Invalid call media identity or sequence')\n if (\n v.type === 'start' &&\n (v.sample_rate !== 24000 ||\n v.fps !== 60 ||\n typeof v.avatar !== 'string' ||\n !Array.isArray(v.names) ||\n v.names.length !== 52 ||\n new Set(v.names).size !== 52 ||\n !v.names.every((name) => typeof name === 'string' && name.length < 80))\n )\n throw new Error('Invalid call media configuration')\n if (\n v.type === 'media' &&\n (!Number.isSafeInteger(v.start_sample) ||\n Number(v.start_sample) < 0 ||\n typeof v.pcm !== 'string' ||\n v.pcm.length > 6400 ||\n !Array.isArray(v.frames) ||\n !v.frames.length ||\n v.frames.length > 6 ||\n !v.frames.every(\n (frame: unknown) =>\n Array.isArray(frame) &&\n frame.length === 52 &&\n frame.every(\n (x: unknown) => typeof x === 'number' && Number.isFinite(x) && x >= -2 && x <= 2\n )\n ))\n )\n throw new Error('Invalid call media samples')\n return v as unknown as CallMediaEnvelope\n}\n\ninterface Segment {\n at: number\n duration: number\n frames: number[][]\n}\n\nexport class CallMediaPlayer {\n active = false\n /** Retain transport ownership between utterances; reattaching RTC can replay its buffered tail. */\n suppressesTrack = false\n avatar = ''\n names: string[] = []\n private utterance = ''\n private sequence = -1\n private nextSample = 0\n private nextTime = 0\n private segments: Segment[] = []\n private sources = new Set<AudioBufferSourceNode>()\n private seen = new Set<string>()\n private finishTimer: ReturnType<typeof setTimeout> | undefined\n readonly recording: MediaStreamAudioDestinationNode\n\n constructor(\n readonly context: AudioContext,\n private changed: () => void\n ) {\n this.recording = context.createMediaStreamDestination()\n }\n\n push(message: CallMediaEnvelope): void {\n if (\n message.type === 'fallback' &&\n message.sequence === 0 &&\n message.utterance_id !== this.utterance\n ) {\n if (this.seen.has(message.utterance_id)) return\n this.utterance = message.utterance_id\n this.sequence = 0\n this.seen.add(message.utterance_id)\n if (this.seen.size > 64) this.seen.delete(this.seen.values().next().value!)\n this.reset(true)\n return\n }\n if (message.type === 'start') {\n if (message.sequence !== 0 || this.seen.has(message.utterance_id)) return\n this.reset()\n this.seen.add(message.utterance_id)\n if (this.seen.size > 64) this.seen.delete(this.seen.values().next().value!)\n this.utterance = message.utterance_id\n this.avatar = message.avatar!\n this.names = message.names!\n this.sequence = 0\n this.nextSample = 0\n this.nextTime = this.context.currentTime + 0.15\n this.active = true\n this.suppressesTrack = true\n this.changed()\n return\n }\n if (message.utterance_id !== this.utterance || message.sequence <= this.sequence) return\n if (message.sequence !== this.sequence + 1) throw new Error('Call media sequence gap')\n this.sequence = message.sequence\n if (message.type === 'media') {\n if (!this.active || message.start_sample !== this.nextSample)\n throw new Error('Call media sample gap')\n const pcm = base64ToBytes(message.pcm!)\n if (pcm.length % 2 || pcm.length > message.frames!.length * 800)\n throw new Error('Invalid PCM length')\n if (this.nextTime - this.context.currentTime > 2) throw new Error('Call media queue exceeded')\n const buffer = this.context.createBuffer(1, pcm.length / 2, 24000)\n const values = buffer.getChannelData(0)\n const view = new DataView(pcm.buffer, pcm.byteOffset, pcm.byteLength)\n for (let i = 0; i < values.length; i++) values[i] = view.getInt16(i * 2, true) / 32768\n const at = Math.max(this.nextTime, this.context.currentTime + 0.02)\n const source = this.context.createBufferSource()\n source.buffer = buffer\n source.connect(this.context.destination)\n source.connect(this.recording)\n this.sources.add(source)\n source.onended = () => {\n source.disconnect()\n this.sources.delete(source)\n }\n source.start(at)\n this.segments.push({ at, duration: buffer.duration, frames: message.frames! })\n this.segments = this.segments.filter(\n (s) => s.at + s.duration > this.context.currentTime - 0.1\n )\n this.nextTime = at + buffer.duration\n this.nextSample += values.length\n } else if (message.type === 'end') {\n this.finishTimer = setTimeout(\n () => this.reset(),\n Math.max(0, this.nextTime - this.context.currentTime) * 1000 + 30\n )\n } else if (message.type === 'fallback' || message.type === 'stop') {\n this.reset(message.type === 'fallback')\n }\n }\n\n sample(): number[] | null {\n const now = this.context.currentTime\n const segment = this.segments.find((s) => now >= s.at && now < s.at + s.duration)\n if (!segment) return null\n const frame = (now - segment.at) * 60\n const i = Math.min(Math.floor(frame), segment.frames.length - 1)\n const a = segment.frames[i],\n b = segment.frames[Math.min(i + 1, segment.frames.length - 1)]\n return a.map((value, j) => value + (b[j] - value) * (frame - i))\n }\n\n reset(releaseTrack = false): void {\n clearTimeout(this.finishTimer)\n for (const source of this.sources) {\n source.stop()\n source.disconnect()\n }\n this.sources.clear()\n this.segments = []\n this.active = false\n if (releaseTrack) this.suppressesTrack = false\n this.changed()\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,qBAAqB;AAiBvB,SAAS,iBAAiB,OAAgB,aAAwC;AACvF,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,OAAM,IAAI,MAAM,oBAAoB;AAC7E,QAAM,IAAI;AACV,MACE,EAAE,aAAa,wBACf,EAAE,gBAAgB,eAClB,OAAO,EAAE,iBAAiB,YAC1B,EAAE,aAAa,SAAS,MACxB,CAAC,OAAO,cAAc,EAAE,QAAQ,KAChC,OAAO,EAAE,QAAQ,IAAI,KACrB,CAAC,CAAC,SAAS,SAAS,OAAO,QAAQ,UAAU,EAAE,SAAS,OAAO,EAAE,IAAI,CAAC;AAEtE,UAAM,IAAI,MAAM,yCAAyC;AAC3D,MACE,EAAE,SAAS,YACV,EAAE,gBAAgB,QACjB,EAAE,QAAQ,MACV,OAAO,EAAE,WAAW,YACpB,CAAC,MAAM,QAAQ,EAAE,KAAK,KACtB,EAAE,MAAM,WAAW,MACnB,IAAI,IAAI,EAAE,KAAK,EAAE,SAAS,MAC1B,CAAC,EAAE,MAAM,MAAM,CAAC,SAAS,OAAO,SAAS,YAAY,KAAK,SAAS,EAAE;AAEvE,UAAM,IAAI,MAAM,kCAAkC;AACpD,MACE,EAAE,SAAS,YACV,CAAC,OAAO,cAAc,EAAE,YAAY,KACnC,OAAO,EAAE,YAAY,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