@vosjs/studio-core 0.42.4 → 0.42.5

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
@@ -6911,9 +6911,24 @@ var SETUP = `async (ctx) => {
6911
6911
  ;(ns.videoBlobs || (ns.videoBlobs = new Map())).set(src, fetched)
6912
6912
  return URL.createObjectURL(fetched)
6913
6913
  }
6914
+ // Every element handed out by this SETUP, so two players never share one.
6915
+ // A take may name one file as two media (the same shot as a teaser and in
6916
+ // full), or as a media and the footage; the by-src cache would hand both
6917
+ // ONE element, and ON_FRAME's concat rule, which pauses every media that
6918
+ // is not under the playhead, then paused the playing clip every frame under
6919
+ // the other name: play/pause churn, the element falling behind the clock,
6920
+ // and a drift-guard seek every ~0.3 s that read as a stuck picture jumping
6921
+ // forward. A second claim on the same bytes gets its OWN element, kept in
6922
+ // the cache under a slot of its own so a warm LOAD reuses it like the first.
6923
+ const claimed = new Set()
6914
6924
  const load = async (src, muted) => {
6915
- let v = cache.get(src)
6916
- if (v) return v
6925
+ let key = src
6926
+ let v = cache.get(key)
6927
+ for (let n = 2; v && claimed.has(v); n++) {
6928
+ key = src + '#' + n
6929
+ v = cache.get(key)
6930
+ }
6931
+ if (v) { claimed.add(v); return v }
6917
6932
  let url = src
6918
6933
  if (ctx.data.videoFetchMode === 'blob') {
6919
6934
  try { url = await toBlobUrl(src) }
@@ -6933,7 +6948,8 @@ var SETUP = `async (ctx) => {
6933
6948
  v.onerror = () => rej(new Error('[studio] video failed to load' + (v.error ? ' (' + v.error.code + (v.error.message ? ': ' + v.error.message : '') + ')' : '')))
6934
6949
  v.load()
6935
6950
  })
6936
- cache.set(src, v)
6951
+ cache.set(key, v)
6952
+ claimed.add(v)
6937
6953
  return v
6938
6954
  }
6939
6955
  // Shots: the "video" is a still image \u2014 drawImage accepts it directly and the
@@ -7377,7 +7393,7 @@ var ON_FRAME = `(ctx, content, dt) => {
7377
7393
  // The card under the playhead: another media's own card fields over the
7378
7394
  // take's frame (resolved at lowering), the take's frame for the primary.
7379
7395
  var cfr = amId && actM && actM.frame ? actM.frame : frame
7380
- if (r.media) for (var amK in r.media) { var amE = r.media[amK]; if (amK !== amId && amE && amE.pause && amE.paused === false) amE.pause() }
7396
+ if (r.media) for (var amK in r.media) { var amE = r.media[amK]; if (amK !== amId && amE && amE !== video && amE.pause && amE.paused === false) amE.pause() }
7381
7397
  if (amId) {
7382
7398
  if (r.video && r.video.pause && r.video.paused === false) r.video.pause()
7383
7399
  if (r.cam && r.cam.pause && r.cam.paused === false) r.cam.pause()