@umicat/three-sdk 0.14.0 → 0.15.0

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 (2) hide show
  1. package/dist/GameAudio.js +13 -0
  2. package/package.json +1 -1
package/dist/GameAudio.js CHANGED
@@ -230,6 +230,19 @@ export class GameAudio {
230
230
  const ctx = this.ctx;
231
231
  if (this.muted)
232
232
  return;
233
+ // The music may still be waiting for a gesture even though the context is
234
+ // not. `start()` is the only other place that starts it, and it early-exits
235
+ // when the context is ALREADY running — which is what happens in a
236
+ // cross-origin iframe, where the context comes up running and the first
237
+ // `play()` therefore never takes the unlock path. Measured: a game
238
+ // embedded that way had a live context, decoded buffers, working effects
239
+ // and no music at all, because `startMusic()` had never been reached.
240
+ //
241
+ // `play()` is the right place for the second attempt: it is called from
242
+ // inside a real gesture (a button, a move), which is exactly the
243
+ // permission an element needs, and `startMusic` is idempotent.
244
+ if (this.ready && this.musicName && !this.musicEl)
245
+ this.startMusic();
233
246
  if (!this.ready || !ctx || !this.master) {
234
247
  // Not "drop it": this is the unlocking gesture, and the sound it asked
235
248
  // for is the one the player is waiting to hear. `start()` plays it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umicat/three-sdk",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",