Open kbats183 opened 2 months ago
please refer to this code
sess.handle.OnPublish(func(app, streamName string) rtmp.StatusCode {
if streamName == "stream_reject" {
return rtmp.NETCONNECT_CONNECT_REJECTED
}
return rtmp.NETSTREAM_PUBLISH_START
})
sess.handle.OnStateChange(func(newState rtmp.RtmpState) {
if newState == rtmp.STATE_RTMP_PLAY_START {
} else if newState == rtmp.STATE_RTMP_PUBLISH_START {
} else if newState == rtmp.STATE_RTMP_PUBLISH_FAILED {
fmt.Println("publish failed")
sess.stop()
}
})
Hello.
I am working on rtmp restreamer. Some rtmp servers can reject connection if user sends incorrect stream key. In this case, OBS shows a message like this
I took code from example and their method
OnPublish
returns onlyrtmp.NETSTREAM_PUBLISH_START
.How can I reject connection with incorrect stream name here?
Thank you for your answer!