-
-
Notifications
You must be signed in to change notification settings - Fork 29
Player Controls
To play a track, you first need to resolve one (for more details see "Resolving a track").
var myTrack = await myAudioService.GetTrackAsync("Hello World!", SearchMode.YouTube);
await myPlayer.PlayAsync(myTrack);
enqueue
parameter.
When a track is playing, it can be stopped using:
await myPlayer.StopAsync(disconnect: true);
This will pause the track. It can be resumed using myPlayer.ResumeAsync()
.
await myPlayer.PauseAsync();
State != PlayerState.Paused
.
This will resume the paused track.
await myPlayer.ResumeAsync();
State == PlayerState.Paused
.
await myPlayer.SeekPositionAsync(TimeSpan.FromSeconds(12));
The above example will play the track at the 12th second.
await myPlayer.SetVolumeAsync(.2f);
The above example will set the player volume to 20%.
The player volume can be set from 0f
(Muted / 0%) to 10f
(1000%).
Disconnecting from the voice channel, disconnects the player and leaves the voice channel.
await myPlayer.DisconnectAsync();
await myPlayer.ConnectAsync(voiceChannelId, selfDeaf: false, selfMute: false);
Remarks on selfDeaf
and selfMute
:
When selfDeaf
is true
then the user will be self-deafened. This does not affect playing. When selfMute
is false
then the user will be self-muted. This will also mute the player.
Lavalink4NET Wiki - Licensed under MIT