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));
|
EVENTS.forEach((event) => document.body.addEventListener(event, resume));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emitTimeEvent();
|
this.startAudioTimer();
|
||||||
|
|
||||||
this.audioTimer = setInterval(() => this.emitTimeEvent(), 500);
|
|
||||||
|
|
||||||
}, (error: Error) => {
|
}, (error: Error) => {
|
||||||
this.skip(true);
|
this.skip(true);
|
||||||
|
|
@ -272,6 +270,8 @@ export class AppRadioService implements OnDestroy {
|
||||||
|
|
||||||
replay(): void {
|
replay(): void {
|
||||||
if (!this.paused) {
|
if (!this.paused) {
|
||||||
|
this.stopAudioTimer();
|
||||||
|
|
||||||
this.play(this.call.current || this.call.previous);
|
this.play(this.call.current || this.call.previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -296,10 +296,7 @@ export class AppRadioService implements OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
stop(): void {
|
stop(): void {
|
||||||
if (this.audioTimer !== null) {
|
this.stopAudioTimer();
|
||||||
clearInterval(this.audioTimer);
|
|
||||||
this.audioTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.audioSource) {
|
if (this.audioSource) {
|
||||||
this.audioSource.disconnect();
|
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 {
|
private subscribeLiveFeed(): void {
|
||||||
if (!this.subscriptions.liveFeed.length) {
|
if (!this.subscriptions.liveFeed.length) {
|
||||||
const options = {
|
const options = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue