lucaslorentz / AS3RtmpClient

A proof of concept AS3 RtmpClient using sockets, based on Flazr.
19 stars 16 forks source link

Just a question #1

Closed valtersboze closed 11 years ago

valtersboze commented 11 years ago

how do you accomplish sending customized swfUrl, pageUrl, and other connection parameters?

lucaslorentz commented 11 years ago

This library is a replacement to the Flash Player native RTMPClient. It is written in AS3 and uses the socket API. So, I have full control of the whole communication (including what is sent to the server). To allow an easier reuse of connections, this library understands the same format of librtmp (http://rtmpdump.mplayerhq.hu/librtmp.3.html).

valtersboze commented 11 years ago

what I meant was, can you show a simple example code lines that specify swfurl,pageurl? couldnt find where i would assign them or how do i send them to server so that server understands that it is the correct parameter..

valtersboze commented 11 years ago

as i understand i should make it like this:

var connectionConfig:String = "rtmp://cp137781.live.edgefcs.net:443/live?ovpfv=2.1.4&auth=yyyyy&aifp=zzzz swfVfy=1 token=daEbYcsavddbJcfaac6c7dYaZb8blaycnc_-bravvc-cmO-vtIlruyEGtq playpath=MeethiMirchi@16318 swfUrl=http://gaana.com/media/flash/GaanaPlayerV2_v9.swf pageUrl=http://gaana.com/#!/radiostations/meethi-mirchi objectEncoding=";

but the connection cant complete if there is "?" or "&" in the rtmp url. it dies "rtmpClient::RtmpConnection/connectInternal()" , but the server needs to use url GET based verification for the auth, aifp and ovpf parameters. as soon as i strip "?ovpfv=2.1.4&auth=yyyyy&aifp=zzzz" from the url, it does connect, but cant pass server verification.. any ideas how to write the url?

i tried to hardcode the _rtmpConnection.connect(url), but still cant run

lucaslorentz commented 11 years ago

Yeah. You're right.

It will not work with that URL. The URL parser needs to be fixed. And the library don't support complex handshakes with swf validations, hash, crypto.

I got the library working on streams with simple URLs (like the ones from Flash Media Server), with basic handshake, and only swfurl, pageurl validations. Will add that info on the main page.

If you want to improve it. It would be very nice.

valtersboze commented 11 years ago

sorry, the swfVfy=1 shouldnt be there, i dont need size/hash verifications. just the url parser so that it could connect to service that has ? and & in url.. i tried to add the url manually in connection files but still didnt succeed :/ maybe the url should be escaped / urlencoded in some specific way? couldnt manage to do that with regular encodes (%3E, %26).. any ideas?

i kinda set the "_application" parameter manually to: _application = "live?ovpfv=2.1.4&auth=yyyyy&aifp=zzzz";

but still connection closes after that:

Sent C0, C1 Received S0, S1 Invalid S0, S1 Received S0, S1 Invalid S0, S1 Received S0, S1 Sent command (expecting result): [0 20 c3 #0 t0 (0) s469]name: connect, transactionId: 1, object: [object Object] args: null Sent C2, Connect decoder new chunk size: {} [1 1 c2 #0 t2499837 (2278461) s4]4096 server command: _result Sent command (expecting result): [0 20 c3 #0 t0 (0) s25]name: createStream, transactionId: 2, object: null args: null server command: onBWDone Received S2 socketClose: [Event type="close" bubbles=false cancelable=false eventPhase=2]

p.s. its online radio live stream, not video

lucaslorentz commented 11 years ago

Did you get it working using rtmpdump? Can I open that stream to investigate it?

valtersboze commented 11 years ago

i updated previous comment.. yes, with rtmpdump it works:

rtmpdump -r="rtmp://cp137781.live.edgefcs.net:443/live?ovpfv=2.1.4&auth=yyyyy&aifp=zzzz" --playpath="MeethiMirchi@16318" --swfUrl="http://gaana.com/media/flash/GaanaPlayerV2_v9.swf" --pageUrl="http://gaana.com/#!/radiostations/meethi-mirchi" --live --flv="test.flv"

since it works with simple rtmpdump, should securetoken be required at all?

lucaslorentz commented 11 years ago

So, it works without the secure token. I will try to findout more things.

valtersboze commented 11 years ago

Thank you for your help, I really appreciate it!

lucaslorentz commented 11 years ago

Done. Get the latest code, use this connection url: rtmp://cp137781.live.edgefcs.net:443/live?ovpfv=2.1.4&auth=yyyyy&aifp=zzzz playpath=MeethiMirchi@16318 swfUrl=http://gaana.com/media/flash/GaanaPlayerV2_v9.swf pageUrl=http://gaana.com/#!/radiostations/meethi-mirchi It worked for me. Let me know if it works. Some things needs to be improved, like bandwidth and so on.

valtersboze commented 11 years ago

OMG, it works! You`re genius! Thank you so much!!!

naumanafzal commented 11 years ago

Hi,

I have a url with token it only plays for one sec and then server closes connection automatically. It works fine on rtmpdump. I guess server is expecting to Invoke secureTokenResponse between connect and createstream calls. Following is the partial log from rtmpdump,

DEBUG: Property: <Name: secureToken, STRING: 7fdf00d7139aa924f0a68bd1 3e65312f92269bc8415addae6e8b42aeb82424e29d9318e0> DEBUG: (object end) DEBUG: (object end) DEBUG: HandleInvoke, server invoking <_result> DEBUG: HandleInvoke, received result for method call DEBUG2: RTMP_SendPacket: fd=128, size=71 DEBUG2: 0000: 43 00 00 00 00 00 47 14 C.....G.

DEBUG2: 0000: 02 00 13 73 65 63 75 72 65 54 6f 6b 65 6e 52 65 ...secureTok enRe DEBUG2: 0010: 73 70 6f 6e 73 65 00 00 00 00 00 00 00 00 00 05 sponse...... .... DEBUG2: 0020: 02 00 24 32 62 34 33 63 31 35 62 2d 36 37 62 62 ..$2b43c15b- 67bb DEBUG2: 0030: 2d 34 64 37 35 2d 62 36 33 61 2d 31 39 65 64 38 -4d75-b63a-1 9ed8 DEBUG2: 0040: 30 36 39 38 63 66 35 0698cf5

DEBUG: Invoking secureTokenResponse

indiarocks08 commented 10 years ago

hi, Pls tell me what is auth=yyyyy&aifp=zzzz ???