mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Fix bug with audioTimer
This commit is contained in:
parent
41f28b13c6
commit
8c49071d5e
|
|
@ -243,9 +243,7 @@ export class AppRadioService implements OnDestroy {
|
|||
EVENTS.forEach((event) => document.body.addEventListener(event, resume));
|
||||
}
|
||||
|
||||
this.emitTimeEvent();
|
||||
|
||||
this.audioTimer = setInterval(() => this.emitTimeEvent(), 500);
|
||||
this.startAudioTimer();
|
||||
|
||||
}, (error: Error) => {
|
||||
this.skip(true);
|
||||
|
|
@ -272,6 +270,8 @@ export class AppRadioService implements OnDestroy {
|
|||
|
||||
replay(): void {
|
||||
if (!this.paused) {
|
||||
this.stopAudioTimer();
|
||||
|
||||
this.play(this.call.current || this.call.previous);
|
||||
}
|
||||
}
|
||||
|
|
@ -296,10 +296,7 @@ export class AppRadioService implements OnDestroy {
|
|||
}
|
||||
|
||||
stop(): void {
|
||||
if (this.audioTimer !== null) {
|
||||
clearInterval(this.audioTimer);
|
||||
this.audioTimer = null;
|
||||
}
|
||||
this.stopAudioTimer();
|
||||
|
||||
if (this.audioSource) {
|
||||
this.audioSource.disconnect();
|
||||
|
|
@ -465,6 +462,21 @@ export class AppRadioService implements OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
private startAudioTimer(): void {
|
||||
if (this.audioTimer === null) {
|
||||
this.emitTimeEvent();
|
||||
|
||||
this.audioTimer = setInterval(() => this.emitTimeEvent(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
private stopAudioTimer(): void {
|
||||
if (this.audioTimer !== null) {
|
||||
clearInterval(this.audioTimer);
|
||||
this.audioTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private subscribeLiveFeed(): void {
|
||||
if (!this.subscriptions.liveFeed.length) {
|
||||
const options = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue