public PlaybackService() { _playlistService = new PlaylistService(this); _playlistService.OnPlaylistEndReached += () => OnPlaylistEndReached?.Invoke(); _playlistService.OnPlaylistChanged += () => OnPlaylistChanged?.Invoke(); _playlistService.OnCurrentMediaChanged += onCurrentMediaChanged; _playlistService.OnRepeatChanged += (v) => OnRepeatChanged?.Invoke(v); PlayingType = PlayingType.NotPlaying; }
private void OnMediaEndReached() { if (CanGoNext == false) { if (!Repeat) { OnPlaylistEndReached?.Invoke(); // Don't use the Index property, this would cause the listener to start playback immediately _index = 0; OnCurrentMediaChanged?.Invoke(CurrentMedia, true); return; } Index = 0; } else { Index++; } }