From 1e6abeda0535fab0ce42816cc72c855ae3d53d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Digimezzo=20Rapha=C3=ABl?= Date: Sat, 7 Dec 2024 23:01:48 +0100 Subject: [PATCH] Fixes the last unit tests --- src/app/app.component.spec.ts | 4 +- .../media-session.service.spec.ts | 266 ++---------------- .../playback/playback.service.spec.ts | 59 ++-- src/app/services/playback/playback.service.ts | 10 +- 4 files changed, 80 insertions(+), 259 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 9e935aba..bfa2fd29 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -19,6 +19,8 @@ import { LifetimeService } from './services/lifetime/lifetime.service'; import { SwitchPlayerService } from './services/player-switcher/switch-player.service'; import { PlaybackService } from './services/playback/playback.service'; +jest.mock('jimp', () => ({ exec: jest.fn() })); + describe('AppComponent', () => { let playerSwitcherServiceMock: IMock; let playbackServiceMock: IMock; @@ -58,8 +60,8 @@ describe('AppComponent', () => { addToPlaylistMenuMock.object, desktopMock.object, loggerMock.object, - integrationTestRunnerMock.object, audioVisualizerMock.object, + integrationTestRunnerMock.object, ); } diff --git a/src/app/services/media-session/media-session.service.spec.ts b/src/app/services/media-session/media-session.service.spec.ts index c7d6555a..535b4491 100644 --- a/src/app/services/media-session/media-session.service.spec.ts +++ b/src/app/services/media-session/media-session.service.spec.ts @@ -1,60 +1,26 @@ -import { Subject } from 'rxjs'; import { IMock, It, Mock, Times } from 'typemoq'; -import { DateTime } from '../../common/date-time'; -import { PlaybackInformation } from '../playback-information/playback-information'; -import { TrackModel } from '../track/track-model'; import { MediaSessionService } from './media-session.service'; -import { PlaybackService } from '../playback/playback.service'; -import { PlaybackInformationServiceBase } from '../playback-information/playback-information.service.base'; import { MediaSessionProxy } from '../../common/io/media-session-proxy'; -import { Track } from '../../data/entities/track'; +import { PlaybackInformationFactory } from '../playback-information/playback-information.factory'; import { TranslatorServiceBase } from '../translator/translator.service.base'; +import { DateTime } from '../../common/date-time'; +import { TrackModel } from '../track/track-model'; +import { Track } from '../../data/entities/track'; +import { PlaybackInformation } from '../playback-information/playback-information'; + +jest.mock('jimp', () => ({ exec: jest.fn() })); describe('MediaSessionService', () => { - let playbackServiceMock: IMock; - let playbackInformationServiceMock: IMock; + let playbackInformationFactoryMock: IMock; let mediaSessionProxyMock: IMock; - let settingsMock: any; - - let playingNextTrack: Subject; - let playingPreviousTrack: Subject; beforeEach(() => { - playbackServiceMock = Mock.ofType(); - playbackInformationServiceMock = Mock.ofType(); + playbackInformationFactoryMock = Mock.ofType(); mediaSessionProxyMock = Mock.ofType(); - settingsMock = { enableMultimediaKeys: false }; - - playingNextTrack = new Subject(); - playbackInformationServiceMock.setup((x) => x.playingNextTrack$).returns(() => playingNextTrack.asObservable()); - - playingPreviousTrack = new Subject(); - playbackInformationServiceMock.setup((x) => x.playingPreviousTrack$).returns(() => playingPreviousTrack.asObservable()); }); function createService(): MediaSessionService { - return new MediaSessionService( - playbackServiceMock.object, - playbackInformationServiceMock.object, - mediaSessionProxyMock.object, - settingsMock, - ); - } - - function createPlaybackInformation(): PlaybackInformation { - const track: Track = new Track('path1'); - track.trackTitle = 'title1'; - track.artists = 'artist1'; - track.albumTitle = 'album1'; - - const translatorServiceMock: IMock = Mock.ofType(); - const dateTimeMock: IMock = Mock.ofType(); - - const trackModel: TrackModel = new TrackModel(track, dateTimeMock.object, translatorServiceMock.object, settingsMock); - - const playbackInformation: PlaybackInformation = new PlaybackInformation(trackModel, 'image1'); - - return playbackInformation; + return new MediaSessionService(playbackInformationFactoryMock.object, mediaSessionProxyMock.object); } describe('constructor', () => { @@ -69,156 +35,10 @@ describe('MediaSessionService', () => { }); }); - describe('enableMultimediaKeys', () => { - it('should set settings.enableMultimediaKeys', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = true; - - // Assert - expect(service.enableMultimediaKeys).toBeTruthy(); - }); - - it('should get settings.enableMultimediaKeys', () => { - // Arrange - const service: MediaSessionService = createService(); - settingsMock.enableMultimediaKeys = true; - - // Act & Assert - expect(service.enableMultimediaKeys).toBeTruthy(); - }); - - describe('when set to true', () => { - it('should not clear all multimedia keys handlers', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = true; - - // Assert - mediaSessionProxyMock.verify((x) => x.clearActionHandler('play'), Times.never()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('pause'), Times.never()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('previoustrack'), Times.never()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('nexttrack'), Times.never()); - }); - - it('should set all multimedia keys handlers', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = true; - - // Assert - mediaSessionProxyMock.verify((x) => x.setActionHandler('play', It.isAny()), Times.once()); - mediaSessionProxyMock.verify((x) => x.setActionHandler('pause', It.isAny()), Times.once()); - mediaSessionProxyMock.verify((x) => x.setActionHandler('previoustrack', It.isAny()), Times.once()); - mediaSessionProxyMock.verify((x) => x.setActionHandler('nexttrack', It.isAny()), Times.once()); - }); - - it('should enable subscriptions so that metadata is set on playing next track', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = true; - playingNextTrack.next(createPlaybackInformation()); - - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.once()); - }); - - it('should enable subscriptions so that metadata is set on previous track', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = true; - playingPreviousTrack.next(createPlaybackInformation()); - - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.once()); - }); - }); - - describe('when set to false', () => { - it('should clear all multimedia keys handlers', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = false; - - // Assert - mediaSessionProxyMock.verify((x) => x.clearActionHandler('play'), Times.once()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('pause'), Times.once()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('previoustrack'), Times.once()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('nexttrack'), Times.once()); - }); - - it('should not set all multimedia keys handlers', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = false; - - // Assert - mediaSessionProxyMock.verify((x) => x.setActionHandler('play', It.isAny()), Times.never()); - mediaSessionProxyMock.verify((x) => x.setActionHandler('pause', It.isAny()), Times.never()); - mediaSessionProxyMock.verify((x) => x.setActionHandler('previoustrack', It.isAny()), Times.never()); - mediaSessionProxyMock.verify((x) => x.setActionHandler('nexttrack', It.isAny()), Times.never()); - }); - - it('should disable subscriptions so that metadata is not set on playing next track', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = false; - playingNextTrack.next(createPlaybackInformation()); - - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.never()); - }); - - it('should disable subscriptions so that metadata is not set on playing previous track', () => { - // Arrange - const service: MediaSessionService = createService(); - - // Act - service.enableMultimediaKeys = false; - playingPreviousTrack.next(createPlaybackInformation()); - - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.never()); - }); - }); - }); - describe('initialize', () => { describe('settings.enableMultimediaKeys is true', () => { - it('should not clear all multimedia keys handlers', () => { - // Arrange - settingsMock.enableMultimediaKeys = true; - const service: MediaSessionService = createService(); - - // Act - service.initialize(); - - // Assert - mediaSessionProxyMock.verify((x) => x.clearActionHandler('play'), Times.never()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('pause'), Times.never()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('previoustrack'), Times.never()); - mediaSessionProxyMock.verify((x) => x.clearActionHandler('nexttrack'), Times.never()); - }); - it('should set all multimedia keys handlers', () => { // Arrange - settingsMock.enableMultimediaKeys = true; const service: MediaSessionService = createService(); // Act @@ -230,60 +50,32 @@ describe('MediaSessionService', () => { mediaSessionProxyMock.verify((x) => x.setActionHandler('previoustrack', It.isAny()), Times.once()); mediaSessionProxyMock.verify((x) => x.setActionHandler('nexttrack', It.isAny()), Times.once()); }); - - it('should enable subscriptions so that metadata is set on playing next track', () => { - // Arrange - settingsMock.enableMultimediaKeys = true; - const service: MediaSessionService = createService(); - - // Act - service.initialize(); - playingNextTrack.next(createPlaybackInformation()); - - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.once()); - }); - - it('should enable subscriptions so that metadata is set on playing previous track', () => { - // Arrange - settingsMock.enableMultimediaKeys = true; - const service: MediaSessionService = createService(); - - // Act - service.initialize(); - playingPreviousTrack.next(createPlaybackInformation()); - - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.once()); - }); }); + }); - describe('settings.enableMultimediaKeys is false', () => { - it('should not enable subscriptions so that metadata is set on playing next track', () => { - // Arrange - settingsMock.enableMultimediaKeys = false; - const service: MediaSessionService = createService(); + describe('setMetadataAsync', () => { + it('should set metadata', async () => { + // Arrange + const service: MediaSessionService = createService(); + const translatorServiceMock: IMock = Mock.ofType(); + const dateTimeMock: IMock = Mock.ofType(); + let settingsMock: any = {}; - // Act - service.initialize(); - playingNextTrack.next(createPlaybackInformation()); + const track: Track = new Track('path1'); + track.trackTitle = 'title1'; + track.artists = 'artist1'; + track.albumTitle = 'album1'; + const trackModel: TrackModel = new TrackModel(track, dateTimeMock.object, translatorServiceMock.object, settingsMock); - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.never()); - }); + const playbackInformation: PlaybackInformation = new PlaybackInformation(trackModel, 'image1'); - it('should not enable subscriptions so that metadata is set on playing previous track', () => { - // Arrange - settingsMock.enableMultimediaKeys = false; - const service: MediaSessionService = createService(); + playbackInformationFactoryMock.setup((x) => x.createAsync(trackModel)).returns(() => Promise.resolve(playbackInformation)); - // Act - service.initialize(); - playingPreviousTrack.next(createPlaybackInformation()); + // Act + await service.setMetadataAsync(trackModel); - // Assert - mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.never()); - }); + // Assert + mediaSessionProxyMock.verify((x) => x.setMetadata('title1', 'artist1', 'album1', 'image1'), Times.once()); }); }); }); diff --git a/src/app/services/playback/playback.service.spec.ts b/src/app/services/playback/playback.service.spec.ts index e127172e..a454c7ed 100644 --- a/src/app/services/playback/playback.service.spec.ts +++ b/src/app/services/playback/playback.service.spec.ts @@ -25,6 +25,9 @@ import { SettingsMock } from '../../testing/settings-mock'; import { QueuePersister } from './queue-persister'; import { AudioPlayerFactory } from './audio-player/audio-player.factory'; import { IAudioPlayer } from './audio-player/i-audio-player'; +import { MediaSessionService } from '../media-session/media-session.service'; + +jest.mock('jimp', () => ({ exec: jest.fn() })); describe('PlaybackService', () => { let audioPlayerFactoryMock: IMock; @@ -32,6 +35,7 @@ describe('PlaybackService', () => { let trackServiceMock: IMock; let playlistServiceMock: IMock; let notificationServiceMock: IMock; + let mediaSessionServiceMock: IMock; let queuePersisterMock: IMock; let trackSorterMock: IMock; let loggerMock: IMock; @@ -39,6 +43,11 @@ describe('PlaybackService', () => { let mathExtensionsMock: IMock; let settingsStub: any; let playbackFinished: Subject; + let playingPreloadedTrack: Subject; + let playEvent: Subject; + let pauseEvent: Subject; + let previousTrackEvent: Subject; + let nextTrackEvent: Subject; let subscription: Subscription; let dateTimeMock: IMock; let translatorServiceMock: IMock; @@ -72,6 +81,7 @@ describe('PlaybackService', () => { trackServiceMock = Mock.ofType(); playlistServiceMock = Mock.ofType(); notificationServiceMock = Mock.ofType(); + mediaSessionServiceMock = Mock.ofType(); dateTimeMock = Mock.ofType(); translatorServiceMock = Mock.ofType(); queuePersisterMock = Mock.ofType(); @@ -86,10 +96,25 @@ describe('PlaybackService', () => { settingsStub = { volume: 0.6 }; playbackFinished = new Subject(); + playingPreloadedTrack = new Subject(); + playEvent = new Subject(); + pauseEvent = new Subject(); + previousTrackEvent = new Subject(); + nextTrackEvent = new Subject(); const playbackFinished$: Observable = playbackFinished.asObservable(); - audioPlayerMock.setup((x) => x.playbackFinished$).returns(() => playbackFinished$); + const playingPreloadedTrack$: Observable = playingPreloadedTrack.asObservable(); + audioPlayerMock.setup((x) => x.playingPreloadedTrack$).returns(() => playingPreloadedTrack$); + + const playEvent$: Observable = playEvent.asObservable(); + mediaSessionServiceMock.setup((x) => x.playEvent$).returns(() => playEvent$); + const pauseEvent$: Observable = pauseEvent.asObservable(); + mediaSessionServiceMock.setup((x) => x.pauseEvent$).returns(() => pauseEvent$); + const previousTrackEvent$: Observable = previousTrackEvent.asObservable(); + mediaSessionServiceMock.setup((x) => x.previousTrackEvent$).returns(() => previousTrackEvent$); + const nextTrackEvent$: Observable = nextTrackEvent.asObservable(); + mediaSessionServiceMock.setup((x) => x.nextTrackEvent$).returns(() => nextTrackEvent$); subscription = new Subscription(); @@ -153,6 +178,7 @@ describe('PlaybackService', () => { trackServiceMock.object, playlistServiceMock.object, notificationServiceMock.object, + mediaSessionServiceMock.object, queuePersisterMock.object, trackSorterMock.object, queueMock.object, @@ -365,7 +391,7 @@ describe('PlaybackService', () => { playbackFinished.next(); // Assert - audioPlayerMock.verify((x) => x.play(trackModel1.path), Times.exactly(1)); + audioPlayerMock.verify((x) => x.play(trackModel1), Times.exactly(1)); }); it('should not play the next track on playback finished if found and if loopMode is One', () => { @@ -387,7 +413,7 @@ describe('PlaybackService', () => { playbackFinished.next(); // Assert - audioPlayerMock.verify((x) => x.play(trackModel2.path), Times.never()); + audioPlayerMock.verify((x) => x.play(trackModel2), Times.never()); }); it('should play the next track on playback finished if found and if loopMode is All', () => { @@ -409,7 +435,7 @@ describe('PlaybackService', () => { playbackFinished.next(); // Assert - audioPlayerMock.verify((x) => x.play(trackModel2.path), Times.exactly(1)); + audioPlayerMock.verify((x) => x.play(trackModel2), Times.exactly(1)); }); it('should play the next track on playback finished if found and if loopMode is None', () => { @@ -431,7 +457,7 @@ describe('PlaybackService', () => { playbackFinished.next(); // Assert - audioPlayerMock.verify((x) => x.play(trackModel2.path), Times.exactly(1)); + audioPlayerMock.verify((x) => x.play(trackModel2), Times.exactly(1)); }); it('should increase play count and date last played for the current track on playback finished', () => { @@ -699,7 +725,7 @@ describe('PlaybackService', () => { audioPlayerMock.reset(); audioPlayerMock.setup((x) => x.stop()).verifiable(Times.once(), ExpectedCallType.InSequence); - audioPlayerMock.setup((x) => x.play(trackModel1.path)).verifiable(Times.once(), ExpectedCallType.InSequence); + audioPlayerMock.setup((x) => x.play(trackModel1)).verifiable(Times.once(), ExpectedCallType.InSequence); queueMock.setup((x) => x.getFirstTrack()).returns(() => trackModel1); // Act @@ -795,7 +821,7 @@ describe('PlaybackService', () => { audioPlayerMock.reset(); audioPlayerMock.setup((x) => x.stop()).verifiable(Times.once(), ExpectedCallType.InSequence); - audioPlayerMock.setup((x) => x.play(trackModel1.path)).verifiable(Times.once(), ExpectedCallType.InSequence); + audioPlayerMock.setup((x) => x.play(trackModel1)).verifiable(Times.once(), ExpectedCallType.InSequence); // Act service.enqueueAndPlayTracksStartingFromGivenTrack(trackModels, trackModel1); @@ -881,7 +907,7 @@ describe('PlaybackService', () => { const artistToPlay: ArtistModel = new ArtistModel('artist1', translatorServiceMock.object); audioPlayerMock.reset(); audioPlayerMock.setup((x) => x.stop()).verifiable(Times.once(), ExpectedCallType.InSequence); - audioPlayerMock.setup((x) => x.play(trackModel2.path)).verifiable(Times.once(), ExpectedCallType.InSequence); + audioPlayerMock.setup((x) => x.play(trackModel2)).verifiable(Times.once(), ExpectedCallType.InSequence); queueMock.setup((x) => x.getFirstTrack()).returns(() => trackModel2); // Act @@ -971,7 +997,7 @@ describe('PlaybackService', () => { audioPlayerMock.reset(); audioPlayerMock.setup((x) => x.stop()).verifiable(Times.once(), ExpectedCallType.InSequence); - audioPlayerMock.setup((x) => x.play(trackModel2.path)).verifiable(Times.once(), ExpectedCallType.InSequence); + audioPlayerMock.setup((x) => x.play(trackModel2)).verifiable(Times.once(), ExpectedCallType.InSequence); queueMock.setup((x) => x.getFirstTrack()).returns(() => trackModel2); // Act @@ -1056,7 +1082,7 @@ describe('PlaybackService', () => { audioPlayerMock.reset(); audioPlayerMock.setup((x) => x.stop()).verifiable(Times.once(), ExpectedCallType.InSequence); - audioPlayerMock.setup((x) => x.play(trackModel2.path)).verifiable(Times.once(), ExpectedCallType.InSequence); + audioPlayerMock.setup((x) => x.play(trackModel2)).verifiable(Times.once(), ExpectedCallType.InSequence); queueMock.setup((x) => x.getFirstTrack()).returns(() => trackModel2); // Act @@ -1181,7 +1207,7 @@ describe('PlaybackService', () => { service.resume(); // Assert - audioPlayerMock.verify((x) => x.play(trackModel1.path), Times.once()); + audioPlayerMock.verify((x) => x.play(trackModel1), Times.once()); expect(service.isPlaying).toBeTruthy(); expect(service.canPause).toBeTruthy(); expect(service.canResume).toBeFalsy(); @@ -1278,7 +1304,7 @@ describe('PlaybackService', () => { service.playPrevious(); // Assert - audioPlayerMock.verify((x) => x.play(track1.path), Times.exactly(1)); + audioPlayerMock.verify((x) => x.play(trackModel1), Times.exactly(1)); expect(service.isPlaying).toBeTruthy(); expect(service.canPause).toBeTruthy(); expect(service.canResume).toBeFalsy(); @@ -1297,7 +1323,7 @@ describe('PlaybackService', () => { // Act service.playPrevious(); // Assert - audioPlayerMock.verify((x) => x.play(trackModel2.path), Times.exactly(1)); + audioPlayerMock.verify((x) => x.play(trackModel2), Times.exactly(1)); expect(service.isPlaying).toBeTruthy(); expect(service.canPause).toBeTruthy(); expect(service.canResume).toBeFalsy(); @@ -1433,6 +1459,7 @@ describe('PlaybackService', () => { ); // Act service.playPrevious(); + // Assert expect(receivedTrack).toBe(trackModel2); expect(isPlayingPreviousTrack).toBeTruthy(); @@ -1521,7 +1548,7 @@ describe('PlaybackService', () => { // Assert audioPlayerMock.verify((x) => x.stop(), Times.exactly(1)); - audioPlayerMock.verify((x) => x.play(trackModel2.path), Times.exactly(1)); + audioPlayerMock.verify((x) => x.play(trackModel2), Times.exactly(1)); expect(service.isPlaying).toBeTruthy(); expect(service.canPause).toBeTruthy(); expect(service.canResume).toBeFalsy(); @@ -1908,7 +1935,7 @@ describe('PlaybackService', () => { audioPlayerMock.reset(); audioPlayerMock.setup((x) => x.stop()).verifiable(Times.once(), ExpectedCallType.InSequence); - audioPlayerMock.setup((x) => x.play(trackModel2.path)).verifiable(Times.once(), ExpectedCallType.InSequence); + audioPlayerMock.setup((x) => x.play(trackModel2)).verifiable(Times.once(), ExpectedCallType.InSequence); // Act service.playQueuedTrack(trackModel2); @@ -2216,7 +2243,7 @@ describe('PlaybackService', () => { // Assert queueMock.verify((x) => x.getNextTrack(trackModel1, It.isAny()), Times.once()); - audioPlayerMock.verify((x) => x.play(trackModel2.path), Times.once()); + audioPlayerMock.verify((x) => x.play(trackModel2), Times.once()); }); }); diff --git a/src/app/services/playback/playback.service.ts b/src/app/services/playback/playback.service.ts index 961cd546..ca0f29aa 100644 --- a/src/app/services/playback/playback.service.ts +++ b/src/app/services/playback/playback.service.ts @@ -388,10 +388,10 @@ export class PlaybackService { private play(trackToPlay: TrackModel, isPlayingPreviousTrack: boolean): void { this.audioPlayer.play(trackToPlay); - this.postPlay(trackToPlay); + this.postPlay(trackToPlay, isPlayingPreviousTrack); } - private postPlay(trackToPlay: TrackModel): void { + private postPlay(trackToPlay: TrackModel, isPlayingPreviousTrack: boolean): void { this.currentTrack = trackToPlay; this._isPlaying = true; this._canPause = true; @@ -400,7 +400,7 @@ export class PlaybackService { this.mediaSessionService.setMetadataAsync(trackToPlay); this.startUpdatingProgress(); - this.playbackStarted.next(new PlaybackStarted(trackToPlay, false)); + this.playbackStarted.next(new PlaybackStarted(trackToPlay, isPlayingPreviousTrack)); this.logger.info(`Playing '${this.currentTrack.path}'`, 'PlaybackService', 'play'); @@ -466,7 +466,7 @@ export class PlaybackService { private playingPreloadedTrackHandler(preloadedTrack: TrackModel): void { this.increasePlayCountAndDateLastPlayedForCurrentTrack(); - this.postPlay(preloadedTrack); + this.postPlay(preloadedTrack, false); } private increaseCountersForCurrentTrackBasedOnProgress(): void { @@ -585,7 +585,7 @@ export class PlaybackService { private startPaused(track: TrackModel, skipSeconds: number): void { this.audioPlayer.startPaused(track, skipSeconds); - this.postPlay(track); + this.postPlay(track, false); this.postPause(); this.startUpdatingProgress(); }