You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling the PlayAsync method with a passed playlist of the TrackLoadResult type from this Extension, tracks from the playlist other than the first one are not added to Lavalink
The reason is most likely this:
When the first track is added to Lavalink, the PlayAsync method will return 0 and queueOffset will not be null. Then in the second iteration, the operator ??= will see that the left operand of queueOffset is not null, and accordingly discards the right operand without calling the method
publicstaticasyncValueTask<int>PlayAsync(thisIQueuedLavalinkPlayerplayer,TrackLoadResultloadResult,CancellationTokencancellationToken=default){cancellationToken.ThrowIfCancellationRequested();varqueueOffset=default(int?);if(loadResult.Playlistisnull){queueOffset??=awaitplayer.PlayAsync(loadResult.Track!,cancellationToken:cancellationToken).ConfigureAwait(false);}else{foreach(vartrackinloadResult.Tracks){// There's a problem herequeueOffset??=awaitplayer.PlayAsync(track,cancellationToken:cancellationToken).ConfigureAwait(false);}}returnqueueOffset??thrownewInvalidOperationException("No track is present.");}
The text was updated successfully, but these errors were encountered:
When calling the PlayAsync method with a passed playlist of the TrackLoadResult type from this Extension, tracks from the playlist other than the first one are not added to Lavalink
The reason is most likely this:
When the first track is added to Lavalink, the PlayAsync method will return 0 and queueOffset will not be null. Then in the second iteration, the operator ??= will see that the left operand of queueOffset is not null, and accordingly discards the right operand without calling the method
The source file: https://github.com/angelobreuer/Lavalink4NET/blob/dev/src/Lavalink4NET/Extensions/QueuedLavalinkPlayerExtensions.cs#L29
The text was updated successfully, but these errors were encountered: