diff --git a/internal/core/rtmp_conn.go b/internal/core/rtmp_conn.go index aaed6edf..ac5cab02 100644 --- a/internal/core/rtmp_conn.go +++ b/internal/core/rtmp_conn.go @@ -277,6 +277,15 @@ func (c *rtmpConn) runRead(ctx context.Context) error { Author: c, }) + if c.path.Conf().RunOnRead != "" { + _, port, _ := net.SplitHostPort(c.rtspAddress) + onReadCmd := externalcmd.New(c.path.Conf().RunOnRead, c.path.Conf().RunOnReadRestart, externalcmd.Environment{ + Path: c.path.Name(), + Port: port, + }) + defer onReadCmd.Close() + } + // disable read deadline c.conn.NetConn().SetReadDeadline(time.Time{})