options := dca.StdEncodeOptions
options.RawOutput = true
options.Bitrate = 96
options.Application = "lowdelay"
videoInfo, err := ytdl.GetVideoInfo(videoURL)
if err != nil {
// Handle the error
}
format := videoInfo.Formats.Extremes(ytdl.FormatAudioBitrateKey, true)[0]
downloadURL, err := videoInfo.GetDownloadURL(format)
if err != nil {
// Handle the error
}
encodingSession, err := dca.EncodeFile(downloadURL.String(), options)
if err != nil {
// Handle the error
}
defer encodingSession.Cleanup()
done := make(chan error)
dca.NewStream(encodingSession, voiceConnection, done)
err := <- done
if err != nil && err != io.EOF {
// Handle the error
}
how would i stop the music from playing? Can i use the done channel created by the stream? I'm using that code in a go routine and need to stop it from another go routine.
Using this example:
how would i stop the music from playing? Can i use the done channel created by the stream? I'm using that code in a go routine and need to stop it from another go routine.