jogramming / dca

Go implementation for the DCA audio format
BSD 3-Clause "New" or "Revised" License
75 stars 60 forks source link

Returning "EOF" error in the beginning of the file. #27

Closed code-qote closed 2 years ago

code-qote commented 2 years ago

Hello. I'm trying to stream audio to Discord. I used example from README but I always get "EOF" error from dca.NewStream. I debugged the source files of this package but I didn't find a reason. Also I tried to pass local file not URL but got the same problem.

encodeSession, err := dca.EncodeFile(StreamURL, options)
if err != nil {
        log.Println("ERR: dca.EncodeFile(StreamURL, options): " + err.Error())
        return err
}
encoder = encodeSession
defer encodeSession.Cleanup()
done := make(chan error)
stream := dca.NewStream(encodeSession, voice, done)

for err := range done {
        if err != nil && err != io.EOF {
            log.Println("FATA: An error occurred", err)
        }

        if err == io.EOF {
            encodeSession.Cleanup()
            break
        }
}
return nil
code-qote commented 2 years ago

SOLVED: I removed my FFmpeg and compiled it again with --enable-openssl because DCA streams from https. FFmpeg without openssl can work only with http.