Commit 4ad94e6c authored by Christopher Fullarton's avatar Christopher Fullarton

Fixes console error when setting null values as volume for the quiz sound

parent 89563042
Pipeline #33459 passed with stages
in 15 minutes and 13 seconds
......@@ -176,7 +176,7 @@ export class SoundManagerComponent implements OnInit, OnDestroy {
if (isPlatformBrowser(this.platformId)) {
const audioElements = document.getElementsByTagName('audio');
for (let i = 0; i < audioElements.length; i++) {
(<HTMLAudioElement>audioElements.item(i)).volume = (this.config.volumeConfig[target] || 60) / 100;
(<HTMLAudioElement>audioElements.item(i)).volume = (parseInt(String(this.config.volumeConfig[target]), 10) || 60) / 100;
}
}
}
......
......@@ -40,7 +40,7 @@ export class AudioPlayerComponent implements AfterViewInit, OnDestroy {
this._original_volume = value;
this._volume = this._original_volume;
if (this.audioElement) {
this.audioElement.volume = parseInt(this._volume, 10) / 100;
this.audioElement.volume = (parseInt(this._volume, 10) || 0) / 100;
}
}
......@@ -81,7 +81,7 @@ export class AudioPlayerComponent implements AfterViewInit, OnDestroy {
set volume(value: string) {
this._volume = value;
this.volumeChange.emit(this.volume);
this.audioElement.volume = parseInt(this.volume, 10) / 100;
this.audioElement.volume = (parseInt(this._volume, 10) || 0) / 100;
}
private _isPlaying = false;
......@@ -123,7 +123,7 @@ export class AudioPlayerComponent implements AfterViewInit, OnDestroy {
}
public ngAfterViewInit(): void {
this.audioElement.volume = parseInt(this._volume, 10) / 100;
this.audioElement.volume = (parseInt(this._volume, 10) || 0) / 100;
}
public ngOnDestroy(): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment