return RTSP stream

Viewed 40

There is a problem with the return

return RTSPClient.CodecData 

    

I want to use it as a func elsewhere but I can't return

Thanks in advance for your help.

func StreamGo(name string) {

    fmt.Println("Stream Start")
    RTSPClient, err := rtspv2.Dial(rtspv2.RTSPClientOptions{URL: name, DisableAudio: true, DialTimeout: 3 * time.Second, ReadWriteTimeout: 3 * time.Second, Debug: false})
    
    defer RTSPClient.Close()
    if err != nil {
        log.Println(err)
    }

    if RTSPClient.CodecData != nil {

        return RTSPClient.CodecData             
    }
}
0 Answers
Related