Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublishTrack fail #520

Open
huxinggg opened this issue Aug 14, 2024 · 1 comment
Open

PublishTrack fail #520

huxinggg opened this issue Aug 14, 2024 · 1 comment

Comments

@huxinggg
Copy link

huxinggg commented Aug 14, 2024

echoTrack, err := lksdk.NewLocalTrack(webrtc.RTPCodecCapability{
MimeType: webrtc.MimeTypeOpus,
ClockRate: 16000,
Channels: 1,
})
if err != nil {
panic(err)
}
payload, _ := os.ReadFile("/Users/huxing/Desktop/work/jibengong/server/ai_server/nimaaaa.ogg")
bufa := bytes.NewBuffer(payload)
go func() {
for {
//time.Sleep(time.Millisecond * 20)
chunk := make([]byte, 512)
n, _ := bufa.Read(chunk)
if n == 0 {
continue
}
payL := chunk[:n]
fmt.Println("nnnn", payL)
echoTrack.WriteSample(media.Sample{Data: payL, Duration: 20 * time.Millisecond}, &lksdk.SampleWriteOptions{})
}
}()
s.roomClient.LocalParticipant.PublishTrack(echoTrack, &lksdk.TrackPublicationOptions{
Name: "test",
})

@huxinggg
Copy link
Author

Can you please tell me what's wrong with this code?	use lksdk.NewLocalFileTrack() no problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant