@3dsource/angular-unreal-module 0.0.50 → 0.0.52

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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Injectable, ChangeDetectionStrategy, Component, Pipe, DestroyRef, signal, ElementRef, input, HostListener, Input, ViewChild, computed, output } from '@angular/core';
2
+ import { InjectionToken, inject, Injectable, ChangeDetectionStrategy, Component, Pipe, DestroyRef, signal, ElementRef, input, HostListener, Input, ViewChild, computed, output, viewChild, effect, untracked } from '@angular/core';
3
3
  import { filter, withLatestFrom, distinctUntilChanged, switchMap, first, catchError, timeout, map as map$1, tap, takeUntil, exhaustMap, debounceTime, takeWhile, skip as skip$1, delay } from 'rxjs/operators';
4
4
  import { createAction, props, Store, provideState, createReducer, on, createFeature, createSelector } from '@ngrx/store';
5
5
  import { Actions, ofType, provideEffects, createEffect } from '@ngrx/effects';
6
- import { skip, share, merge, Subject, interval, of, map, from, take, fromEvent, timer, throwError, defer, Observable, switchMap as switchMap$1, retry, timeout as timeout$1, tap as tap$1, startWith, combineLatestWith, takeUntil as takeUntil$1, auditTime, debounceTime as debounceTime$1, EMPTY, mergeMap, scan, concatMap, animationFrameScheduler, BehaviorSubject, combineLatest, first as first$1, distinctUntilChanged as distinctUntilChanged$1, concat } from 'rxjs';
6
+ import { skip, share, merge, Subject, interval, of, map, from, take, fromEvent, timer, throwError, defer, Observable, switchMap as switchMap$1, retry, timeout as timeout$1, tap as tap$1, startWith, combineLatestWith, takeUntil as takeUntil$1, auditTime, debounceTime as debounceTime$1, EMPTY, mergeMap, scan, concatMap, animationFrameScheduler, BehaviorSubject, distinctUntilChanged as distinctUntilChanged$1, concat } from 'rxjs';
7
7
  import { Falsy, Truthy, Logger, calculateMedian, clampf, Signal, tapLog, generateUuid, COLOR_CODES, where, KeyboardNumericCode, InvertedKeyMap, Semaphore, lerp, getCanvasCached, getSnapshot, whereNot, HEXtoRGB, RGBtoHSV, inverseLerp, HSVtoRGB, RGBtoHEX, fpIsASameAsB, fitIntoRectangle } from '@3dsource/utils';
8
8
  import { HttpClient } from '@angular/common/http';
9
9
  import { toSignal, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
@@ -3412,7 +3412,7 @@ const selectIsExistMatchUrls = createSelector(unrealFeature.selectMatchUrls, (ur
3412
3412
  const selectIsAutostart = createSelector(selectStreamConfig, (config) => config?.autoStart);
3413
3413
  const showPopupWithoutAutoStart = createSelector(selectStreamConfig, unrealFeature.selectWasInitialized, (config, wasInitialized) => !config.autoStart && !wasInitialized);
3414
3414
  const selectShowReconnectPopup = createSelector(unrealFeature.selectCirrusConnected, unrealFeature.selectEstablishingConnection, (connected, establishing) => !connected && !establishing);
3415
- const selectShowLoader = createSelector(selectShowReconnectPopup, unrealFeature.selectViewportReady, (showPopup, viewPortReady) => !showPopup && !viewPortReady);
3415
+ const selectShowLoader = createSelector(selectShowReconnectPopup, unrealFeature.selectViewportReady, (showPopup, viewportReady) => !showPopup && !viewportReady);
3416
3416
  const selectIsVideoPlayingAndDataChannelConnected = createSelector(unrealFeature.selectIsVideoPlaying, unrealFeature.selectDataChannelConnected, (isVideoPlaying, isDataChannelConnected) => isVideoPlaying && isDataChannelConnected);
3417
3417
  const selectSignalingParameters = createSelector(unrealFeature.selectSsData, unrealFeature.selectAwsInstance, unrealFeature.selectSsInfo, (data, instance, ssInfo) => {
3418
3418
  const info = [];
@@ -4657,41 +4657,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImpor
4657
4657
 
4658
4658
  class VideoLockerComponent {
4659
4659
  constructor() {
4660
+ this.videoElement = viewChild('videoPlayerCover', ...(ngDevMode ? [{ debugName: "videoElement" }] : []));
4660
4661
  this.store = inject(Store);
4661
- this.destroyRef = inject(DestroyRef);
4662
- this.videoIntroSrc$ = this.store.select(unrealFeature.selectVideoIntroSrc);
4663
- this.imageIntroSrc$ = this.store
4664
- .select(unrealFeature.selectImageIntroSrc)
4665
- .pipe(map((src) => {
4666
- // TODO need for demos site and need to delete this and move to demos
4667
- if (!src) {
4668
- return null;
4669
- }
4670
- const matchAbsolutePath = !!src.match(/.*\.(png|avif|jpg|webp|svg)(\?.*)?$/i);
4671
- if (matchAbsolutePath) {
4672
- return src;
4662
+ this.imageIntroSrc = this.store.selectSignal(unrealFeature.selectImageIntroSrc);
4663
+ this.videoIntroSrc = this.store.selectSignal(unrealFeature.selectVideoIntroSrc);
4664
+ this.viewportReady = this.store.selectSignal(unrealFeature.selectViewportReady);
4665
+ effect(() => {
4666
+ const viewportReady = this.viewportReady();
4667
+ const videoIntroSrc = this.videoIntroSrc();
4668
+ const imageIntroSrc = this.imageIntroSrc();
4669
+ untracked(() => {
4670
+ if (viewportReady && (videoIntroSrc || imageIntroSrc)) {
4671
+ this.store.dispatch(resetIntroSrc());
4672
+ }
4673
+ });
4674
+ });
4675
+ effect(() => {
4676
+ const videoIntroSrc = this.videoIntroSrc();
4677
+ const videoElement = this.videoElement();
4678
+ if (!videoIntroSrc || !videoElement) {
4679
+ return;
4673
4680
  }
4674
- return src;
4675
- }));
4676
- }
4677
- ngOnInit() {
4678
- combineLatest([
4679
- this.store.select(unrealFeature.selectViewportReady),
4680
- this.videoIntroSrc$,
4681
- this.imageIntroSrc$,
4682
- ])
4683
- .pipe(takeUntilDestroyed(this.destroyRef), filter(([viewportReady, videoSrc, imageSrc]) => viewportReady && (!!videoSrc || !!imageSrc)), first$1())
4684
- .subscribe(() => this.store.dispatch(resetIntroSrc()));
4685
- }
4686
- ngAfterViewInit() {
4687
- this.videoIntroSrc$
4688
- .pipe(filter(Truthy), takeUntilDestroyed(this.destroyRef))
4689
- .subscribe((src) => this.createVideo(src));
4681
+ untracked(() => this.createVideo(videoIntroSrc, videoElement.nativeElement));
4682
+ });
4690
4683
  }
4691
- createVideo(src) {
4684
+ createVideo(src, videoContainer) {
4692
4685
  const matchAbsolutePath = !!src.match(/.*\.(mp4|WebM)(\?.*)?$/i);
4693
4686
  // Select the parent layout where the video will be inserted
4694
- const videoContainer = this.videoElement.nativeElement;
4695
4687
  videoContainer.innerHTML = ''; // This will remove all existing content within the layout
4696
4688
  // Create the video element
4697
4689
  const videoElement = document.createElement('video');
@@ -4721,15 +4713,12 @@ class VideoLockerComponent {
4721
4713
  videoContainer.appendChild(videoElement);
4722
4714
  }
4723
4715
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: VideoLockerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4724
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.4", type: VideoLockerComponent, isStandalone: true, selector: "app-video-locker", viewQueries: [{ propertyName: "videoElement", first: true, predicate: ["videoPlayerCover"], descendants: true }], ngImport: i0, template: "@if (imageIntroSrc$ | async; as url) {\n <div class=\"backImage\">\n <img [ngSrc]=\"url\" fill alt=\"Loading...\" />\n </div>\n} @else if (videoIntroSrc$ | async) {\n <div #videoPlayerCover class=\"backVideo\"></div>\n}\n", styles: [".backVideo{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backVideo video{position:absolute;width:100%;height:100%;object-fit:cover}.backImage{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backImage img{position:absolute;width:100%;height:100%;object-fit:cover}\n"], dependencies: [{ kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4716
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.4", type: VideoLockerComponent, isStandalone: true, selector: "app-video-locker", viewQueries: [{ propertyName: "videoElement", first: true, predicate: ["videoPlayerCover"], descendants: true, isSignal: true }], ngImport: i0, template: "@let imageSrc = imageIntroSrc();\n@if (imageSrc) {\n <div class=\"backImage\">\n <img [ngSrc]=\"imageSrc\" fill alt=\"imageSrc\" />\n </div>\n} @else if (videoIntroSrc()) {\n <div #videoPlayerCover class=\"backVideo\"></div>\n}\n", styles: [".backVideo{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backVideo video{position:absolute;width:100%;height:100%;object-fit:cover}.backImage{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backImage img{position:absolute;width:100%;height:100%;object-fit:cover}\n"], dependencies: [{ kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4725
4717
  }
4726
4718
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: VideoLockerComponent, decorators: [{
4727
4719
  type: Component,
4728
- args: [{ selector: 'app-video-locker', imports: [AsyncPipe, NgOptimizedImage], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (imageIntroSrc$ | async; as url) {\n <div class=\"backImage\">\n <img [ngSrc]=\"url\" fill alt=\"Loading...\" />\n </div>\n} @else if (videoIntroSrc$ | async) {\n <div #videoPlayerCover class=\"backVideo\"></div>\n}\n", styles: [".backVideo{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backVideo video{position:absolute;width:100%;height:100%;object-fit:cover}.backImage{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backImage img{position:absolute;width:100%;height:100%;object-fit:cover}\n"] }]
4729
- }], propDecorators: { videoElement: [{
4730
- type: ViewChild,
4731
- args: ['videoPlayerCover', { static: false }]
4732
- }] } });
4720
+ args: [{ selector: 'app-video-locker', imports: [NgOptimizedImage], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let imageSrc = imageIntroSrc();\n@if (imageSrc) {\n <div class=\"backImage\">\n <img [ngSrc]=\"imageSrc\" fill alt=\"imageSrc\" />\n </div>\n} @else if (videoIntroSrc()) {\n <div #videoPlayerCover class=\"backVideo\"></div>\n}\n", styles: [".backVideo{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backVideo video{position:absolute;width:100%;height:100%;object-fit:cover}.backImage{position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%}.backImage img{position:absolute;width:100%;height:100%;object-fit:cover}\n"] }]
4721
+ }], ctorParameters: () => [] });
4733
4722
 
4734
4723
  class WebrtcErrorModalComponent {
4735
4724
  constructor() {