@waveform-playlist/playout 11.0.0 → 11.0.1

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/index.js CHANGED
@@ -209,11 +209,17 @@ var ToneTrack = class {
209
209
  const transport = (0, import_tone.getTransport)();
210
210
  try {
211
211
  transport.clear(scheduled.scheduleId);
212
- } catch {
212
+ } catch (err) {
213
+ console.warn(
214
+ '[waveform-playlist] removeScheduledClip: clear failed on track "' + this.id + '": ' + String(err)
215
+ );
213
216
  }
214
217
  try {
215
218
  scheduled.fadeGainNode.disconnect();
216
- } catch {
219
+ } catch (err) {
220
+ console.warn(
221
+ '[waveform-playlist] removeScheduledClip: disconnect failed on track "' + this.id + '": ' + String(err)
222
+ );
217
223
  }
218
224
  this.scheduledClips.splice(index, 1);
219
225
  }
@@ -225,6 +231,7 @@ var ToneTrack = class {
225
231
  * needing to explicitly stop it.
226
232
  */
227
233
  replaceClips(newClips, newStartTime) {
234
+ const startTimeChanged = newStartTime !== void 0 && newStartTime !== this.track.startTime;
228
235
  if (newStartTime !== void 0) {
229
236
  this.track.startTime = newStartTime;
230
237
  }
@@ -232,15 +239,19 @@ var ToneTrack = class {
232
239
  const kept = [];
233
240
  const toAdd = [];
234
241
  const matched = /* @__PURE__ */ new Set();
235
- for (const clipInfo of newClips) {
236
- const idx = this.scheduledClips.findIndex(
237
- (s, i) => !matched.has(i) && this._clipsEqual(s.clipInfo, clipInfo)
238
- );
239
- if (idx !== -1) {
240
- kept.push(this.scheduledClips[idx]);
241
- matched.add(idx);
242
- } else {
243
- toAdd.push(clipInfo);
242
+ if (startTimeChanged) {
243
+ toAdd.push(...newClips);
244
+ } else {
245
+ for (const clipInfo of newClips) {
246
+ const idx = this.scheduledClips.findIndex(
247
+ (s, i) => !matched.has(i) && this._clipsEqual(s.clipInfo, clipInfo)
248
+ );
249
+ if (idx !== -1) {
250
+ kept.push(this.scheduledClips[idx]);
251
+ matched.add(idx);
252
+ } else {
253
+ toAdd.push(clipInfo);
254
+ }
244
255
  }
245
256
  }
246
257
  for (let i = 0; i < this.scheduledClips.length; i++) {
@@ -248,11 +259,17 @@ var ToneTrack = class {
248
259
  const scheduled = this.scheduledClips[i];
249
260
  try {
250
261
  tp.clear(scheduled.scheduleId);
251
- } catch {
262
+ } catch (err) {
263
+ console.warn(
264
+ '[waveform-playlist] replaceClips: clear failed on track "' + this.id + '": ' + String(err)
265
+ );
252
266
  }
253
267
  try {
254
268
  scheduled.fadeGainNode.disconnect();
255
- } catch {
269
+ } catch (err) {
270
+ console.warn(
271
+ '[waveform-playlist] replaceClips: disconnect failed on track "' + this.id + '": ' + String(err)
272
+ );
256
273
  }
257
274
  }
258
275
  }