-
Notifications
You must be signed in to change notification settings - Fork 86
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
[help] How to get "App" in "On*" hooks? #29
Comments
Hi. Thank you for your comments! My answers are
I have been developing this library by putting emphasis on subscribing from client side and publishing to server side(for internal relay server), thus the way to publish streams to client side may be lacking. However I can make an example for simple RTMP relay server of 1:N with improving the library in a couple days. I'll do that as soon as possible. Thank you for your patience. 🙏 |
Thanks a lot for this awesome complete reply :) I can help you if you want. Actually, we use github.com/nareix/joy4 but your code is very clear and tested ;) |
I'm sorry for my late. Now I'm busy with working on other tasks, and I don't have much time to do this task. 🙇♂️ |
Ok. Thanks. ;) Good luck 🍀 |
Hello! Are there any updates on this? I also need to access the publishingName on the OnAudio/OnVideo listeners. Can this be done now? Thank you! |
Is this code helpful? If this is not what you intended, please let me know 🙏 type Handler struct {
rtmp.DefaultHandler
// value holders
app string
publishingName string
}
func (h *Handler) OnConnect(timestamp uint32, cmd *rtmpmsg.NetConnectionConnect) error {
h.app = cmd.Command.App // Save values to each handler instances
return nil
}
func (h *Handler) OnPublish(timestamp uint32, cmd *rtmpmsg.NetStreamPublish) error {
log.Printf("App Name: %v", h.app) // Read the 'App' value saved in the handler
h.publishingName = cmd.PublishingName // Same
return nil
}
func (h *Handler) OnAudio(timestamp uint32, payload io.Reader) error {
log.Printf("App Name: %v", h.publishingName) // Read the 'PublishingName' value saved in the handler
} Thank you. |
Hello! This will only allow for 1 publishingName, right? I need to have multiple inputs and to write audio/video only for peers watching the video publishingName |
Is it possible to pass the publishingName as a parameter of OnAudio/OnVideo? Thank you! |
@yutopp I have tested this and it only works with 1 video input. I have been trying to understand the structure of the project, but haven't been able to understand where should I store the PushingName (or another identifier) that allows me to serve multiple input streams. Can you help me? Thank you in advance! |
Sorry for the roughness, but I've added a sample that relays RTMP streams by stream name. https://github.com/yutopp/go-rtmp/tree/master/example/server_relay_demo It can handle multiple input streams per publishing names. Please comments if I'm missing anything. Thanks! |
Hello! I will give feedback as soon as I make it work with webRTC! Again, thank you! |
I'm glad to hear that! |
Hi.
But my problem is, as the OnPlay will not be executed in my code (as it won't be an RTMP client, but a webRTC one), how can I replicate what you did here? Thank you so much for your help 😄 |
Hi!
Thanks a lot for your work!
My use cases:
ffmpeg -i file.mp4 -c copy -f flv rtmp://0.0.0.0:1935/xxx/yyy
rtmp://0.0.0.0:1935/xxx/yyy
http://0.0.0.0:8080/xxx/yyy
My questions:
App
inOnPlay
orOnPublish
hooks of handler?The text was updated successfully, but these errors were encountered: