@@ -39,9 +39,17 @@ class CommandsManagerAmf0: CommandsManager() {
3939 val connect = CommandAmf0 (" connect" , ++ commandId, getCurrentTimestamp(), streamId,
4040 BasicHeader (ChunkType .TYPE_0 , ChunkStreamId .OVER_CONNECTION .mark))
4141 val connectInfo = AmfObject ()
42- connectInfo.setProperty(" app" , appName + auth)
42+
43+ // Prefer custom app/tcUrl if provided, and always append auth to keep auth flow working
44+ val customApp = customAmfObject[" app" ]?.toString()
45+ val customTcUrl = customAmfObject[" tcUrl" ]?.toString()
46+ val finalApp = (customApp ? : appName) + auth
47+ val finalTcUrl = (customTcUrl ? : tcUrl) + auth
48+
49+ connectInfo.setProperty(" app" , finalApp)
4350 connectInfo.setProperty(" flashVer" , flashVersion)
44- connectInfo.setProperty(" tcUrl" , tcUrl + auth)
51+ connectInfo.setProperty(" tcUrl" , finalTcUrl)
52+
4553 if (! videoDisabled) {
4654 if (videoCodec == VideoCodec .H265 ) {
4755 val list = mutableListOf<AmfData >()
@@ -56,8 +64,14 @@ class CommandsManagerAmf0: CommandsManager() {
5664 }
5765 }
5866 connectInfo.setProperty(" objectEncoding" , 0.0 )
67+
68+ // Inject other custom AMF fields as-is; skip app/tcUrl since we've handled them with auth
5969 customAmfObject.forEach { (key, value) ->
60- connectInfo.setProperty(key, value)
70+ when (key) {
71+ " app" -> connectInfo.setProperty(" app" , finalApp)
72+ " tcUrl" -> connectInfo.setProperty(" tcUrl" , finalTcUrl)
73+ else -> connectInfo.setProperty(key, value)
74+ }
6175 }
6276 connect.addData(connectInfo)
6377
0 commit comments