layeh / gumble

gumble is a Mumble client implementation in Go (golang)
https://pkg.go.dev/mod/layeh.com/gumble
Mozilla Public License 2.0
172 stars 55 forks source link

Questions about gumble_ffmpeg changes #16

Closed matthieugrieger closed 9 years ago

matthieugrieger commented 9 years ago

Hi there,

I have some questions about how gumble_ffmpeg works now since it seems to have been reworked.

1) Since the arguments to Play() have been removed, does SourceFile() need to be used to specify the file to stream from? Whenever I use this function I get a "nil source" error even though the source file definitely exists. The audio player example project just passes the filename to the Play() function, but I think it might be outdated.

2) What is the correct way to do callbacks after the song has finished? It used to be passed into Play() as well but now I'm guessing you have to use Wait() in some fashion?

Thanks!

ghost commented 9 years ago

does SourceFile() need to be used to specify the file to stream from?

Yes. Here is an example:

stream := gumble_ffmpeg.New(client)
stream.Source = gumble_ffmpeg.SourceFile("myfile.mp3")
stream.Play()

The audio player example project just passes the filename to the Play() function, but I think it might be outdated.

I need to fix that. Thank you for the reminder.

What is the correct way to do callbacks after the song has finished?

// ...
stream.Play()
go func() {
   stream.Wait()
   mycallbackfunc()
} ()
matthieugrieger commented 9 years ago

Thanks for the response! On May 9, 2015 6:16 PM, "Tim Cooper" notifications@github.com wrote:

does SourceFile() need to be used to specify the file to stream from?

Yes. Here is an example:

stream := gumble_ffmpeg.New(client) stream.Source = gumble_ffmpeg.SourceFile("myfile.mp3") stream.Play()

The audio player example project just passes the filename to the Play() function, but I think it might be outdated.

I need to fix that. Thank you for the reminder.

What is the correct way to do callbacks after the song has finished?

// ... stream.Play()go func() { stream.Wait() mycallbackfunc() } ()

— Reply to this email directly or view it on GitHub https://github.com/layeh/gumble/issues/16#issuecomment-100568701.

matthieugrieger commented 9 years ago

Awesome, I've got it working now!