diff --git a/rtmp/conn.go b/rtmp/conn.go index 1db2cb6e..3864df98 100644 --- a/rtmp/conn.go +++ b/rtmp/conn.go @@ -121,17 +121,6 @@ func Dial(url string, timeout uint, log Log) (*Conn, error) { if err != nil { return nil, err } - if c.link.port == 0 { - switch { - case (c.link.protocol & featureSSL) != 0: - c.link.port = 433 - c.log(FatalLevel, pkg+"SSL not supported") - case (c.link.protocol & featureHTTP) != 0: - c.link.port = 80 - default: - c.link.port = 1935 - } - } c.link.url = rtmpProtocolStrings[c.link.protocol] + "://" + c.link.host + ":" + strconv.Itoa(int(c.link.port)) + "/" + c.link.app c.link.protocol |= featureWrite diff --git a/rtmp/parseurl.go b/rtmp/parseurl.go index ad3409b6..c2880368 100644 --- a/rtmp/parseurl.go +++ b/rtmp/parseurl.go @@ -99,5 +99,15 @@ func parseURL(addr string) (protocol int32, host string, port uint16, app, playp } } + if port == 0 { + switch { + case (protocol & featureSSL) != 0: + port = 433 + case (protocol & featureHTTP) != 0: + port = 80 + default: + port = 1935 + } + } return protocol, host, port, app, playpath, nil }