I'm having a strange issue where my HTML page isn't updating when the angular component variable changes. After pressing a button I do a network load and start playing audio like so:
onPreviewPressed(media: Media): void {
if (this.playing) {
this.playing = false;
this.source.stop();
}
this.loading = true;
this.service.downloadAudio(this.gender, this.style, this.ageRange, media).subscribe(abuf => {
this.context.decodeAudioData(abuf, buffer => {
this.source.buffer = buffer;
this.playing = true;
console.info(`Playing is ${this.playing}`);
this.source.start(0);
}, y => {
console.info('Error: ' + y);
});
this.loading = false;
}, () => {
this.loading = false;
});
}
And then on my HTML I have this snippet:
Playing is {{ playing }}
<button [hidden]="!playing" style="width: 44px; height: 44px" (click)="onStopPressed()">
<img src="/assets/stop.png" alt="Stop">
</button>
When I click the button the audio properly downloads and starts playing, and in the console I see it say Playing is true but the HTML continues to say false, and doesn't show the button.
I thought it might be an issue of this not really being the component but the window variable, but if that were the case then the audio would really be able to play either as the source variable is part of the component.
onPreviewPressed?