Fix audio stalling issue when switching to other app on android

This commit is contained in:
Chrystian Huot 2019-08-01 10:08:14 -04:00
parent ae19c079f7
commit 44cb5a4ca6

View file

@ -363,6 +363,8 @@ export class AppRadioService implements OnDestroy {
this._audio.onplay = () => startHandler(); this._audio.onplay = () => startHandler();
this._audio.onstalled = () => this._audio.play();
this._audio.ontimeupdate = () => progressHandler(); this._audio.ontimeupdate = () => progressHandler();
} }
} }
@ -461,24 +463,28 @@ export class AppRadioService implements OnDestroy {
transform: (call: RadioCall) => this.transform(call), transform: (call: RadioCall) => this.transform(call),
}; };
const avoids = Object.keys(this._avoids).map((sys: string) => +sys).reduce((sel: any, sys: number) => { const avoids = Object.keys(this._avoids)
const tgs = Object.keys(this._avoids[sys]).map((tg: string) => +tg).filter((tg: number) => this._avoids[sys][tg]); .map((sys: string) => +sys)
.reduce((sel: any, sys: number) => {
const tgs = Object.keys(this._avoids[sys])
.map((tg: string) => +tg)
.filter((tg: number) => this._avoids[sys][tg]);
if (tgs.length) { if (tgs.length) {
sel.push({ sel.push({
$and: [ $and: [
{ {
system: { $ne: sys }, system: { $ne: sys },
}, },
{ {
talkgroup: { $nin: tgs }, talkgroup: { $nin: tgs },
}, },
], ],
}); });
} }
return sel; return sel;
}, []); }, []);
const selector = avoids.length ? { $or: avoids } : {}; const selector = avoids.length ? { $or: avoids } : {};