check for privAudio for SAD mute/volume API (#486)

* check for privAudio for SAD mute/volume API

* update url-parse, fix syntax issues from community PR
This commit is contained in:
Glenn Harper 2022-02-24 11:09:34 -08:00 коммит произвёл GitHub
Родитель 2e4639e5bc
Коммит 447962b53a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -108,7 +108,7 @@
"bent": "^7.3.12",
"https-proxy-agent": "^4.0.0",
"simple-lru-cache": "0.0.2",
"url-parse": "^1.5.6",
"url-parse": "^1.5.10",
"uuid": "^8.3.0",
"ws": "^7.5.6"
},

Просмотреть файл

@ -49,10 +49,10 @@ export class SpeechContext {
format: {}
};
}
if (this.privContext.phraseOutput.detailed === undefined) {
if (this.privContext.phraseOutput.detailed === undefined) {
this.privContext.phraseOutput.detailed = {
options: []
},
};
}
this.privContext.phraseOutput.format = "Detailed";
this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment");

Просмотреть файл

@ -174,19 +174,25 @@ export class SpeakerAudioDestination implements IAudioDestination, IPlayer {
}
public get volume(): number {
return this.privAudio.volume;
return this.privAudio?.volume ?? -1;
}
public set volume(volume: number) {
this.privAudio.volume = volume;
if (!!this.privAudio) {
this.privAudio.volume = volume;
}
}
public mute(): void {
this.privAudio.muted = true;
if (!!this.privAudio) {
this.privAudio.muted = true;
}
}
public unmute(): void {
this.privAudio.muted = false;
if (!!this.privAudio) {
this.privAudio.muted = false;
}
}
public get isClosed(): boolean {