Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
fix #3 (with suggestion at nstudio/nativescript-audio/issues/148#issu…
Browse files Browse the repository at this point in the history
…ecomment-490522070
  • Loading branch information
yringler committed May 8, 2019
1 parent 92ea537 commit 7934246
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/shared/services/media-player.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export class MediaPlayerService {

constructor(private progress: PlayerProgressService) {
this.player = new TNSPlayer();
// #3: don't resume from pause when regains audio focus.
// Thank you, @masayoshiadachi (at https://github.com/nstudio/nativescript-audio/issues/148#issuecomment-490522070)
this.player.resume = () => {}
}

play(file: string) {
Expand All @@ -29,7 +32,7 @@ export class MediaPlayerService {
this.progress.pause();
} else {
if (this.currentFile != null && (requestedFile == null || this.currentFile == requestedFile)) {
this.player.resume();
this.player.play();
this.progress.resume();
} else if (requestedFile != null) {
this.play(requestedFile);
Expand Down

0 comments on commit 7934246

Please sign in to comment.