TGD-43 fix
This commit is contained in:
parent
ab63f62d4e
commit
a2788e340a
2 changed files with 19 additions and 10 deletions
|
|
@ -1,14 +1,24 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from "@angular/common/http";
|
||||
import { API_URL } from "../../app.constants";
|
||||
import {Observable, of, Subject} from "rxjs";
|
||||
import {delay, delayWhen, interval, Observable, of, Subject} from "rxjs";
|
||||
import {ApiService} from "./api.service";
|
||||
import {takeUntil, tap} from "rxjs/operators";
|
||||
import {SharedMethods} from "../shared/sharedmethods";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class VoiceService {
|
||||
destroyed$ = new Subject();
|
||||
voiceDisabled = false;
|
||||
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
constructor(private httpClient: HttpClient, private apiService: ApiService) {
|
||||
this.apiService.getFeatureFlagState("DisableVoice").pipe(takeUntil(this.destroyed$))
|
||||
.subscribe((result) => {
|
||||
this.voiceDisabled = result.state;
|
||||
})
|
||||
}
|
||||
public voiceSubject = new Subject<string>();
|
||||
public audioEndedSubject = new Subject<void>();
|
||||
|
||||
|
|
@ -20,6 +30,10 @@ export class VoiceService {
|
|||
playAudio$(url: string) {
|
||||
this.voiceSubject.next(url);
|
||||
return new Observable((observer) => {
|
||||
if(this.voiceDisabled) {
|
||||
observer.next(null);
|
||||
observer.complete();
|
||||
}
|
||||
const subscription = this.audioEndedSubject.subscribe({
|
||||
next: () => {
|
||||
observer.next(null);
|
||||
|
|
@ -27,7 +41,7 @@ export class VoiceService {
|
|||
}
|
||||
});
|
||||
return () => subscription.unsubscribe();
|
||||
})
|
||||
}).pipe(delayWhen(val => this.voiceDisabled ? interval(5000) : interval(0)));
|
||||
}
|
||||
|
||||
getAudioUrl(text: string,voice: number = 1) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,14 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {ApiService, EndgameResultsDto, FeatureFlagStateDto} from "../../services/api.service";
|
||||
import {
|
||||
of,
|
||||
Subject,
|
||||
lastValueFrom,
|
||||
firstValueFrom,
|
||||
mergeWith,
|
||||
combineLatestAll,
|
||||
combineLatest,
|
||||
mergeMap,
|
||||
forkJoin, merge
|
||||
merge
|
||||
} from "rxjs";
|
||||
import { takeUntil} from "rxjs/operators";
|
||||
import {VoiceService} from "../../services/voice.service";
|
||||
import {animate, keyframes, style, transition, trigger} from "@angular/animations";
|
||||
import {animate, style, transition, trigger} from "@angular/animations";
|
||||
import {Participant} from "../../../types/participant";
|
||||
import {SharedMethods} from "../../shared/sharedmethods";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue