From 4be4b9695bce129502dbad309cf90158531e9268 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Wed, 9 Nov 2022 12:47:29 +0100 Subject: [PATCH] openvidu-components: Fixed captions lang update Updated captions lang only when it is different than older one --- .../src/lib/services/caption/caption.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/caption/caption.service.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/caption/caption.service.ts index bb501ed4..e5948e70 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/caption/caption.service.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/caption/caption.service.ts @@ -43,8 +43,9 @@ export class CaptionService { } setLanguage(lang: string) { - if (this.langTitles.some((l) => l.ISO === lang)) { - this.captionLangSelected = this.langTitles.find((l) => l.ISO === lang); + const newLang = this.langTitles.find((l) => l.ISO === lang); + if(!!newLang && newLang.ISO !== this.captionLangSelected.ISO){ + this.captionLangSelected = newLang; this.storageService.setCaptionLang(lang); this._captionLangObs.next(this.captionLangSelected); }