I need to create RTMP client using java socket programming. I read this documents and
1 . I have performed handshaking successfully through java socket programming.
Now next step is to send 'connect' command to the server. I am creating RTMP packet as given in document and then writing them to the output stream using DataOutputStream. As per given details 'connect' packect's body should look like as below:
(Invoke) “connect”
(Transaction ID) 1.0
(Object1) { app: “sample”, flashVer: “MAC 10,2,153,2”, swfUrl: null,
tcUrl: “rtmpt://127.0.0.1/sample “, fpad: false,
capabilities: 9947.75 , audioCodecs: 3191, videoCodecs: 252,
videoFunction: 1 , pageUrl: null, objectEncoding: 3.0 }
I could not understood how to convert above into AMF3 encoded bytes. Should I just need to AMF encode "connect:", 1.0 ... and write to OutputStream. Also major problem is that how to encode the object (Given key value pairs). Should I encode& write to socket first keys and then AMF encoded values. Is there need to include & operators between two pairs something like http protocol's body? . I did RnD deeply but could not find the code to create this packet and write to the socket.
Please suggest. thanks.