openvidu-components: Fixed captions lang update

Updated captions lang only when it is different than older one
pull/759/head
Carlos Santos 2022-11-09 12:47:29 +01:00
parent 80a0f16778
commit 4be4b9695b
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}