@needle-tools/engine 3.37.5-alpha → 3.37.6-alpha

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.37.6-alpha] - 2023-04-24
8
+ - Add: More API documentation
9
+ - Add: VideoPlayer can now play `m3u` livestream links
10
+ - Fix: WebARBackground now checks if camera-access is granted
11
+ - Change: Progressively loaded assets now postfix urls with the content hash of the assets if available to make sure the correct version is loaded and not a old version from cache
12
+ - Change: VideoPlayer setting `url` now immediately updates the videoplayback
13
+
7
14
  ## [3.37.5-alpha] - 2023-04-23
8
15
  - Add: SceneSwitcher support for adding the `ISceneEventListener` on the sceneSwitcher gameObject
9
16
  - Fix: OrbitControls should not update on user input when the camera is not currently active
@@ -29476,13 +29476,13 @@ function vBA(g) {
29476
29476
  ok = g;
29477
29477
  }
29478
29478
  const lT = IA("debugdefines");
29479
- OE('if(!globalThis[""3.37.5-alpha""]) globalThis[""3.37.5-alpha""] = "0.0.0";');
29479
+ OE('if(!globalThis[""3.37.6-alpha""]) globalThis[""3.37.6-alpha""] = "0.0.0";');
29480
29480
  OE('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
29481
- OE('if(!globalThis[""Tue Apr 23 2024 09:16:03 GMT+0200 (Central European Summer Time)""]) globalThis[""Tue Apr 23 2024 09:16:03 GMT+0200 (Central European Summer Time)""] = "unknown";');
29482
- OE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.5-alpha";');
29481
+ OE('if(!globalThis[""Wed Apr 24 2024 17:26:38 GMT+0200 (Central European Summer Time)""]) globalThis[""Wed Apr 24 2024 17:26:38 GMT+0200 (Central European Summer Time)""] = "unknown";');
29482
+ OE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.6-alpha";');
29483
29483
  OE('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
29484
- OE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Tue Apr 23 2024 09:16:03 GMT+0200 (Central European Summer Time)";');
29485
- const lC = "3.37.5-alpha", jU = "undefined", hT = "Tue Apr 23 2024 09:16:03 GMT+0200 (Central European Summer Time)";
29484
+ OE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Apr 24 2024 17:26:38 GMT+0200 (Central European Summer Time)";');
29485
+ const lC = "3.37.6-alpha", jU = "undefined", hT = "Wed Apr 24 2024 17:26:38 GMT+0200 (Central European Summer Time)";
29486
29486
  lT && console.log(`Engine version: ${lC} (generator: ${jU})
29487
29487
  Project built at ${hT}`);
29488
29488
  const Ra = "needle_isActiveInHierarchy", GQ = "builtin_components", hf = "needle_editor_guid";
@@ -66303,7 +66303,7 @@ const PI = class {
66303
66303
  const Q = Array.isArray(n.lods) ? n.lods[i].path : n.lods;
66304
66304
  if (!Q)
66305
66305
  return eI && !n["missing:uri"] && (n["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + i, n)), null;
66306
- const E = Wa(e, Q);
66306
+ let E = Wa(e, Q);
66307
66307
  if (E.endsWith(".glb") || E.endsWith(".gltf")) {
66308
66308
  if (!n.guid)
66309
66309
  return console.warn("missing pointer for glb/gltf texture", n), null;
@@ -66317,7 +66317,11 @@ const PI = class {
66317
66317
  }
66318
66318
  const l = n, h = new Promise(async (u, f) => {
66319
66319
  const k = new PE();
66320
- Gd(k, A), eI && (await wn(Math.random() * 1e3), I && console.warn("Start loading (delayed) " + E, l.guid));
66320
+ if (Gd(k, A), n && Array.isArray(n.lods)) {
66321
+ const N = n.lods[i];
66322
+ N.hash && (E += "?v=" + N.hash);
66323
+ }
66324
+ eI && (await wn(Math.random() * 1e3), I && console.warn("Start loading (delayed) " + E, l.guid));
66321
66325
  const G = await k.loadAsync(E).catch((N) => (console.error(`Error loading LOD ${i} from ${E}
66322
66326
  `, N), null));
66323
66327
  if (!G)
@@ -85348,7 +85352,7 @@ class yg extends RA {
85348
85352
  r(this, "aspectMode", 0);
85349
85353
  r(this, "clip", null);
85350
85354
  r(this, "source", 1);
85351
- r(this, "url", null);
85355
+ r(this, "_url", null);
85352
85356
  r(this, "renderMode");
85353
85357
  r(this, "targetMaterialProperty");
85354
85358
  r(this, "targetMaterialRenderer");
@@ -85383,7 +85387,7 @@ class yg extends RA {
85383
85387
  r(this, "_hls");
85384
85388
  r(this, "onHlsAvailable", () => {
85385
85389
  var e;
85386
- Eg && console.log("HLS: available", this.clip), !(!this.shouldUseM3U8 || !this.url) && (this._hls || (this._hls = new Hls()), this.videoElement.autoplay = !0, this._hls.loadSource(this.url), this._hls.attachMedia(this.videoElement), (e = this._videoElement) == null || e.play(), Eg && console.log("HLS: loaded", this.clip));
85390
+ Eg && console.log("HLS: available", this.clip), !(!this.shouldUseM3U || !this.url) && (this._hls || (this._hls = new Hls()), this.videoElement.autoplay = !0, this._hls.loadSource(this.url), this._hls.attachMedia(this.videoElement), (e = this._videoElement) == null || e.play(), Eg && console.log("HLS: loaded", this.clip));
85387
85391
  });
85388
85392
  NCA(() => {
85389
85393
  this._receivedInput = !0, this.updateVideoElementSettings();
@@ -85391,6 +85395,13 @@ class yg extends RA {
85391
85395
  e.key === "f" && (this.screenspace = !this.screenspace);
85392
85396
  });
85393
85397
  }
85398
+ get url() {
85399
+ return this._url;
85400
+ }
85401
+ set url(e) {
85402
+ const i = this._url !== e;
85403
+ this.__didAwake ? i && this.setClipURL(e ?? "") : this._url = e;
85404
+ }
85394
85405
  get playbackSpeed() {
85395
85406
  var e;
85396
85407
  return ((e = this._videoElement) == null ? void 0 : e.playbackRate) ?? this._playbackSpeed;
@@ -85468,7 +85479,7 @@ class yg extends RA {
85468
85479
  this.clip = e, this.source = 0, this._videoElement ? (this._videoElement.srcObject = e, this._isPlaying && this.play(), this.updateAspect()) : this.create(this.playOnAwake);
85469
85480
  }
85470
85481
  setClipURL(e) {
85471
- this.url !== e && (this.url = e, this.source = 1, Eg && console.log("set url", e), this._videoElement ? e.endsWith(".m3u8") ? this.ensureM3U8CanBePlayed() : (this._videoElement.src = e, this._isPlaying && (this.stop(), this.play())) : this.create(this.playOnAwake));
85482
+ this._url !== e && (this._url = e, this.source = 1, Eg && console.log("set url", e), this._videoElement ? e.endsWith(".m3u8") || e.includes(".m3u") ? this.ensureM3UCanBePlayed() : (this._videoElement.src = e, this._isPlaying && (this.stop(), this.play())) : this.create(this.playOnAwake));
85472
85483
  }
85473
85484
  onEnable() {
85474
85485
  var e, t;
@@ -85490,8 +85501,8 @@ class yg extends RA {
85490
85501
  return;
85491
85502
  }
85492
85503
  if (!(this._isPlaying && !((e = this._videoElement) != null && e.ended) && !((t = this._videoElement) != null && t.paused))) {
85493
- if (this._isPlaying = !0, this._receivedInput || (this._videoElement.muted = !0), this.handleBeginPlaying(!1), this.shouldUseM3U8) {
85494
- this.ensureM3U8CanBePlayed();
85504
+ if (this._isPlaying = !0, this._receivedInput || (this._videoElement.muted = !0), this.handleBeginPlaying(!1), this.shouldUseM3U) {
85505
+ this.ensureM3UCanBePlayed();
85495
85506
  return;
85496
85507
  }
85497
85508
  Eg && console.log("Video Play()", this.clip, this._videoElement, this.time), this._videoElement.currentTime = this.time, this._videoElement.play().catch((i) => {
@@ -85577,7 +85588,7 @@ class yg extends RA {
85577
85588
  console.warn("Can not play video, no material found, this might be a multimaterial case which is not supported yet");
85578
85589
  return;
85579
85590
  }
85580
- this.updateVideoElementSettings(), this.updateVideoElementStyles(), e && (this.shouldUseM3U8 && this.ensureM3U8CanBePlayed(), this.play());
85591
+ this.updateVideoElementSettings(), this.updateVideoElementStyles(), e && (this.shouldUseM3U && this.ensureM3UCanBePlayed(), this.play());
85581
85592
  }
85582
85593
  updateVideoElementSettings() {
85583
85594
  if (!this._videoElement)
@@ -85633,11 +85644,11 @@ class yg extends RA {
85633
85644
  yield;
85634
85645
  }
85635
85646
  }
85636
- get shouldUseM3U8() {
85637
- return this.url != null && this.url.endsWith(".m3u8") && this.source === 1;
85647
+ get shouldUseM3U() {
85648
+ return this.url != null && (this.url.endsWith(".m3u8") || this.url.endsWith(".m3u")) && this.source === 1;
85638
85649
  }
85639
- ensureM3U8CanBePlayed() {
85640
- if (!this.shouldUseM3U8)
85650
+ ensureM3UCanBePlayed() {
85651
+ if (!this.shouldUseM3U)
85641
85652
  return;
85642
85653
  let e = document.head.querySelector("script[data-hls_library]");
85643
85654
  e ? globalThis.Hls ? this.onHlsAvailable() : e.addEventListener("load", this.onHlsAvailable) : (Eg && console.log("HLS: load script"), e = document.createElement("script"), e.dataset.hls_library = "hls.js", e.src = "https://cdn.jsdelivr.net/npm/hls.js@1", e.addEventListener("load", this.onHlsAvailable), document.head.append(e));
@@ -85657,7 +85668,7 @@ Ro([
85657
85668
  ], yg.prototype, "source", 2);
85658
85669
  Ro([
85659
85670
  D(URL)
85660
- ], yg.prototype, "url", 2);
85671
+ ], yg.prototype, "url", 1);
85661
85672
  Ro([
85662
85673
  D()
85663
85674
  ], yg.prototype, "renderMode", 2);
@@ -88027,17 +88038,22 @@ class yN extends RA {
88027
88038
  updateFromFrame(e) {
88028
88039
  if (!e)
88029
88040
  return;
88030
- const t = e.getViewerPose(this.context.renderer.xr.getReferenceSpace());
88031
- if (t) {
88032
- for (const i of t.views)
88033
- if ("camera" in i && i.camera) {
88034
- let o = this.context.renderer.xr.getBinding();
88035
- if (o || (o = new XRWebGLBinding(e.session, this.context.renderer.getContext())), o) {
88036
- let s = null;
88037
- if ("getCameraImage" in o) {
88038
- s = o.getCameraImage(i.camera);
88039
- const n = this.context.renderer.properties.get(this.threeTexture);
88040
- n.__webglTexture = s, this.backgroundPlane ? (this.backgroundPlane.setTexture(this.threeTexture), this.backgroundPlane.visible = !0) : Tf && console.warn("No background plane to set texture on");
88041
+ const t = e.session.enabledFeatures;
88042
+ if (t && !t.some((I) => I === "camera-access")) {
88043
+ this.background && (this.background.visible = !1);
88044
+ return;
88045
+ }
88046
+ const i = e.getViewerPose(this.context.renderer.xr.getReferenceSpace());
88047
+ if (i) {
88048
+ for (const I of i.views)
88049
+ if ("camera" in I && I.camera) {
88050
+ let s = this.context.renderer.xr.getBinding();
88051
+ if (s || (s = new XRWebGLBinding(e.session, this.context.renderer.getContext())), s) {
88052
+ let n = null;
88053
+ if ("getCameraImage" in s) {
88054
+ n = s.getCameraImage(I.camera);
88055
+ const C = this.context.renderer.properties.get(this.threeTexture);
88056
+ C.__webglTexture = n, this.backgroundPlane ? (this.backgroundPlane.setTexture(this.threeTexture), this.backgroundPlane.visible = !0) : Tf && console.warn("No background plane to set texture on");
88041
88057
  }
88042
88058
  }
88043
88059
  }